@brifle/brifle-sdk 0.0.4 → 0.0.5

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.
@@ -2,6 +2,8 @@ import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
2
  import { ContentEndpoints } from "../endpoints/v1/content";
3
3
  import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
4
  import { MailboxEndpoints } from "../endpoints/v1/mailbox";
5
+ import { TenantsEndpoints } from "../endpoints/v1/tenant";
6
+ import { AccountsEndpoints } from "../endpoints/v1/accounts";
5
7
  declare class ApiV1 {
6
8
  readonly endpoint: string;
7
9
  readonly apiState: ApiV1State;
@@ -23,6 +25,16 @@ declare class ApiV1 {
23
25
  * @returns ContentEndpoints
24
26
  */
25
27
  signature(): SignaturesEndpoint;
28
+ /**
29
+ * gets an instance of the TenantsEndpoints
30
+ * @returns TenantsEndpoints
31
+ */
32
+ tenants(): TenantsEndpoints;
33
+ /**
34
+ * gets an instance of the AccountsEndpoints
35
+ * @returns AccountsEndpoints
36
+ */
37
+ accounts(): AccountsEndpoints;
26
38
  /**
27
39
  * gets an instance of the MailboxEndpoints
28
40
  * @returns MailboxEndpoints
@@ -0,0 +1,15 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { AccountInfo } from "./responses/accounts";
3
+ import { ApiResponse } from "./apiResponse";
4
+ declare class AccountsEndpoints {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ * Gets a tenant by its ID
12
+ */
13
+ getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
14
+ }
15
+ export { AccountsEndpoints };
@@ -0,0 +1,8 @@
1
+ interface AccountInfo {
2
+ company_name: string;
3
+ first_name: string;
4
+ last_name: string;
5
+ middle_name: string;
6
+ type: 'private' | 'business';
7
+ }
8
+ export type { AccountInfo };
@@ -0,0 +1,12 @@
1
+ interface Tenant {
2
+ account_id: string;
3
+ name: string;
4
+ image?: string;
5
+ private: boolean;
6
+ id: string;
7
+ }
8
+ interface TenantsResponse {
9
+ total: number;
10
+ tenants: Tenant[];
11
+ }
12
+ export type { Tenant, TenantsResponse };
@@ -0,0 +1,19 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { Tenant, TenantsResponse } from "./responses/tenant";
3
+ import { ApiResponse } from "./apiResponse";
4
+ declare class TenantsEndpoints {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ * Gets a tenant by its ID
12
+ */
13
+ getById(tenantId: string): Promise<ApiResponse<Tenant>>;
14
+ /**
15
+ * Gets all tenants owned by the account id
16
+ */
17
+ getMy(): Promise<ApiResponse<TenantsResponse>>;
18
+ }
19
+ export { TenantsEndpoints };
@@ -12,3 +12,7 @@ export * from "./endpoints/v1/signatures";
12
12
  export * from "./endpoints/v1/mailbox";
13
13
  export * from "./endpoints/v1/requests/mailbox";
14
14
  export * from "./endpoints/v1/responses/mailbox";
15
+ export * from "./endpoints/v1/tenant";
16
+ export * from "./endpoints/v1/responses/tenant";
17
+ export * from "./endpoints/v1/accounts";
18
+ export * from "./endpoints/v1/responses/accounts";
package/dist/cjs/index.js CHANGED
@@ -307,6 +307,83 @@ class MailboxEndpoints {
307
307
  }
308
308
  }
309
309
 
310
+ class TenantsEndpoints {
311
+ constructor(api) {
312
+ this.VERSION = "v1";
313
+ this.endpoint = api.endpoint;
314
+ this.state = api.apiState;
315
+ }
316
+ getPath(path) {
317
+ return `${this.endpoint}/${this.VERSION}/tenants/${path}`;
318
+ }
319
+ /**
320
+ * Gets a tenant by its ID
321
+ */
322
+ getById(tenantId) {
323
+ const path = this.getPath(`id/${tenantId}`);
324
+ return axios.get(path, {
325
+ headers: {
326
+ "Authorization": `Bearer ${this.state.auth_token}`,
327
+ "Content-Type": "application/json"
328
+ }
329
+ })
330
+ .then((response) => {
331
+ return ApiResponse.success(response.data);
332
+ })
333
+ .catch((error) => {
334
+ return ApiResponse.errorAxios(error);
335
+ });
336
+ }
337
+ /**
338
+ * Gets all tenants owned by the account id
339
+ */
340
+ getMy() {
341
+ const path = this.getPath(`my`);
342
+ return axios.get(path, {
343
+ headers: {
344
+ "Authorization": `Bearer ${this.state.auth_token}`,
345
+ "Content-Type": "application/json"
346
+ }
347
+ })
348
+ .then((response) => {
349
+ return ApiResponse.success(response.data);
350
+ })
351
+ .catch((error) => {
352
+ return ApiResponse.errorAxios(error);
353
+ });
354
+ }
355
+ }
356
+
357
+ class AccountsEndpoints {
358
+ constructor(api) {
359
+ this.VERSION = "v1";
360
+ this.endpoint = api.endpoint;
361
+ this.state = api.apiState;
362
+ }
363
+ getPath(path) {
364
+ return `${this.endpoint}/${this.VERSION}/accounts/${path}`;
365
+ }
366
+ /**
367
+ * Gets a tenant by its ID
368
+ */
369
+ getById(accountId) {
370
+ const path = this.getPath(`${accountId}`);
371
+ console.log(path, path);
372
+ return axios.get(path, {
373
+ headers: {
374
+ "Authorization": `Bearer ${this.state.auth_token}`,
375
+ "Content-Type": "application/json"
376
+ }
377
+ })
378
+ .then((response) => {
379
+ return ApiResponse.success(response.data);
380
+ })
381
+ .catch((error) => {
382
+ return ApiResponse.errorAxios(error);
383
+ });
384
+ }
385
+ }
386
+
310
387
  var ENDPOINTS;
311
388
  (function (ENDPOINTS) {
312
389
  ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
@@ -349,6 +426,20 @@ class ApiV1 {
349
426
  signature() {
350
427
  return new SignaturesEndpoint(this);
351
428
  }
429
+ /**
430
+ * gets an instance of the TenantsEndpoints
431
+ * @returns TenantsEndpoints
432
+ */
433
+ tenants() {
434
+ return new TenantsEndpoints(this);
435
+ }
436
+ /**
437
+ * gets an instance of the AccountsEndpoints
438
+ * @returns AccountsEndpoints
439
+ */
440
+ accounts() {
441
+ return new AccountsEndpoints(this);
442
+ }
352
443
  /**
353
444
  * gets an instance of the MailboxEndpoints
354
445
  * @returns MailboxEndpoints
@@ -358,10 +449,12 @@ class ApiV1 {
358
449
  }
359
450
  }
360
451
 
452
+ exports.AccountsEndpoints = AccountsEndpoints;
361
453
  exports.ApiResponse = ApiResponse;
362
454
  exports.ApiV1 = ApiV1;
363
455
  exports.AuthenticationEndpoints = AuthenticationEndpoints;
364
456
  exports.ContentEndpoints = ContentEndpoints;
365
457
  exports.MailboxEndpoints = MailboxEndpoints;
366
458
  exports.SignaturesEndpoint = SignaturesEndpoint;
459
+ exports.TenantsEndpoints = TenantsEndpoints;
367
460
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,6 +2,8 @@ import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
2
  import { ContentEndpoints } from "../endpoints/v1/content";
3
3
  import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
4
  import { MailboxEndpoints } from "../endpoints/v1/mailbox";
5
+ import { TenantsEndpoints } from "../endpoints/v1/tenant";
6
+ import { AccountsEndpoints } from "../endpoints/v1/accounts";
5
7
  declare class ApiV1 {
6
8
  readonly endpoint: string;
7
9
  readonly apiState: ApiV1State;
@@ -23,6 +25,16 @@ declare class ApiV1 {
23
25
  * @returns ContentEndpoints
24
26
  */
25
27
  signature(): SignaturesEndpoint;
28
+ /**
29
+ * gets an instance of the TenantsEndpoints
30
+ * @returns TenantsEndpoints
31
+ */
32
+ tenants(): TenantsEndpoints;
33
+ /**
34
+ * gets an instance of the AccountsEndpoints
35
+ * @returns AccountsEndpoints
36
+ */
37
+ accounts(): AccountsEndpoints;
26
38
  /**
27
39
  * gets an instance of the MailboxEndpoints
28
40
  * @returns MailboxEndpoints
@@ -0,0 +1,15 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { AccountInfo } from "./responses/accounts";
3
+ import { ApiResponse } from "./apiResponse";
4
+ declare class AccountsEndpoints {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ * Gets a tenant by its ID
12
+ */
13
+ getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
14
+ }
15
+ export { AccountsEndpoints };
@@ -0,0 +1,8 @@
1
+ interface AccountInfo {
2
+ company_name: string;
3
+ first_name: string;
4
+ last_name: string;
5
+ middle_name: string;
6
+ type: 'private' | 'business';
7
+ }
8
+ export type { AccountInfo };
@@ -0,0 +1,12 @@
1
+ interface Tenant {
2
+ account_id: string;
3
+ name: string;
4
+ image?: string;
5
+ private: boolean;
6
+ id: string;
7
+ }
8
+ interface TenantsResponse {
9
+ total: number;
10
+ tenants: Tenant[];
11
+ }
12
+ export type { Tenant, TenantsResponse };
@@ -0,0 +1,19 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { Tenant, TenantsResponse } from "./responses/tenant";
3
+ import { ApiResponse } from "./apiResponse";
4
+ declare class TenantsEndpoints {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ * Gets a tenant by its ID
12
+ */
13
+ getById(tenantId: string): Promise<ApiResponse<Tenant>>;
14
+ /**
15
+ * Gets all tenants owned by the account id
16
+ */
17
+ getMy(): Promise<ApiResponse<TenantsResponse>>;
18
+ }
19
+ export { TenantsEndpoints };
@@ -12,3 +12,7 @@ export * from "./endpoints/v1/signatures";
12
12
  export * from "./endpoints/v1/mailbox";
13
13
  export * from "./endpoints/v1/requests/mailbox";
14
14
  export * from "./endpoints/v1/responses/mailbox";
15
+ export * from "./endpoints/v1/tenant";
16
+ export * from "./endpoints/v1/responses/tenant";
17
+ export * from "./endpoints/v1/accounts";
18
+ export * from "./endpoints/v1/responses/accounts";
@@ -305,6 +305,83 @@ class MailboxEndpoints {
305
305
  }
306
306
  }
307
307
 
308
+ class TenantsEndpoints {
309
+ constructor(api) {
310
+ this.VERSION = "v1";
311
+ this.endpoint = api.endpoint;
312
+ this.state = api.apiState;
313
+ }
314
+ getPath(path) {
315
+ return `${this.endpoint}/${this.VERSION}/tenants/${path}`;
316
+ }
317
+ /**
318
+ * Gets a tenant by its ID
319
+ */
320
+ getById(tenantId) {
321
+ const path = this.getPath(`id/${tenantId}`);
322
+ return axios.get(path, {
323
+ headers: {
324
+ "Authorization": `Bearer ${this.state.auth_token}`,
325
+ "Content-Type": "application/json"
326
+ }
327
+ })
328
+ .then((response) => {
329
+ return ApiResponse.success(response.data);
330
+ })
331
+ .catch((error) => {
332
+ return ApiResponse.errorAxios(error);
333
+ });
334
+ }
335
+ /**
336
+ * Gets all tenants owned by the account id
337
+ */
338
+ getMy() {
339
+ const path = this.getPath(`my`);
340
+ return axios.get(path, {
341
+ headers: {
342
+ "Authorization": `Bearer ${this.state.auth_token}`,
343
+ "Content-Type": "application/json"
344
+ }
345
+ })
346
+ .then((response) => {
347
+ return ApiResponse.success(response.data);
348
+ })
349
+ .catch((error) => {
350
+ return ApiResponse.errorAxios(error);
351
+ });
352
+ }
353
+ }
354
+
355
+ class AccountsEndpoints {
356
+ constructor(api) {
357
+ this.VERSION = "v1";
358
+ this.endpoint = api.endpoint;
359
+ this.state = api.apiState;
360
+ }
361
+ getPath(path) {
362
+ return `${this.endpoint}/${this.VERSION}/accounts/${path}`;
363
+ }
364
+ /**
365
+ * Gets a tenant by its ID
366
+ */
367
+ getById(accountId) {
368
+ const path = this.getPath(`${accountId}`);
369
+ console.log(path, path);
370
+ return axios.get(path, {
371
+ headers: {
372
+ "Authorization": `Bearer ${this.state.auth_token}`,
373
+ "Content-Type": "application/json"
374
+ }
375
+ })
376
+ .then((response) => {
377
+ return ApiResponse.success(response.data);
378
+ })
379
+ .catch((error) => {
380
+ return ApiResponse.errorAxios(error);
381
+ });
382
+ }
383
+ }
384
+
308
385
  var ENDPOINTS;
309
386
  (function (ENDPOINTS) {
310
387
  ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
@@ -347,6 +424,20 @@ class ApiV1 {
347
424
  signature() {
348
425
  return new SignaturesEndpoint(this);
349
426
  }
427
+ /**
428
+ * gets an instance of the TenantsEndpoints
429
+ * @returns TenantsEndpoints
430
+ */
431
+ tenants() {
432
+ return new TenantsEndpoints(this);
433
+ }
434
+ /**
435
+ * gets an instance of the AccountsEndpoints
436
+ * @returns AccountsEndpoints
437
+ */
438
+ accounts() {
439
+ return new AccountsEndpoints(this);
440
+ }
350
441
  /**
351
442
  * gets an instance of the MailboxEndpoints
352
443
  * @returns MailboxEndpoints
@@ -356,5 +447,5 @@ class ApiV1 {
356
447
  }
357
448
  }
358
449
 
359
- export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint };
450
+ export { AccountsEndpoints, ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint, TenantsEndpoints };
360
451
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -323,6 +323,54 @@ declare class MailboxEndpoints {
323
323
  getOutbox(tenant: string, filter: OutboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
324
324
  }
325
325
 
326
+ interface Tenant {
327
+ account_id: string;
328
+ name: string;
329
+ image?: string;
330
+ private: boolean;
331
+ id: string;
332
+ }
333
+ interface TenantsResponse {
334
+ total: number;
335
+ tenants: Tenant[];
336
+ }
337
+
338
+ declare class TenantsEndpoints {
339
+ private endpoint;
340
+ private readonly VERSION;
341
+ private state;
342
+ constructor(api: ApiV1);
343
+ private getPath;
344
+ /**
345
+ * Gets a tenant by its ID
346
+ */
347
+ getById(tenantId: string): Promise<ApiResponse<Tenant>>;
348
+ /**
349
+ * Gets all tenants owned by the account id
350
+ */
351
+ getMy(): Promise<ApiResponse<TenantsResponse>>;
352
+ }
353
+
354
+ interface AccountInfo {
355
+ company_name: string;
356
+ first_name: string;
357
+ last_name: string;
358
+ middle_name: string;
359
+ type: 'private' | 'business';
360
+ }
361
+
362
+ declare class AccountsEndpoints {
363
+ private endpoint;
364
+ private readonly VERSION;
365
+ private state;
366
+ constructor(api: ApiV1);
367
+ private getPath;
368
+ /**
369
+ * Gets a tenant by its ID
370
+ */
371
+ getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
372
+ }
373
+
326
374
  declare class ApiV1 {
327
375
  readonly endpoint: string;
328
376
  readonly apiState: ApiV1State;
@@ -344,6 +392,16 @@ declare class ApiV1 {
344
392
  * @returns ContentEndpoints
345
393
  */
346
394
  signature(): SignaturesEndpoint;
395
+ /**
396
+ * gets an instance of the TenantsEndpoints
397
+ * @returns TenantsEndpoints
398
+ */
399
+ tenants(): TenantsEndpoints;
400
+ /**
401
+ * gets an instance of the AccountsEndpoints
402
+ * @returns AccountsEndpoints
403
+ */
404
+ accounts(): AccountsEndpoints;
347
405
  /**
348
406
  * gets an instance of the MailboxEndpoints
349
407
  * @returns MailboxEndpoints
@@ -355,5 +413,5 @@ interface ApiV1State {
355
413
  auth_token_expire_date?: Date;
356
414
  }
357
415
 
358
- export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint };
359
- export type { ApiV1State, BirthInformation, CheckReceiverResponse, ContentActionsResponse, ContentMeta, ContentResponse, CreateSignatureReferenceRequest, CreateSignatureReferenceResponse, ErrorResponse, InboxFilter, LoginRequest, LoginResponse, LogoutRequest, MailboxResponse, Meta, OutboxFilter, PaymentDetails, ReceiverRequest, SendContentRequest, SendContentResponse };
416
+ export { AccountsEndpoints, ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint, TenantsEndpoints };
417
+ export type { AccountInfo, ApiV1State, BirthInformation, CheckReceiverResponse, ContentActionsResponse, ContentMeta, ContentResponse, CreateSignatureReferenceRequest, CreateSignatureReferenceResponse, ErrorResponse, InboxFilter, LoginRequest, LoginResponse, LogoutRequest, MailboxResponse, Meta, OutboxFilter, PaymentDetails, ReceiverRequest, SendContentRequest, SendContentResponse, Tenant, TenantsResponse };
@@ -2,6 +2,8 @@ import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
2
  import { ContentEndpoints } from "../endpoints/v1/content";
3
3
  import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
4
  import { MailboxEndpoints } from "../endpoints/v1/mailbox";
5
+ import { TenantsEndpoints } from "../endpoints/v1/tenant";
6
+ import { AccountsEndpoints } from "../endpoints/v1/accounts";
5
7
  declare class ApiV1 {
6
8
  readonly endpoint: string;
7
9
  readonly apiState: ApiV1State;
@@ -23,6 +25,16 @@ declare class ApiV1 {
23
25
  * @returns ContentEndpoints
24
26
  */
25
27
  signature(): SignaturesEndpoint;
28
+ /**
29
+ * gets an instance of the TenantsEndpoints
30
+ * @returns TenantsEndpoints
31
+ */
32
+ tenants(): TenantsEndpoints;
33
+ /**
34
+ * gets an instance of the AccountsEndpoints
35
+ * @returns AccountsEndpoints
36
+ */
37
+ accounts(): AccountsEndpoints;
26
38
  /**
27
39
  * gets an instance of the MailboxEndpoints
28
40
  * @returns MailboxEndpoints
@@ -0,0 +1,15 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { AccountInfo } from "./responses/accounts";
3
+ import { ApiResponse } from "./apiResponse";
4
+ declare class AccountsEndpoints {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ * Gets a tenant by its ID
12
+ */
13
+ getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
14
+ }
15
+ export { AccountsEndpoints };
@@ -0,0 +1,8 @@
1
+ interface AccountInfo {
2
+ company_name: string;
3
+ first_name: string;
4
+ last_name: string;
5
+ middle_name: string;
6
+ type: 'private' | 'business';
7
+ }
8
+ export type { AccountInfo };
@@ -0,0 +1,12 @@
1
+ interface Tenant {
2
+ account_id: string;
3
+ name: string;
4
+ image?: string;
5
+ private: boolean;
6
+ id: string;
7
+ }
8
+ interface TenantsResponse {
9
+ total: number;
10
+ tenants: Tenant[];
11
+ }
12
+ export type { Tenant, TenantsResponse };
@@ -0,0 +1,19 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { Tenant, TenantsResponse } from "./responses/tenant";
3
+ import { ApiResponse } from "./apiResponse";
4
+ declare class TenantsEndpoints {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ * Gets a tenant by its ID
12
+ */
13
+ getById(tenantId: string): Promise<ApiResponse<Tenant>>;
14
+ /**
15
+ * Gets all tenants owned by the account id
16
+ */
17
+ getMy(): Promise<ApiResponse<TenantsResponse>>;
18
+ }
19
+ export { TenantsEndpoints };
@@ -12,3 +12,7 @@ export * from "./endpoints/v1/signatures";
12
12
  export * from "./endpoints/v1/mailbox";
13
13
  export * from "./endpoints/v1/requests/mailbox";
14
14
  export * from "./endpoints/v1/responses/mailbox";
15
+ export * from "./endpoints/v1/tenant";
16
+ export * from "./endpoints/v1/responses/tenant";
17
+ export * from "./endpoints/v1/accounts";
18
+ export * from "./endpoints/v1/responses/accounts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brifle/brifle-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "The JavaScript SDK to interact with the API of Brifle",
5
5
  "files": [
6
6
  "dist",