@brifle/brifle-sdk 0.0.5 → 0.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 (45) hide show
  1. package/dist/api/api.js +79 -0
  2. package/dist/cjs/api/api.d.ts +6 -0
  3. package/dist/cjs/endpoints/v1/requests/content.d.ts +19 -1
  4. package/dist/cjs/endpoints/v1/requests/mailbox.d.ts +2 -0
  5. package/dist/cjs/endpoints/v1/responses/content.d.ts +27 -22
  6. package/dist/cjs/endpoints/v1/responses/status.d.ts +8 -0
  7. package/dist/cjs/endpoints/v1/status.d.ts +16 -0
  8. package/dist/cjs/index.js +32 -0
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/endpoints/v1/accounts.js +32 -0
  11. package/dist/endpoints/v1/apiResponse.js +64 -0
  12. package/dist/endpoints/v1/authentication.js +43 -0
  13. package/dist/endpoints/v1/content.js +95 -0
  14. package/dist/endpoints/v1/mailbox.js +55 -0
  15. package/dist/endpoints/v1/requests/authentication.js +1 -0
  16. package/dist/endpoints/v1/requests/content.js +1 -0
  17. package/dist/endpoints/v1/requests/mailbox.js +1 -0
  18. package/dist/endpoints/v1/requests/signatures.js +1 -0
  19. package/dist/endpoints/v1/responses/accounts.js +1 -0
  20. package/dist/endpoints/v1/responses/authentication.js +1 -0
  21. package/dist/endpoints/v1/responses/content.js +1 -0
  22. package/dist/endpoints/v1/responses/mailbox.js +1 -0
  23. package/dist/endpoints/v1/responses/signatures.js +1 -0
  24. package/dist/endpoints/v1/responses/status.js +1 -0
  25. package/dist/endpoints/v1/responses/tenant.js +1 -0
  26. package/dist/endpoints/v1/signatures.js +55 -0
  27. package/dist/endpoints/v1/status.js +27 -0
  28. package/dist/endpoints/v1/tenant.js +49 -0
  29. package/dist/esm/api/api.d.ts +6 -0
  30. package/dist/esm/endpoints/v1/requests/content.d.ts +19 -1
  31. package/dist/esm/endpoints/v1/requests/mailbox.d.ts +2 -0
  32. package/dist/esm/endpoints/v1/responses/content.d.ts +27 -22
  33. package/dist/esm/endpoints/v1/responses/status.d.ts +8 -0
  34. package/dist/esm/endpoints/v1/status.d.ts +16 -0
  35. package/dist/esm/index.mjs +32 -0
  36. package/dist/esm/index.mjs.map +1 -1
  37. package/dist/index.d.ts +73 -22
  38. package/dist/index.js +18 -0
  39. package/dist/types/api/api.d.ts +6 -0
  40. package/dist/types/endpoints/v1/requests/content.d.ts +19 -1
  41. package/dist/types/endpoints/v1/requests/mailbox.d.ts +2 -0
  42. package/dist/types/endpoints/v1/responses/content.d.ts +27 -22
  43. package/dist/types/endpoints/v1/responses/status.d.ts +8 -0
  44. package/dist/types/endpoints/v1/status.d.ts +16 -0
  45. package/package.json +2 -1
@@ -0,0 +1,79 @@
1
+ import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
+ import { ContentEndpoints } from "../endpoints/v1/content";
3
+ import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
+ import { MailboxEndpoints } from "../endpoints/v1/mailbox";
5
+ import { TenantsEndpoints } from "../endpoints/v1/tenant";
6
+ import { AccountsEndpoints } from "../endpoints/v1/accounts";
7
+ import { StatusEndpoint } from "../endpoints/v1/status";
8
+ var ENDPOINTS;
9
+ (function (ENDPOINTS) {
10
+ ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
11
+ ENDPOINTS["PRODUCTION"] = "https://api.brifle.de";
12
+ })(ENDPOINTS || (ENDPOINTS = {}));
13
+ class ApiV1 {
14
+ constructor(endpoint) {
15
+ if (endpoint.endsWith("/")) {
16
+ this.endpoint = endpoint.slice(0, -1);
17
+ }
18
+ else {
19
+ this.endpoint = endpoint;
20
+ }
21
+ this.apiState = {};
22
+ }
23
+ static get sandbox() {
24
+ return new ApiV1(ENDPOINTS.SANDBOX);
25
+ }
26
+ static get production() {
27
+ return new ApiV1(ENDPOINTS.PRODUCTION);
28
+ }
29
+ /**
30
+ * gets an instance of the AuthenticationEndpoints
31
+ * @returns AuthenticationEndpoints
32
+ */
33
+ authentication() {
34
+ return new AuthenticationEndpoints(this);
35
+ }
36
+ /**
37
+ * gets an instance of the ContentEndpoints
38
+ * @returns ContentEndpoints
39
+ */
40
+ content() {
41
+ return new ContentEndpoints(this);
42
+ }
43
+ /**
44
+ * gets an instance of the SignatureEndpoints
45
+ * @returns ContentEndpoints
46
+ */
47
+ signature() {
48
+ return new SignaturesEndpoint(this);
49
+ }
50
+ /**
51
+ * gets an instance of the TenantsEndpoints
52
+ * @returns TenantsEndpoints
53
+ */
54
+ tenants() {
55
+ return new TenantsEndpoints(this);
56
+ }
57
+ /**
58
+ * gets an instance of the AccountsEndpoints
59
+ * @returns AccountsEndpoints
60
+ */
61
+ accounts() {
62
+ return new AccountsEndpoints(this);
63
+ }
64
+ /**
65
+ * gets an instance of the MailboxEndpoints
66
+ * @returns MailboxEndpoints
67
+ */
68
+ mailbox() {
69
+ return new MailboxEndpoints(this);
70
+ }
71
+ /**
72
+ * gets an instance of the StatusEndpoint
73
+ * @returns StatusEndpoint
74
+ */
75
+ status() {
76
+ return new StatusEndpoint(this);
77
+ }
78
+ }
79
+ export { ApiV1 };
@@ -4,6 +4,7 @@ import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
4
  import { MailboxEndpoints } from "../endpoints/v1/mailbox";
5
5
  import { TenantsEndpoints } from "../endpoints/v1/tenant";
6
6
  import { AccountsEndpoints } from "../endpoints/v1/accounts";
7
+ import { StatusEndpoint } from "../endpoints/v1/status";
7
8
  declare class ApiV1 {
8
9
  readonly endpoint: string;
9
10
  readonly apiState: ApiV1State;
@@ -40,6 +41,11 @@ declare class ApiV1 {
40
41
  * @returns MailboxEndpoints
41
42
  */
42
43
  mailbox(): MailboxEndpoints;
44
+ /**
45
+ * gets an instance of the StatusEndpoint
46
+ * @returns StatusEndpoint
47
+ */
48
+ status(): StatusEndpoint;
43
49
  }
44
50
  export interface ApiV1State {
45
51
  auth_token?: string;
@@ -35,6 +35,7 @@ interface SendContentRequest {
35
35
  type: 'application/pdf';
36
36
  content: string;
37
37
  }[];
38
+ fallback?: FallbackOptions;
38
39
  payment_info?: {
39
40
  details?: PaymentDetails;
40
41
  payable: boolean;
@@ -47,4 +48,21 @@ interface SendContentRequest {
47
48
  }[];
48
49
  };
49
50
  }
50
- export type { SendContentRequest, ReceiverRequest, BirthInformation, PaymentDetails };
51
+ interface FallbackOptions {
52
+ enabled_physical_delivery: boolean;
53
+ paper_mail: {
54
+ recipient: {
55
+ address_line1: string;
56
+ address_line2?: string;
57
+ address_line3?: string;
58
+ postal_code: string;
59
+ city: string;
60
+ country: string;
61
+ };
62
+ test_mode: {
63
+ email: string;
64
+ enabled: boolean;
65
+ };
66
+ };
67
+ }
68
+ export type { SendContentRequest, ReceiverRequest, BirthInformation, PaymentDetails, FallbackOptions };
@@ -6,5 +6,7 @@ interface InboxFilter {
6
6
  }
7
7
  interface OutboxFilter {
8
8
  state?: Array<'active' | 'trashed'>;
9
+ subject?: string;
10
+ type?: 'letter' | 'invoice' | 'contract';
9
11
  }
10
12
  export type { InboxFilter, OutboxFilter };
@@ -19,14 +19,16 @@ interface ContentMeta {
19
19
  size: number;
20
20
  subject: string;
21
21
  type: string;
22
+ size_responsive?: number;
22
23
  }
23
24
  interface ContentResponse {
24
- content: {
25
- content: string;
26
- type: string;
27
- };
25
+ content: Content[];
28
26
  meta: ContentMeta;
29
27
  }
28
+ interface Content {
29
+ content: string;
30
+ type: string;
31
+ }
30
32
  interface ContentActionsPaymentResponse {
31
33
  details: {
32
34
  amount: number;
@@ -39,30 +41,33 @@ interface ContentActionsPaymentResponse {
39
41
  };
40
42
  link: string;
41
43
  }
44
+ interface EmbbededSignatureResponse {
45
+ id: string;
46
+ created_by: string;
47
+ created_date: string;
48
+ document_signature_id: string;
49
+ due_date: string;
50
+ field_name: string;
51
+ history?: string;
52
+ purpose: string;
53
+ request_date: string;
54
+ requested_to: string;
55
+ signature_date: string;
56
+ signed_by: string;
57
+ signed_for: string;
58
+ value: string;
59
+ status: 'pending' | 'signed' | 'rejected';
60
+ }
42
61
  interface ContentActionsSignatureResponse {
43
62
  document_signatures: {
44
63
  signature_ids: string[];
45
64
  signature_reference: string;
46
65
  };
47
- embedded_signatures: {
48
- created_by: string;
49
- created_date: string;
50
- document_signature_id: string;
51
- due_date: string;
52
- field_name: string;
53
- history?: string;
54
- purpose: string;
55
- request_date: string;
56
- requested_to: string;
57
- signature_date: string;
58
- signed_by: string;
59
- signed_for: string;
60
- value: string;
61
- }[];
66
+ embedded_signatures: EmbbededSignatureResponse[];
62
67
  signature_reference: string;
63
68
  }
64
69
  interface ContentActionsResponse {
65
- payments: ContentActionsPaymentResponse[];
66
- signatures: ContentActionsSignatureResponse[];
70
+ payments: ContentActionsPaymentResponse;
71
+ signatures: ContentActionsSignatureResponse;
67
72
  }
68
- export type { SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
73
+ export type { EmbbededSignatureResponse, Content, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
@@ -0,0 +1,8 @@
1
+ interface StatusResponse {
2
+ status: string;
3
+ timestamp: string;
4
+ version: string;
5
+ service: string;
6
+ features: string[];
7
+ }
8
+ export type { StatusResponse };
@@ -0,0 +1,16 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { ApiResponse } from "./apiResponse";
3
+ import { StatusResponse } from "./responses/status";
4
+ declare class StatusEndpoint {
5
+ private endpoint;
6
+ private readonly VERSION;
7
+ private state;
8
+ constructor(api: ApiV1);
9
+ private getPath;
10
+ /**
11
+ *
12
+ * @returns the
13
+ */
14
+ getStatus(): Promise<ApiResponse<StatusResponse>>;
15
+ }
16
+ export { StatusEndpoint };
package/dist/cjs/index.js CHANGED
@@ -384,6 +384,31 @@ class AccountsEndpoints {
384
384
  }
385
385
  }
386
386
 
387
+ class StatusEndpoint {
388
+ constructor(api) {
389
+ this.VERSION = "v1";
390
+ this.endpoint = api.endpoint;
391
+ this.state = api.apiState;
392
+ }
393
+ getPath(path) {
394
+ return `${this.endpoint}/${this.VERSION}/status/${path}`;
395
+ }
396
+ /**
397
+ *
398
+ * @returns the
399
+ */
400
+ getStatus() {
401
+ const path = this.getPath("");
402
+ return axios.get(path)
403
+ .then((response) => {
404
+ return ApiResponse.success(response.data);
405
+ })
406
+ .catch((error) => {
407
+ return ApiResponse.errorAxios(error);
408
+ });
409
+ }
410
+ }
411
+
387
412
  var ENDPOINTS;
388
413
  (function (ENDPOINTS) {
389
414
  ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
@@ -447,6 +472,13 @@ class ApiV1 {
447
472
  mailbox() {
448
473
  return new MailboxEndpoints(this);
449
474
  }
475
+ /**
476
+ * gets an instance of the StatusEndpoint
477
+ * @returns StatusEndpoint
478
+ */
479
+ status() {
480
+ return new StatusEndpoint(this);
481
+ }
450
482
  }
451
483
 
452
484
  exports.AccountsEndpoints = AccountsEndpoints;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,32 @@
1
+ import axios from "axios";
2
+ import { ApiResponse } from "./apiResponse";
3
+ class AccountsEndpoints {
4
+ constructor(api) {
5
+ this.VERSION = "v1";
6
+ this.endpoint = api.endpoint;
7
+ this.state = api.apiState;
8
+ }
9
+ getPath(path) {
10
+ return `${this.endpoint}/${this.VERSION}/accounts/${path}`;
11
+ }
12
+ /**
13
+ * Gets a tenant by its ID
14
+ */
15
+ getById(accountId) {
16
+ const path = this.getPath(`${accountId}`);
17
+ console.log(path, path);
18
+ return axios.get(path, {
19
+ headers: {
20
+ "Authorization": `Bearer ${this.state.auth_token}`,
21
+ "Content-Type": "application/json"
22
+ }
23
+ })
24
+ .then((response) => {
25
+ return ApiResponse.success(response.data);
26
+ })
27
+ .catch((error) => {
28
+ return ApiResponse.errorAxios(error);
29
+ });
30
+ }
31
+ }
32
+ export { AccountsEndpoints };
@@ -0,0 +1,64 @@
1
+ export class ApiResponse {
2
+ constructor(data, error) {
3
+ this._data = data;
4
+ this._error = error;
5
+ }
6
+ /**
7
+ * create a success response from data
8
+ * @param data - The data to return
9
+ */
10
+ static success(data) {
11
+ return new ApiResponse(data);
12
+ }
13
+ /**
14
+ * create an error response from an AxiosError
15
+ * @param error - The AxiosError object
16
+ */
17
+ static error(error) {
18
+ return new ApiResponse(undefined, error);
19
+ }
20
+ /**
21
+ * create an error response from an AxiosError
22
+ * @param error - The AxiosError object
23
+ */
24
+ static errorAxios(error) {
25
+ const response = error.response;
26
+ if (response === undefined) {
27
+ return ApiResponse.error({
28
+ code: 50000,
29
+ message: "Unknown error",
30
+ status: 500
31
+ });
32
+ }
33
+ const data = response.data;
34
+ return ApiResponse.error({
35
+ code: data.code,
36
+ message: data.message,
37
+ status: response.status
38
+ });
39
+ }
40
+ /**
41
+ * check if the response is a success
42
+ */
43
+ get isSuccess() {
44
+ return this._data !== undefined;
45
+ }
46
+ /**
47
+ * check if the response is an error
48
+ */
49
+ get isError() {
50
+ return this._error !== undefined;
51
+ }
52
+ /**
53
+ * get the data from the response
54
+ */
55
+ get data() {
56
+ return this._data;
57
+ }
58
+ /**
59
+ * get the error from the response
60
+ */
61
+ get error() {
62
+ return this._error;
63
+ }
64
+ }
@@ -0,0 +1,43 @@
1
+ import { ApiResponse } from "./apiResponse";
2
+ import axios from "axios";
3
+ class AuthenticationEndpoints {
4
+ constructor(api) {
5
+ this.VERSION = "v1";
6
+ this.endpoint = api.endpoint;
7
+ this.state = api.apiState;
8
+ }
9
+ /**
10
+ * builds the full path
11
+ * @param path - The path to the endpoint, e.g. "authentication/login"
12
+ * @returns
13
+ */
14
+ getPath(path) {
15
+ return `${this.endpoint}/${this.VERSION}/auth/${path}`;
16
+ }
17
+ /**
18
+ * login to the API
19
+ * @param loginRequest - The login request object
20
+ * @returns the login response object
21
+ */
22
+ login(loginRequest) {
23
+ const path = this.getPath("login");
24
+ // axios.post(path, loginRequest)
25
+ return axios.post(path, loginRequest)
26
+ .then((response) => {
27
+ return ApiResponse.success(response.data);
28
+ }).then((response) => {
29
+ var _a, _b, _c, _d, _e;
30
+ const at = (_a = response.data) === null || _a === void 0 ? void 0 : _a.access_token;
31
+ this.state.auth_token = at;
32
+ const expire_in = ((_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.expires_in) !== null && _c !== void 0 ? _c : 0) * 1000;
33
+ const issue_time = new Date((_e = (_d = response.data) === null || _d === void 0 ? void 0 : _d.created_at) !== null && _e !== void 0 ? _e : new Date()).getMilliseconds();
34
+ const expires_milli = issue_time + expire_in;
35
+ this.state.auth_token_expire_date = new Date(expires_milli);
36
+ return response;
37
+ })
38
+ .catch((error) => {
39
+ return ApiResponse.errorAxios(error);
40
+ });
41
+ }
42
+ }
43
+ export { AuthenticationEndpoints };
@@ -0,0 +1,95 @@
1
+ import axios from "axios";
2
+ import { ApiResponse } from "./apiResponse";
3
+ class ContentEndpoints {
4
+ constructor(api) {
5
+ this.VERSION = "v1";
6
+ this.endpoint = api.endpoint;
7
+ this.state = api.apiState;
8
+ }
9
+ /**
10
+ * builds the full path
11
+ * @param path - The path to the endpoint, e.g. "authentication/login"
12
+ * @returns
13
+ */
14
+ getPath(path) {
15
+ return `${this.endpoint}/${this.VERSION}/content/${path}`;
16
+ }
17
+ /**
18
+ * get the content of a document
19
+ * @param documentId - The id of the document
20
+ * @returns the content of the document
21
+ */
22
+ getContent(documentId) {
23
+ const path = this.getPath(`document/${documentId}`);
24
+ return axios.get(path, {
25
+ headers: {
26
+ "Authorization": `Bearer ${this.state.auth_token}`
27
+ }
28
+ })
29
+ .then((response) => {
30
+ return ApiResponse.success(response.data);
31
+ })
32
+ .catch((error) => {
33
+ return ApiResponse.errorAxios(error);
34
+ });
35
+ }
36
+ /**
37
+ * get the actions of a document
38
+ * @param documentId - The id of the document
39
+ * @returns the actions of the document
40
+ */
41
+ getContentActions(documentId) {
42
+ const path = this.getPath(`document/${documentId}/actions`);
43
+ return axios.get(path, {
44
+ headers: {
45
+ "Authorization": `Bearer ${this.state.auth_token}`
46
+ }
47
+ })
48
+ .then((response) => {
49
+ return ApiResponse.success(response.data);
50
+ })
51
+ .catch((error) => {
52
+ return ApiResponse.errorAxios(error);
53
+ });
54
+ }
55
+ /**
56
+ * checks if a receiver is existing in Brifle
57
+ * @param receiver - The receiver object to check
58
+ * @returns
59
+ */
60
+ checkReceiver(receiver) {
61
+ const path = this.getPath(`receiver/check`);
62
+ return axios.post(path, receiver, {
63
+ headers: {
64
+ "Authorization": `Bearer ${this.state.auth_token}`
65
+ }
66
+ })
67
+ .then((response) => {
68
+ return ApiResponse.success(response.data);
69
+ })
70
+ .catch((error) => {
71
+ return ApiResponse.errorAxios(error);
72
+ });
73
+ }
74
+ /**
75
+ * send a content to a receiver
76
+ * @param tenantId - The tenant id of the receiver
77
+ * @param request - The request object to send
78
+ * @returns
79
+ */
80
+ sendContent(tenantId, request) {
81
+ const path = this.getPath(`send/${tenantId}`);
82
+ return axios.post(path, request, {
83
+ headers: {
84
+ "Authorization": `Bearer ${this.state.auth_token}`
85
+ }
86
+ })
87
+ .then((response) => {
88
+ return ApiResponse.success(response.data);
89
+ })
90
+ .catch((error) => {
91
+ return ApiResponse.errorAxios(error);
92
+ });
93
+ }
94
+ }
95
+ export { ContentEndpoints };
@@ -0,0 +1,55 @@
1
+ import axios from "axios";
2
+ import { ApiResponse } from "./apiResponse";
3
+ class MailboxEndpoints {
4
+ constructor(api) {
5
+ this.VERSION = "v1";
6
+ this.endpoint = api.endpoint;
7
+ this.state = api.apiState;
8
+ }
9
+ getPath(path) {
10
+ return `${this.endpoint}/${this.VERSION}/mailbox/${path}`;
11
+ }
12
+ /**
13
+ * Get the inbox of an account
14
+ * @returns the mailbox response object
15
+ */
16
+ getInbox(filter, page = 1) {
17
+ const path = this.getPath(`inbox`);
18
+ const body = {
19
+ filter: filter,
20
+ page: page
21
+ };
22
+ return axios.post(path, body, {
23
+ headers: {
24
+ "Authorization": `Bearer ${this.state.auth_token}`,
25
+ "Content-Type": "application/json"
26
+ }
27
+ })
28
+ .then((response) => {
29
+ return ApiResponse.success(response.data);
30
+ })
31
+ .catch((error) => {
32
+ return ApiResponse.errorAxios(error);
33
+ });
34
+ }
35
+ getOutbox(tenant, filter, page = 1) {
36
+ const path = this.getPath(`outbox/${tenant}`);
37
+ const body = {
38
+ filter: filter,
39
+ page: page
40
+ };
41
+ return axios.post(path, body, {
42
+ headers: {
43
+ "Authorization": `Bearer ${this.state.auth_token}`,
44
+ "Content-Type": "application/json"
45
+ }
46
+ })
47
+ .then((response) => {
48
+ return ApiResponse.success(response.data);
49
+ })
50
+ .catch((error) => {
51
+ return ApiResponse.errorAxios(error);
52
+ });
53
+ }
54
+ }
55
+ export { MailboxEndpoints };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ import axios from "axios";
2
+ import { ApiResponse } from "./apiResponse";
3
+ class SignaturesEndpoint {
4
+ constructor(api) {
5
+ this.VERSION = "v1";
6
+ this.endpoint = api.endpoint;
7
+ this.state = api.apiState;
8
+ }
9
+ /**
10
+ * builds the full path
11
+ * @param path - The path to the endpoint, e.g. "authentication/login"
12
+ * @returns
13
+ */
14
+ getPath(path) {
15
+ return `${this.endpoint}/${this.VERSION}/signature/${path}`;
16
+ }
17
+ /**
18
+ * creates a signature reference
19
+ * @param tenantId - The id of the tenant
20
+ * @param request - The request object
21
+ * @returns the response object
22
+ */
23
+ createSignatureReference(tenantId, request) {
24
+ const path = this.getPath(`${tenantId}/reference`);
25
+ const headers = {
26
+ "Authorization": `Bearer ${this.state.auth_token}`,
27
+ };
28
+ return axios.post(path, request, { headers })
29
+ .then((response) => {
30
+ return ApiResponse.success(response.data);
31
+ })
32
+ .catch((error) => {
33
+ return ApiResponse.errorAxios(error);
34
+ });
35
+ }
36
+ /**
37
+ * gets a signature reference
38
+ * @param signatureId - The id of the signature
39
+ * @returns the response object
40
+ */
41
+ exportSignature(signatureId, format) {
42
+ const path = this.getPath(`${signatureId}/export/${format}`);
43
+ const headers = {
44
+ "Authorization": `Bearer ${this.state.auth_token}`,
45
+ };
46
+ return axios.get(path, { headers })
47
+ .then((response) => {
48
+ return ApiResponse.success(response.data);
49
+ })
50
+ .catch((error) => {
51
+ return ApiResponse.errorAxios(error);
52
+ });
53
+ }
54
+ }
55
+ export { SignaturesEndpoint };