@brifle/brifle-sdk 0.0.2

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 (44) hide show
  1. package/LICENSE +21 -0
  2. package/README +6 -0
  3. package/dist/cjs/api/api.d.ts +30 -0
  4. package/dist/cjs/endpoints/v1/apiResponse.d.ts +42 -0
  5. package/dist/cjs/endpoints/v1/authentication.d.ts +23 -0
  6. package/dist/cjs/endpoints/v1/content.d.ts +42 -0
  7. package/dist/cjs/endpoints/v1/requests/authentication.d.ts +7 -0
  8. package/dist/cjs/endpoints/v1/requests/content.d.ts +50 -0
  9. package/dist/cjs/endpoints/v1/requests/signatures.d.ts +8 -0
  10. package/dist/cjs/endpoints/v1/responses/authentication.d.ts +8 -0
  11. package/dist/cjs/endpoints/v1/responses/content.d.ts +68 -0
  12. package/dist/cjs/endpoints/v1/responses/signatures.d.ts +10 -0
  13. package/dist/cjs/endpoints/v1/signatures.d.ts +30 -0
  14. package/dist/cjs/index.d.ts +11 -0
  15. package/dist/cjs/index.js +306 -0
  16. package/dist/cjs/index.js.map +1 -0
  17. package/dist/esm/api/api.d.ts +30 -0
  18. package/dist/esm/endpoints/v1/apiResponse.d.ts +42 -0
  19. package/dist/esm/endpoints/v1/authentication.d.ts +23 -0
  20. package/dist/esm/endpoints/v1/content.d.ts +42 -0
  21. package/dist/esm/endpoints/v1/requests/authentication.d.ts +7 -0
  22. package/dist/esm/endpoints/v1/requests/content.d.ts +50 -0
  23. package/dist/esm/endpoints/v1/requests/signatures.d.ts +8 -0
  24. package/dist/esm/endpoints/v1/responses/authentication.d.ts +8 -0
  25. package/dist/esm/endpoints/v1/responses/content.d.ts +68 -0
  26. package/dist/esm/endpoints/v1/responses/signatures.d.ts +10 -0
  27. package/dist/esm/endpoints/v1/signatures.d.ts +30 -0
  28. package/dist/esm/index.d.ts +11 -0
  29. package/dist/esm/index.mjs +300 -0
  30. package/dist/esm/index.mjs.map +1 -0
  31. package/dist/index.d.ts +309 -0
  32. package/dist/types/api/api.d.ts +30 -0
  33. package/dist/types/endpoints/v1/apiResponse.d.ts +42 -0
  34. package/dist/types/endpoints/v1/authentication.d.ts +23 -0
  35. package/dist/types/endpoints/v1/content.d.ts +42 -0
  36. package/dist/types/endpoints/v1/requests/authentication.d.ts +7 -0
  37. package/dist/types/endpoints/v1/requests/content.d.ts +50 -0
  38. package/dist/types/endpoints/v1/requests/signatures.d.ts +8 -0
  39. package/dist/types/endpoints/v1/responses/authentication.d.ts +8 -0
  40. package/dist/types/endpoints/v1/responses/content.d.ts +68 -0
  41. package/dist/types/endpoints/v1/responses/signatures.d.ts +10 -0
  42. package/dist/types/endpoints/v1/signatures.d.ts +30 -0
  43. package/dist/types/index.d.ts +11 -0
  44. package/package.json +48 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Brifle GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README ADDED
@@ -0,0 +1,6 @@
1
+ # Brifle SDK
2
+
3
+ A Typescript SDK to interact with the Rest API of the Brifle platform.
4
+
5
+
6
+
@@ -0,0 +1,30 @@
1
+ import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
+ import { ContentEndpoints } from "../endpoints/v1/content";
3
+ import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
+ declare class ApiV1 {
5
+ readonly endpoint: string;
6
+ readonly apiState: ApiV1State;
7
+ constructor(endpoint: string);
8
+ static get sandbox(): ApiV1;
9
+ static get production(): ApiV1;
10
+ /**
11
+ * gets an instance of the AuthenticationEndpoints
12
+ * @returns AuthenticationEndpoints
13
+ */
14
+ authentication(): AuthenticationEndpoints;
15
+ /**
16
+ * gets an instance of the ContentEndpoints
17
+ * @returns ContentEndpoints
18
+ */
19
+ content(): ContentEndpoints;
20
+ /**
21
+ * gets an instance of the SignatureEndpoints
22
+ * @returns ContentEndpoints
23
+ */
24
+ signature(): SignaturesEndpoint;
25
+ }
26
+ export interface ApiV1State {
27
+ auth_token?: string;
28
+ auth_token_expire_date?: Date;
29
+ }
30
+ export { ApiV1 };
@@ -0,0 +1,42 @@
1
+ import { AxiosError } from "axios";
2
+ export declare class ApiResponse<ResponseType> {
3
+ private _data?;
4
+ private _error?;
5
+ private constructor();
6
+ /**
7
+ * create a success response from data
8
+ * @param data - The data to return
9
+ */
10
+ static success<ResponseType>(data: ResponseType): ApiResponse<ResponseType>;
11
+ /**
12
+ * create an error response from an AxiosError
13
+ * @param error - The AxiosError object
14
+ */
15
+ static error<ResponseType>(error: ErrorResponse): ApiResponse<ResponseType>;
16
+ /**
17
+ * create an error response from an AxiosError
18
+ * @param error - The AxiosError object
19
+ */
20
+ static errorAxios<ResponseType>(error: AxiosError): ApiResponse<ResponseType>;
21
+ /**
22
+ * check if the response is a success
23
+ */
24
+ get isSuccess(): boolean;
25
+ /**
26
+ * check if the response is an error
27
+ */
28
+ get isError(): boolean;
29
+ /**
30
+ * get the data from the response
31
+ */
32
+ get data(): ResponseType | undefined;
33
+ /**
34
+ * get the error from the response
35
+ */
36
+ get error(): ErrorResponse | undefined;
37
+ }
38
+ export interface ErrorResponse {
39
+ code: number;
40
+ message: string;
41
+ status: number;
42
+ }
@@ -0,0 +1,23 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { ApiResponse } from "./apiResponse";
3
+ import { LoginRequest } from "./requests/authentication";
4
+ import { LoginResponse } from "./responses/authentication";
5
+ declare class AuthenticationEndpoints {
6
+ private endpoint;
7
+ private readonly VERSION;
8
+ private state;
9
+ constructor(api: ApiV1);
10
+ /**
11
+ * builds the full path
12
+ * @param path - The path to the endpoint, e.g. "authentication/login"
13
+ * @returns
14
+ */
15
+ private getPath;
16
+ /**
17
+ * login to the API
18
+ * @param loginRequest - The login request object
19
+ * @returns the login response object
20
+ */
21
+ login(loginRequest: LoginRequest): Promise<ApiResponse<LoginResponse>>;
22
+ }
23
+ export { AuthenticationEndpoints };
@@ -0,0 +1,42 @@
1
+ import { ApiResponse } from "./apiResponse";
2
+ import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, SendContentResponse } from "./responses/content";
3
+ import { ApiV1 } from "../../api/api";
4
+ import { ReceiverRequest, SendContentRequest } from "./requests/content";
5
+ declare class ContentEndpoints {
6
+ private endpoint;
7
+ private readonly VERSION;
8
+ private state;
9
+ constructor(api: ApiV1);
10
+ /**
11
+ * builds the full path
12
+ * @param path - The path to the endpoint, e.g. "authentication/login"
13
+ * @returns
14
+ */
15
+ private getPath;
16
+ /**
17
+ * get the content of a document
18
+ * @param documentId - The id of the document
19
+ * @returns the content of the document
20
+ */
21
+ getContent(documentId: string): Promise<ApiResponse<ContentResponse>>;
22
+ /**
23
+ * get the actions of a document
24
+ * @param documentId - The id of the document
25
+ * @returns the actions of the document
26
+ */
27
+ getContentActions(documentId: string): Promise<ApiResponse<ContentActionsResponse>>;
28
+ /**
29
+ * checks if a receiver is existing in Brifle
30
+ * @param receiver - The receiver object to check
31
+ * @returns
32
+ */
33
+ checkReceiver(receiver: ReceiverRequest): Promise<ApiResponse<CheckReceiverResponse>>;
34
+ /**
35
+ * send a content to a receiver
36
+ * @param tenantId - The tenant id of the receiver
37
+ * @param request - The request object to send
38
+ * @returns
39
+ */
40
+ sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
41
+ }
42
+ export { ContentEndpoints };
@@ -0,0 +1,7 @@
1
+ export interface LoginRequest {
2
+ key: string;
3
+ secret: string;
4
+ }
5
+ export interface LogoutRequest {
6
+ token: string;
7
+ }
@@ -0,0 +1,50 @@
1
+ interface ReceiverRequest {
2
+ account_id?: string;
3
+ birth_information?: BirthInformation;
4
+ email?: string;
5
+ tel?: string;
6
+ vad_id?: string;
7
+ ssn?: string;
8
+ first_name?: string;
9
+ last_name?: string;
10
+ full_name?: string;
11
+ date_of_birth?: string;
12
+ }
13
+ interface BirthInformation {
14
+ birth_name?: string;
15
+ date_of_birth: string;
16
+ place_of_birth: string;
17
+ nationality?: string;
18
+ given_names?: string;
19
+ last_name?: string;
20
+ postaL_address?: string;
21
+ }
22
+ interface PaymentDetails {
23
+ amount: number;
24
+ currency: 'EUR';
25
+ description: string;
26
+ due_date: string;
27
+ iban: string;
28
+ reference: string;
29
+ }
30
+ interface SendContentRequest {
31
+ to: ReceiverRequest;
32
+ type: 'letter' | 'invoice' | 'contract';
33
+ subject: string;
34
+ body: {
35
+ type: 'application/pdf';
36
+ content: string;
37
+ }[];
38
+ payment_info?: {
39
+ details?: PaymentDetails;
40
+ payable: boolean;
41
+ };
42
+ signature_info?: {
43
+ signature_reference: string;
44
+ requesting_signer: {
45
+ field: string;
46
+ signer: 'sender' | 'receiver';
47
+ }[];
48
+ };
49
+ }
50
+ export type { SendContentRequest, ReceiverRequest, BirthInformation, PaymentDetails };
@@ -0,0 +1,8 @@
1
+ interface CreateSignatureReferenceRequest {
2
+ fields: {
3
+ name: string;
4
+ purpose: string;
5
+ role: string;
6
+ }[];
7
+ }
8
+ export type { CreateSignatureReferenceRequest };
@@ -0,0 +1,8 @@
1
+ export interface LoginResponse {
2
+ access_token: string;
3
+ created_at: string;
4
+ expires_in: number;
5
+ refresh_token: string;
6
+ token_type: string;
7
+ scope: string;
8
+ }
@@ -0,0 +1,68 @@
1
+ interface SendContentResponse {
2
+ id: string;
3
+ }
4
+ interface CheckReceiverResponse {
5
+ receiver: {
6
+ type: string;
7
+ };
8
+ }
9
+ interface ContentMeta {
10
+ delivered: boolean;
11
+ delivered_date: string;
12
+ read: boolean;
13
+ read_date: string;
14
+ receiver?: string;
15
+ sender?: string;
16
+ receiver_state?: 'unread' | 'read' | 'archived' | 'trashed' | 'deleted' | 'pending';
17
+ sender_state?: 'activate' | 'activated' | 'trashed' | 'deleted' | 'pending';
18
+ sent_date: string;
19
+ size: number;
20
+ subject: string;
21
+ type: string;
22
+ }
23
+ interface ContentResponse {
24
+ content: {
25
+ content: string;
26
+ type: string;
27
+ };
28
+ meta: ContentMeta;
29
+ }
30
+ interface ContentActionsPaymentResponse {
31
+ details: {
32
+ amount: number;
33
+ currency: string;
34
+ due_date: string;
35
+ market: string;
36
+ reference: string;
37
+ iban: string;
38
+ tink_payment_id: string;
39
+ };
40
+ link: string;
41
+ }
42
+ interface ContentActionsSignatureResponse {
43
+ document_signatures: {
44
+ signature_ids: string[];
45
+ signature_reference: string;
46
+ };
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
+ }[];
62
+ signature_reference: string;
63
+ }
64
+ interface ContentActionsResponse {
65
+ payments: ContentActionsPaymentResponse[];
66
+ signatures: ContentActionsSignatureResponse[];
67
+ }
68
+ export type { SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
@@ -0,0 +1,10 @@
1
+ interface CreateSignatureReferenceResponse {
2
+ id: string;
3
+ managed_by: string;
4
+ signature_fields: {
5
+ name: string;
6
+ purpose: string;
7
+ role: string;
8
+ }[];
9
+ }
10
+ export type { CreateSignatureReferenceResponse };
@@ -0,0 +1,30 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { CreateSignatureReferenceRequest } from "./requests/signatures";
3
+ import { ApiResponse } from "./apiResponse";
4
+ import { CreateSignatureReferenceResponse } from "./responses/signatures";
5
+ declare class SignaturesEndpoint {
6
+ private endpoint;
7
+ private readonly VERSION;
8
+ private state;
9
+ constructor(api: ApiV1);
10
+ /**
11
+ * builds the full path
12
+ * @param path - The path to the endpoint, e.g. "authentication/login"
13
+ * @returns
14
+ */
15
+ private getPath;
16
+ /**
17
+ * creates a signature reference
18
+ * @param tenantId - The id of the tenant
19
+ * @param request - The request object
20
+ * @returns the response object
21
+ */
22
+ createSignatureReference(tenantId: string, request: CreateSignatureReferenceRequest): Promise<ApiResponse<CreateSignatureReferenceResponse>>;
23
+ /**
24
+ * gets a signature reference
25
+ * @param signatureId - The id of the signature
26
+ * @returns the response object
27
+ */
28
+ exportSignature(signatureId: string, format: 'xml'): Promise<ApiResponse<any>>;
29
+ }
30
+ export { SignaturesEndpoint };
@@ -0,0 +1,11 @@
1
+ export * from "./api/api";
2
+ export * from "./endpoints/v1/requests/authentication";
3
+ export * from "./endpoints/v1/responses/authentication";
4
+ export * from "./endpoints/v1/requests/content";
5
+ export * from "./endpoints/v1/responses/content";
6
+ export * from "./endpoints/v1/requests/signatures";
7
+ export * from "./endpoints/v1/responses/signatures";
8
+ export * from "./endpoints/v1/apiResponse";
9
+ export * from "./endpoints/v1/authentication";
10
+ export * from "./endpoints/v1/content";
11
+ export * from "./endpoints/v1/signatures";
@@ -0,0 +1,306 @@
1
+ 'use strict';
2
+
3
+ var axios = require('axios');
4
+
5
+ class ApiResponse {
6
+ constructor(data, error) {
7
+ this._data = data;
8
+ this._error = error;
9
+ }
10
+ /**
11
+ * create a success response from data
12
+ * @param data - The data to return
13
+ */
14
+ static success(data) {
15
+ return new ApiResponse(data);
16
+ }
17
+ /**
18
+ * create an error response from an AxiosError
19
+ * @param error - The AxiosError object
20
+ */
21
+ static error(error) {
22
+ return new ApiResponse(undefined, error);
23
+ }
24
+ /**
25
+ * create an error response from an AxiosError
26
+ * @param error - The AxiosError object
27
+ */
28
+ static errorAxios(error) {
29
+ const response = error.response;
30
+ if (response === undefined) {
31
+ return ApiResponse.error({
32
+ code: 50000,
33
+ message: "Unknown error",
34
+ status: 500
35
+ });
36
+ }
37
+ const data = response.data;
38
+ return ApiResponse.error({
39
+ code: data.code,
40
+ message: data.message,
41
+ status: response.status
42
+ });
43
+ }
44
+ /**
45
+ * check if the response is a success
46
+ */
47
+ get isSuccess() {
48
+ return this._data !== undefined;
49
+ }
50
+ /**
51
+ * check if the response is an error
52
+ */
53
+ get isError() {
54
+ return this._error !== undefined;
55
+ }
56
+ /**
57
+ * get the data from the response
58
+ */
59
+ get data() {
60
+ return this._data;
61
+ }
62
+ /**
63
+ * get the error from the response
64
+ */
65
+ get error() {
66
+ return this._error;
67
+ }
68
+ }
69
+
70
+ class AuthenticationEndpoints {
71
+ constructor(api) {
72
+ this.VERSION = "v1";
73
+ this.endpoint = api.endpoint;
74
+ this.state = api.apiState;
75
+ }
76
+ /**
77
+ * builds the full path
78
+ * @param path - The path to the endpoint, e.g. "authentication/login"
79
+ * @returns
80
+ */
81
+ getPath(path) {
82
+ return `${this.endpoint}/${this.VERSION}/auth/${path}`;
83
+ }
84
+ /**
85
+ * login to the API
86
+ * @param loginRequest - The login request object
87
+ * @returns the login response object
88
+ */
89
+ login(loginRequest) {
90
+ const path = this.getPath("login");
91
+ // axios.post(path, loginRequest)
92
+ return axios.post(path, loginRequest)
93
+ .then((response) => {
94
+ return ApiResponse.success(response.data);
95
+ }).then((response) => {
96
+ var _a, _b, _c, _d, _e;
97
+ const at = (_a = response.data) === null || _a === void 0 ? void 0 : _a.access_token;
98
+ this.state.auth_token = at;
99
+ const expire_in = ((_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.expires_in) !== null && _c !== void 0 ? _c : 0) * 1000;
100
+ 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();
101
+ const expires_milli = issue_time + expire_in;
102
+ this.state.auth_token_expire_date = new Date(expires_milli);
103
+ return response;
104
+ })
105
+ .catch((error) => {
106
+ return ApiResponse.errorAxios(error);
107
+ });
108
+ }
109
+ }
110
+
111
+ class ContentEndpoints {
112
+ constructor(api) {
113
+ this.VERSION = "v1";
114
+ this.endpoint = api.endpoint;
115
+ this.state = api.apiState;
116
+ }
117
+ /**
118
+ * builds the full path
119
+ * @param path - The path to the endpoint, e.g. "authentication/login"
120
+ * @returns
121
+ */
122
+ getPath(path) {
123
+ return `${this.endpoint}/${this.VERSION}/content/${path}`;
124
+ }
125
+ /**
126
+ * get the content of a document
127
+ * @param documentId - The id of the document
128
+ * @returns the content of the document
129
+ */
130
+ getContent(documentId) {
131
+ const path = this.getPath(`document/${documentId}`);
132
+ return axios.get(path, {
133
+ headers: {
134
+ "Authorization": `Bearer ${this.state.auth_token}`
135
+ }
136
+ })
137
+ .then((response) => {
138
+ return ApiResponse.success(response.data);
139
+ })
140
+ .catch((error) => {
141
+ return ApiResponse.errorAxios(error);
142
+ });
143
+ }
144
+ /**
145
+ * get the actions of a document
146
+ * @param documentId - The id of the document
147
+ * @returns the actions of the document
148
+ */
149
+ getContentActions(documentId) {
150
+ const path = this.getPath(`document/${documentId}/actions`);
151
+ return axios.get(path, {
152
+ headers: {
153
+ "Authorization": `Bearer ${this.state.auth_token}`
154
+ }
155
+ })
156
+ .then((response) => {
157
+ return ApiResponse.success(response.data);
158
+ })
159
+ .catch((error) => {
160
+ return ApiResponse.errorAxios(error);
161
+ });
162
+ }
163
+ /**
164
+ * checks if a receiver is existing in Brifle
165
+ * @param receiver - The receiver object to check
166
+ * @returns
167
+ */
168
+ checkReceiver(receiver) {
169
+ const path = this.getPath(`receiver/check`);
170
+ return axios.post(path, receiver, {
171
+ headers: {
172
+ "Authorization": `Bearer ${this.state.auth_token}`
173
+ }
174
+ })
175
+ .then((response) => {
176
+ return ApiResponse.success(response.data);
177
+ })
178
+ .catch((error) => {
179
+ return ApiResponse.errorAxios(error);
180
+ });
181
+ }
182
+ /**
183
+ * send a content to a receiver
184
+ * @param tenantId - The tenant id of the receiver
185
+ * @param request - The request object to send
186
+ * @returns
187
+ */
188
+ sendContent(tenantId, request) {
189
+ const path = this.getPath(`send/${tenantId}`);
190
+ return axios.post(path, request, {
191
+ headers: {
192
+ "Authorization": `Bearer ${this.state.auth_token}`
193
+ }
194
+ })
195
+ .then((response) => {
196
+ return ApiResponse.success(response.data);
197
+ })
198
+ .catch((error) => {
199
+ return ApiResponse.errorAxios(error);
200
+ });
201
+ }
202
+ }
203
+
204
+ class SignaturesEndpoint {
205
+ constructor(api) {
206
+ this.VERSION = "v1";
207
+ this.endpoint = api.endpoint;
208
+ this.state = api.apiState;
209
+ }
210
+ /**
211
+ * builds the full path
212
+ * @param path - The path to the endpoint, e.g. "authentication/login"
213
+ * @returns
214
+ */
215
+ getPath(path) {
216
+ return `${this.endpoint}/${this.VERSION}/signature/${path}`;
217
+ }
218
+ /**
219
+ * creates a signature reference
220
+ * @param tenantId - The id of the tenant
221
+ * @param request - The request object
222
+ * @returns the response object
223
+ */
224
+ createSignatureReference(tenantId, request) {
225
+ const path = this.getPath(`${tenantId}/reference`);
226
+ const headers = {
227
+ "Authorization": `Bearer ${this.state.auth_token}`,
228
+ };
229
+ return axios.post(path, request, { headers })
230
+ .then((response) => {
231
+ return ApiResponse.success(response.data);
232
+ })
233
+ .catch((error) => {
234
+ return ApiResponse.errorAxios(error);
235
+ });
236
+ }
237
+ /**
238
+ * gets a signature reference
239
+ * @param signatureId - The id of the signature
240
+ * @returns the response object
241
+ */
242
+ exportSignature(signatureId, format) {
243
+ const path = this.getPath(`${signatureId}/export/${format}`);
244
+ const headers = {
245
+ "Authorization": `Bearer ${this.state.auth_token}`,
246
+ };
247
+ return axios.get(path, { headers })
248
+ .then((response) => {
249
+ return ApiResponse.success(response.data);
250
+ })
251
+ .catch((error) => {
252
+ return ApiResponse.errorAxios(error);
253
+ });
254
+ }
255
+ }
256
+
257
+ var ENDPOINTS;
258
+ (function (ENDPOINTS) {
259
+ ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
260
+ ENDPOINTS["PRODUCTION"] = "https://api.brifle.de";
261
+ })(ENDPOINTS || (ENDPOINTS = {}));
262
+ class ApiV1 {
263
+ constructor(endpoint) {
264
+ if (endpoint.endsWith("/")) {
265
+ this.endpoint = endpoint.slice(0, -1);
266
+ }
267
+ else {
268
+ this.endpoint = endpoint;
269
+ }
270
+ this.apiState = {};
271
+ }
272
+ static get sandbox() {
273
+ return new ApiV1(ENDPOINTS.SANDBOX);
274
+ }
275
+ static get production() {
276
+ return new ApiV1(ENDPOINTS.PRODUCTION);
277
+ }
278
+ /**
279
+ * gets an instance of the AuthenticationEndpoints
280
+ * @returns AuthenticationEndpoints
281
+ */
282
+ authentication() {
283
+ return new AuthenticationEndpoints(this);
284
+ }
285
+ /**
286
+ * gets an instance of the ContentEndpoints
287
+ * @returns ContentEndpoints
288
+ */
289
+ content() {
290
+ return new ContentEndpoints(this);
291
+ }
292
+ /**
293
+ * gets an instance of the SignatureEndpoints
294
+ * @returns ContentEndpoints
295
+ */
296
+ signature() {
297
+ return new SignaturesEndpoint(this);
298
+ }
299
+ }
300
+
301
+ exports.ApiResponse = ApiResponse;
302
+ exports.ApiV1 = ApiV1;
303
+ exports.AuthenticationEndpoints = AuthenticationEndpoints;
304
+ exports.ContentEndpoints = ContentEndpoints;
305
+ exports.SignaturesEndpoint = SignaturesEndpoint;
306
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}