@scell/sdk 1.2.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +61 -2
  3. package/dist/index.d.mts +2353 -236
  4. package/dist/index.d.ts +2353 -236
  5. package/dist/index.js +1308 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1308 -2
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/src/client.ts +3 -1
  11. package/src/errors.ts +0 -0
  12. package/src/index.ts +42 -2
  13. package/src/resources/api-keys.ts +0 -0
  14. package/src/resources/auth.ts +0 -0
  15. package/src/resources/balance.ts +0 -0
  16. package/src/resources/billing.ts +49 -0
  17. package/src/resources/companies.ts +0 -0
  18. package/src/resources/fiscal.ts +128 -0
  19. package/src/resources/invoices.ts +0 -0
  20. package/src/resources/signatures.ts +33 -0
  21. package/src/resources/stats.ts +29 -0
  22. package/src/resources/sub-tenants.ts +41 -0
  23. package/src/resources/tenant-credit-notes.ts +301 -0
  24. package/src/resources/tenant-direct-credit-notes.ts +360 -0
  25. package/src/resources/tenant-direct-invoices.ts +424 -0
  26. package/src/resources/tenant-incoming-invoices.ts +429 -0
  27. package/src/resources/webhooks.ts +0 -0
  28. package/src/tenant-client.ts +105 -0
  29. package/src/types/api-keys.ts +0 -0
  30. package/src/types/auth.ts +0 -0
  31. package/src/types/balance.ts +0 -0
  32. package/src/types/billing.ts +73 -0
  33. package/src/types/common.ts +0 -0
  34. package/src/types/companies.ts +0 -0
  35. package/src/types/fiscal.ts +251 -0
  36. package/src/types/index.ts +103 -0
  37. package/src/types/invoices.ts +0 -0
  38. package/src/types/signatures.ts +0 -0
  39. package/src/types/stats.ts +37 -0
  40. package/src/types/sub-tenants.ts +57 -0
  41. package/src/types/tenant-credit-notes.ts +128 -0
  42. package/src/types/tenant-invoices.ts +390 -0
  43. package/src/types/tenant-profile.ts +51 -0
  44. package/src/types/webhooks.ts +0 -0
  45. package/src/utils/retry.ts +0 -0
  46. package/src/utils/webhook-verify.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scell/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.5.0",
4
4
  "description": "Official TypeScript SDK for Scell.io - Electronic invoicing (Factur-X) and signatures (eIDAS) API",
5
5
  "author": "Scell.io <contact@scell.io>",
6
6
  "license": "MIT",
package/src/client.ts CHANGED
@@ -14,7 +14,7 @@ import { withRetry, type RetryOptions } from './utils/retry.js';
14
14
  /**
15
15
  * Authentication mode
16
16
  */
17
- export type AuthMode = 'bearer' | 'api-key';
17
+ export type AuthMode = 'bearer' | 'api-key' | 'tenant-key';
18
18
 
19
19
  /**
20
20
  * Client configuration options
@@ -116,6 +116,8 @@ export class HttpClient {
116
116
 
117
117
  if (this.authMode === 'bearer') {
118
118
  headers['Authorization'] = `Bearer ${this.authToken}`;
119
+ } else if (this.authMode === 'tenant-key') {
120
+ headers['X-Tenant-Key'] = this.authToken;
119
121
  } else {
120
122
  headers['X-API-Key'] = this.authToken;
121
123
  }
package/src/errors.ts CHANGED
File without changes
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @example
7
7
  * ```typescript
8
- * import { ScellClient, ScellApiClient, ScellAuth, ScellWebhooks } from '@scell/sdk';
8
+ * import { ScellClient, ScellApiClient, ScellTenantClient, ScellAuth, ScellWebhooks } from '@scell/sdk';
9
9
  *
10
10
  * // Dashboard client (Bearer token)
11
11
  * const auth = await ScellAuth.login({ email, password });
@@ -14,9 +14,15 @@
14
14
  * // API client (X-API-Key)
15
15
  * const apiClient = new ScellApiClient('your-api-key');
16
16
  *
17
+ * // Tenant client (X-Tenant-Key) - for multi-tenant operations
18
+ * const tenantClient = new ScellTenantClient('your-tenant-key');
19
+ *
17
20
  * // Create invoice
18
21
  * const invoice = await apiClient.invoices.create({...});
19
22
  *
23
+ * // Create direct invoice (tenant)
24
+ * const directInvoice = await tenantClient.directInvoices.create({...});
25
+ *
20
26
  * // Verify webhook
21
27
  * const isValid = await ScellWebhooks.verifySignature(payload, signature, secret);
22
28
  * ```
@@ -25,13 +31,23 @@
25
31
  // Client
26
32
  import { HttpClient, type ClientConfig } from './client.js';
27
33
 
34
+ // Tenant Client
35
+ import { ScellTenantClient } from './tenant-client.js';
36
+
28
37
  // Resources
29
38
  import { ApiKeysResource } from './resources/api-keys.js';
30
39
  import { AuthResource, ScellAuth } from './resources/auth.js';
31
40
  import { BalanceResource } from './resources/balance.js';
41
+ import { BillingResource } from './resources/billing.js';
32
42
  import { CompaniesResource } from './resources/companies.js';
43
+ import { FiscalResource } from './resources/fiscal.js';
33
44
  import { InvoicesResource } from './resources/invoices.js';
34
45
  import { SignaturesResource } from './resources/signatures.js';
46
+ import { StatsResource } from './resources/stats.js';
47
+ import { SubTenantsResource } from './resources/sub-tenants.js';
48
+ import { TenantCreditNotesResource } from './resources/tenant-credit-notes.js';
49
+ import { TenantDirectInvoicesResource } from './resources/tenant-direct-invoices.js';
50
+ import { TenantIncomingInvoicesResource } from './resources/tenant-incoming-invoices.js';
35
51
  import { WebhooksResource } from './resources/webhooks.js';
36
52
 
37
53
  // Utilities
@@ -143,11 +159,25 @@ export class ScellApiClient {
143
159
  public readonly invoices: InvoicesResource;
144
160
  /** Signature operations (create, download, remind, cancel) */
145
161
  public readonly signatures: SignaturesResource;
162
+ /** Sub-tenant management (provision, update, list) */
163
+ public readonly subTenants: SubTenantsResource;
164
+ /** NF525 fiscal compliance (closings, FEC, attestation) */
165
+ public readonly fiscal: FiscalResource;
166
+ /** Platform statistics */
167
+ public readonly stats: StatsResource;
168
+ /** Platform billing (usage, top-up, transactions) */
169
+ public readonly billing: BillingResource;
170
+ /** Credit notes operations (create, send, download) */
171
+ public readonly creditNotes: TenantCreditNotesResource;
172
+ /** Tenant invoice operations (create, submit, update, delete) */
173
+ public readonly tenantInvoices: TenantDirectInvoicesResource;
174
+ /** Incoming invoice operations (list, accept, reject) */
175
+ public readonly incomingInvoices: TenantIncomingInvoicesResource;
146
176
 
147
177
  /**
148
178
  * Create a new Scell API Client
149
179
  *
150
- * @param apiKey - Your API key (from dashboard)
180
+ * @param apiKey - Your API key (sk_live_xxx or sk_test_xxx)
151
181
  * @param config - Client configuration
152
182
  *
153
183
  * @example
@@ -166,12 +196,22 @@ export class ScellApiClient {
166
196
 
167
197
  this.invoices = new InvoicesResource(this.http);
168
198
  this.signatures = new SignaturesResource(this.http);
199
+ this.subTenants = new SubTenantsResource(this.http);
200
+ this.fiscal = new FiscalResource(this.http);
201
+ this.stats = new StatsResource(this.http);
202
+ this.billing = new BillingResource(this.http);
203
+ this.creditNotes = new TenantCreditNotesResource(this.http);
204
+ this.tenantInvoices = new TenantDirectInvoicesResource(this.http);
205
+ this.incomingInvoices = new TenantIncomingInvoicesResource(this.http);
169
206
  }
170
207
  }
171
208
 
172
209
  // Re-export utilities
173
210
  export { ScellAuth, ScellWebhooks, withRetry, createRetryWrapper };
174
211
 
212
+ // Re-export tenant client
213
+ export { ScellTenantClient };
214
+
175
215
  // Re-export types
176
216
  export type { ClientConfig } from './client.js';
177
217
  export type { RetryOptions } from './utils/retry.js';
File without changes
File without changes
File without changes
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Billing Resource
3
+ * @packageDocumentation
4
+ */
5
+
6
+ import type { HttpClient, RequestOptions } from '../client.js';
7
+ import type { MessageResponse, PaginatedResponse, SingleResponse } from '../types/common.js';
8
+ import type {
9
+ BillingInvoice,
10
+ BillingInvoiceListOptions,
11
+ BillingTopUpConfirmInput,
12
+ BillingTopUpInput,
13
+ BillingTransaction,
14
+ BillingTransactionListOptions,
15
+ BillingUsage,
16
+ BillingUsageOptions,
17
+ } from '../types/billing.js';
18
+
19
+ export class BillingResource {
20
+ constructor(private readonly http: HttpClient) {}
21
+
22
+ async invoices(options: BillingInvoiceListOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<BillingInvoice>> {
23
+ return this.http.get<PaginatedResponse<BillingInvoice>>('/tenant/billing/invoices', options as Record<string, string | number | boolean | undefined>, requestOptions);
24
+ }
25
+
26
+ async showInvoice(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<BillingInvoice>> {
27
+ return this.http.get<SingleResponse<BillingInvoice>>(`/tenant/billing/invoices/${invoiceId}`, undefined, requestOptions);
28
+ }
29
+
30
+ async downloadInvoice(invoiceId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer> {
31
+ return this.http.getRaw(`/tenant/billing/invoices/${invoiceId}/download`, undefined, requestOptions);
32
+ }
33
+
34
+ async usage(options: BillingUsageOptions = {}, requestOptions?: RequestOptions): Promise<SingleResponse<BillingUsage>> {
35
+ return this.http.get<SingleResponse<BillingUsage>>('/tenant/billing/usage', options as Record<string, string | number | boolean | undefined>, requestOptions);
36
+ }
37
+
38
+ async topUp(input: BillingTopUpInput, requestOptions?: RequestOptions): Promise<MessageResponse> {
39
+ return this.http.post<MessageResponse>('/tenant/billing/top-up', input, requestOptions);
40
+ }
41
+
42
+ async confirmTopUp(input: BillingTopUpConfirmInput, requestOptions?: RequestOptions): Promise<MessageResponse> {
43
+ return this.http.post<MessageResponse>('/tenant/billing/top-up/confirm', input, requestOptions);
44
+ }
45
+
46
+ async transactions(options: BillingTransactionListOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<BillingTransaction>> {
47
+ return this.http.get<PaginatedResponse<BillingTransaction>>('/tenant/billing/transactions', options as Record<string, string | number | boolean | undefined>, requestOptions);
48
+ }
49
+ }
File without changes
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Fiscal Compliance Resource
3
+ * @packageDocumentation
4
+ */
5
+
6
+ import type { HttpClient, RequestOptions } from '../client.js';
7
+ import type { MessageResponse, PaginatedResponse, SingleResponse } from '../types/common.js';
8
+ import type {
9
+ FiscalAnchor,
10
+ FiscalAnchorsOptions,
11
+ FiscalAttestation,
12
+ FiscalClosing,
13
+ FiscalClosingsOptions,
14
+ FiscalComplianceData,
15
+ FiscalCreateRuleInput,
16
+ FiscalDailyClosingInput,
17
+ FiscalEntriesOptions,
18
+ FiscalEntry,
19
+ FiscalExportRulesOptions,
20
+ FiscalFecExportOptions,
21
+ FiscalFecExportResult,
22
+ FiscalForensicExportOptions,
23
+ FiscalIntegrityHistoryOptions,
24
+ FiscalIntegrityOptions,
25
+ FiscalIntegrityReport,
26
+ FiscalKillSwitchActivateInput,
27
+ FiscalKillSwitchStatus,
28
+ FiscalReplayRulesInput,
29
+ FiscalRule,
30
+ FiscalRulesOptions,
31
+ FiscalUpdateRuleInput,
32
+ } from '../types/fiscal.js';
33
+
34
+ export class FiscalResource {
35
+ constructor(private readonly http: HttpClient) {}
36
+
37
+ async compliance(requestOptions?: RequestOptions): Promise<SingleResponse<FiscalComplianceData>> {
38
+ return this.http.get<SingleResponse<FiscalComplianceData>>('/tenant/fiscal/compliance', undefined, requestOptions);
39
+ }
40
+
41
+ async integrity(options: FiscalIntegrityOptions = {}, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalIntegrityReport>> {
42
+ return this.http.get<SingleResponse<FiscalIntegrityReport>>('/tenant/fiscal/integrity', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
43
+ }
44
+
45
+ async integrityHistory(options: FiscalIntegrityHistoryOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalIntegrityReport>> {
46
+ return this.http.get<PaginatedResponse<FiscalIntegrityReport>>('/tenant/fiscal/integrity/history', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
47
+ }
48
+
49
+ async integrityForDate(date: string, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalIntegrityReport>> {
50
+ return this.http.get<SingleResponse<FiscalIntegrityReport>>(`/tenant/fiscal/integrity/${date}`, undefined, requestOptions);
51
+ }
52
+
53
+ async closings(options: FiscalClosingsOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalClosing>> {
54
+ return this.http.get<PaginatedResponse<FiscalClosing>>('/tenant/fiscal/closings', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
55
+ }
56
+
57
+ async performDailyClosing(input: FiscalDailyClosingInput = {}, requestOptions?: RequestOptions): Promise<MessageResponse> {
58
+ return this.http.post<MessageResponse>('/tenant/fiscal/closings/daily', input, requestOptions);
59
+ }
60
+
61
+ async fecExport(options: FiscalFecExportOptions, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalFecExportResult>> {
62
+ return this.http.get<SingleResponse<FiscalFecExportResult>>('/tenant/fiscal/fec', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
63
+ }
64
+
65
+ async fecDownload(options: FiscalFecExportOptions, requestOptions?: RequestOptions): Promise<ArrayBuffer> {
66
+ return this.http.getRaw('/tenant/fiscal/fec', { ...options, download: true } as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
67
+ }
68
+
69
+ async attestation(year: number, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalAttestation>> {
70
+ return this.http.get<SingleResponse<FiscalAttestation>>(`/tenant/fiscal/attestation/${year}`, undefined, requestOptions);
71
+ }
72
+
73
+ async attestationDownload(year: number, requestOptions?: RequestOptions): Promise<ArrayBuffer> {
74
+ return this.http.getRaw(`/tenant/fiscal/attestation/${year}/download`, undefined, requestOptions);
75
+ }
76
+
77
+ async entries(options: FiscalEntriesOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalEntry>> {
78
+ return this.http.get<PaginatedResponse<FiscalEntry>>('/tenant/fiscal/entries', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
79
+ }
80
+
81
+ async killSwitchStatus(requestOptions?: RequestOptions): Promise<SingleResponse<FiscalKillSwitchStatus>> {
82
+ return this.http.get<SingleResponse<FiscalKillSwitchStatus>>('/tenant/fiscal/kill-switch/status', undefined, requestOptions);
83
+ }
84
+
85
+ async killSwitchActivate(input: FiscalKillSwitchActivateInput, requestOptions?: RequestOptions): Promise<MessageResponse> {
86
+ return this.http.post<MessageResponse>('/tenant/fiscal/kill-switch/activate', input, requestOptions);
87
+ }
88
+
89
+ async killSwitchDeactivate(requestOptions?: RequestOptions): Promise<MessageResponse> {
90
+ return this.http.post<MessageResponse>('/tenant/fiscal/kill-switch/deactivate', undefined, requestOptions);
91
+ }
92
+
93
+ async anchors(options: FiscalAnchorsOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalAnchor>> {
94
+ return this.http.get<PaginatedResponse<FiscalAnchor>>('/tenant/fiscal/anchors', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
95
+ }
96
+
97
+ async rules(options: FiscalRulesOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalRule>> {
98
+ return this.http.get<PaginatedResponse<FiscalRule>>('/tenant/fiscal/rules', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
99
+ }
100
+
101
+ async ruleDetail(key: string, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalRule>> {
102
+ return this.http.get<SingleResponse<FiscalRule>>(`/tenant/fiscal/rules/${key}`, undefined, requestOptions);
103
+ }
104
+
105
+ async ruleHistory(key: string, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalRule>> {
106
+ return this.http.get<PaginatedResponse<FiscalRule>>(`/tenant/fiscal/rules/${key}/history`, undefined, requestOptions);
107
+ }
108
+
109
+ async createRule(input: FiscalCreateRuleInput, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalRule>> {
110
+ return this.http.post<SingleResponse<FiscalRule>>('/tenant/fiscal/rules', input, requestOptions);
111
+ }
112
+
113
+ async updateRule(id: string, input: FiscalUpdateRuleInput, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalRule>> {
114
+ return this.http.post<SingleResponse<FiscalRule>>(`/tenant/fiscal/rules/${id}`, input, requestOptions);
115
+ }
116
+
117
+ async exportRules(options: FiscalExportRulesOptions, requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>>> {
118
+ return this.http.get<SingleResponse<Record<string, unknown>>>('/tenant/fiscal/rules/export', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
119
+ }
120
+
121
+ async replayRules(input: FiscalReplayRulesInput, requestOptions?: RequestOptions): Promise<MessageResponse> {
122
+ return this.http.post<MessageResponse>('/tenant/fiscal/rules/replay', input, requestOptions);
123
+ }
124
+
125
+ async forensicExport(options: FiscalForensicExportOptions, requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>>> {
126
+ return this.http.get<SingleResponse<Record<string, unknown>>>('/tenant/fiscal/forensic-export', options as unknown as Record<string, string | number | boolean | undefined>, requestOptions);
127
+ }
128
+ }
File without changes
@@ -11,6 +11,7 @@ import type {
11
11
  PaginatedResponse,
12
12
  SingleResponse,
13
13
  } from '../types/common.js';
14
+ import type { AuditTrailResponse } from '../types/invoices.js';
14
15
  import type {
15
16
  CreateSignatureInput,
16
17
  Signature,
@@ -242,4 +243,36 @@ export class SignaturesResource {
242
243
  requestOptions
243
244
  );
244
245
  }
246
+
247
+ /**
248
+ * Get signature audit trail (JSON)
249
+ *
250
+ * Returns the complete history of actions on the signature:
251
+ * creation, delivery, opening, signing, refusal, etc.
252
+ *
253
+ * @param id - Signature UUID
254
+ * @param requestOptions - Request options
255
+ * @returns Audit trail entries with integrity validation
256
+ *
257
+ * @example
258
+ * ```typescript
259
+ * const { data: entries, integrity_valid } = await client.signatures.auditTrail(
260
+ * 'signature-uuid'
261
+ * );
262
+ *
263
+ * if (integrity_valid) {
264
+ * entries.forEach(e => console.log(e.action, e.created_at));
265
+ * }
266
+ * ```
267
+ */
268
+ async auditTrail(
269
+ id: string,
270
+ requestOptions?: RequestOptions
271
+ ): Promise<AuditTrailResponse> {
272
+ return this.http.get<AuditTrailResponse>(
273
+ `/signatures/${id}/audit-trail`,
274
+ undefined,
275
+ requestOptions
276
+ );
277
+ }
245
278
  }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Stats Resource
3
+ * @packageDocumentation
4
+ */
5
+
6
+ import type { HttpClient, RequestOptions } from '../client.js';
7
+ import type { SingleResponse } from '../types/common.js';
8
+ import type {
9
+ StatsMonthly,
10
+ StatsMonthlyOptions,
11
+ StatsOverview,
12
+ StatsOverviewOptions,
13
+ } from '../types/stats.js';
14
+
15
+ export class StatsResource {
16
+ constructor(private readonly http: HttpClient) {}
17
+
18
+ async overview(options: StatsOverviewOptions = {}, requestOptions?: RequestOptions): Promise<SingleResponse<StatsOverview>> {
19
+ return this.http.get<SingleResponse<StatsOverview>>('/tenant/stats/overview', options as Record<string, string | number | boolean | undefined>, requestOptions);
20
+ }
21
+
22
+ async monthly(options: StatsMonthlyOptions = {}, requestOptions?: RequestOptions): Promise<SingleResponse<StatsMonthly[]>> {
23
+ return this.http.get<SingleResponse<StatsMonthly[]>>('/tenant/stats/monthly', options as Record<string, string | number | boolean | undefined>, requestOptions);
24
+ }
25
+
26
+ async subTenantOverview(subTenantId: string, options: StatsOverviewOptions = {}, requestOptions?: RequestOptions): Promise<SingleResponse<StatsOverview>> {
27
+ return this.http.get<SingleResponse<StatsOverview>>(`/tenant/sub-tenants/${subTenantId}/stats/overview`, options as Record<string, string | number | boolean | undefined>, requestOptions);
28
+ }
29
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Sub-Tenants Resource
3
+ * @packageDocumentation
4
+ */
5
+
6
+ import type { HttpClient, RequestOptions } from '../client.js';
7
+ import type { MessageResponse, PaginatedResponse, SingleResponse } from '../types/common.js';
8
+ import type {
9
+ CreateSubTenantInput,
10
+ SubTenant,
11
+ SubTenantListOptions,
12
+ UpdateSubTenantInput,
13
+ } from '../types/sub-tenants.js';
14
+
15
+ export class SubTenantsResource {
16
+ constructor(private readonly http: HttpClient) {}
17
+
18
+ async list(options: SubTenantListOptions = {}, requestOptions?: RequestOptions): Promise<PaginatedResponse<SubTenant>> {
19
+ return this.http.get<PaginatedResponse<SubTenant>>('/tenant/sub-tenants', options as Record<string, string | number | boolean | undefined>, requestOptions);
20
+ }
21
+
22
+ async create(input: CreateSubTenantInput, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>> {
23
+ return this.http.post<SingleResponse<SubTenant>>('/tenant/sub-tenants', input, requestOptions);
24
+ }
25
+
26
+ async get(id: string, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>> {
27
+ return this.http.get<SingleResponse<SubTenant>>(`/tenant/sub-tenants/${id}`, undefined, requestOptions);
28
+ }
29
+
30
+ async update(id: string, input: UpdateSubTenantInput, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>> {
31
+ return this.http.patch<SingleResponse<SubTenant>>(`/tenant/sub-tenants/${id}`, input, requestOptions);
32
+ }
33
+
34
+ async delete(id: string, requestOptions?: RequestOptions): Promise<MessageResponse> {
35
+ return this.http.delete<MessageResponse>(`/tenant/sub-tenants/${id}`, requestOptions);
36
+ }
37
+
38
+ async findByExternalId(externalId: string, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>> {
39
+ return this.http.get<SingleResponse<SubTenant>>(`/tenant/sub-tenants/by-external-id/${externalId}`, undefined, requestOptions);
40
+ }
41
+ }