@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.
- package/LICENSE +21 -0
- package/README +6 -0
- package/dist/cjs/api/api.d.ts +30 -0
- package/dist/cjs/endpoints/v1/apiResponse.d.ts +42 -0
- package/dist/cjs/endpoints/v1/authentication.d.ts +23 -0
- package/dist/cjs/endpoints/v1/content.d.ts +42 -0
- package/dist/cjs/endpoints/v1/requests/authentication.d.ts +7 -0
- package/dist/cjs/endpoints/v1/requests/content.d.ts +50 -0
- package/dist/cjs/endpoints/v1/requests/signatures.d.ts +8 -0
- package/dist/cjs/endpoints/v1/responses/authentication.d.ts +8 -0
- package/dist/cjs/endpoints/v1/responses/content.d.ts +68 -0
- package/dist/cjs/endpoints/v1/responses/signatures.d.ts +10 -0
- package/dist/cjs/endpoints/v1/signatures.d.ts +30 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +306 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/api/api.d.ts +30 -0
- package/dist/esm/endpoints/v1/apiResponse.d.ts +42 -0
- package/dist/esm/endpoints/v1/authentication.d.ts +23 -0
- package/dist/esm/endpoints/v1/content.d.ts +42 -0
- package/dist/esm/endpoints/v1/requests/authentication.d.ts +7 -0
- package/dist/esm/endpoints/v1/requests/content.d.ts +50 -0
- package/dist/esm/endpoints/v1/requests/signatures.d.ts +8 -0
- package/dist/esm/endpoints/v1/responses/authentication.d.ts +8 -0
- package/dist/esm/endpoints/v1/responses/content.d.ts +68 -0
- package/dist/esm/endpoints/v1/responses/signatures.d.ts +10 -0
- package/dist/esm/endpoints/v1/signatures.d.ts +30 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.mjs +300 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.d.ts +309 -0
- package/dist/types/api/api.d.ts +30 -0
- package/dist/types/endpoints/v1/apiResponse.d.ts +42 -0
- package/dist/types/endpoints/v1/authentication.d.ts +23 -0
- package/dist/types/endpoints/v1/content.d.ts +42 -0
- package/dist/types/endpoints/v1/requests/authentication.d.ts +7 -0
- package/dist/types/endpoints/v1/requests/content.d.ts +50 -0
- package/dist/types/endpoints/v1/requests/signatures.d.ts +8 -0
- package/dist/types/endpoints/v1/responses/authentication.d.ts +8 -0
- package/dist/types/endpoints/v1/responses/content.d.ts +68 -0
- package/dist/types/endpoints/v1/responses/signatures.d.ts +10 -0
- package/dist/types/endpoints/v1/signatures.d.ts +30 -0
- package/dist/types/index.d.ts +11 -0
- package/package.json +48 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
|
|
3
|
+
declare class ApiResponse<ResponseType> {
|
|
4
|
+
private _data?;
|
|
5
|
+
private _error?;
|
|
6
|
+
private constructor();
|
|
7
|
+
/**
|
|
8
|
+
* create a success response from data
|
|
9
|
+
* @param data - The data to return
|
|
10
|
+
*/
|
|
11
|
+
static success<ResponseType>(data: ResponseType): ApiResponse<ResponseType>;
|
|
12
|
+
/**
|
|
13
|
+
* create an error response from an AxiosError
|
|
14
|
+
* @param error - The AxiosError object
|
|
15
|
+
*/
|
|
16
|
+
static error<ResponseType>(error: ErrorResponse): ApiResponse<ResponseType>;
|
|
17
|
+
/**
|
|
18
|
+
* create an error response from an AxiosError
|
|
19
|
+
* @param error - The AxiosError object
|
|
20
|
+
*/
|
|
21
|
+
static errorAxios<ResponseType>(error: AxiosError): ApiResponse<ResponseType>;
|
|
22
|
+
/**
|
|
23
|
+
* check if the response is a success
|
|
24
|
+
*/
|
|
25
|
+
get isSuccess(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* check if the response is an error
|
|
28
|
+
*/
|
|
29
|
+
get isError(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* get the data from the response
|
|
32
|
+
*/
|
|
33
|
+
get data(): ResponseType | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* get the error from the response
|
|
36
|
+
*/
|
|
37
|
+
get error(): ErrorResponse | undefined;
|
|
38
|
+
}
|
|
39
|
+
interface ErrorResponse {
|
|
40
|
+
code: number;
|
|
41
|
+
message: string;
|
|
42
|
+
status: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface LoginRequest {
|
|
46
|
+
key: string;
|
|
47
|
+
secret: string;
|
|
48
|
+
}
|
|
49
|
+
interface LogoutRequest {
|
|
50
|
+
token: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface LoginResponse {
|
|
54
|
+
access_token: string;
|
|
55
|
+
created_at: string;
|
|
56
|
+
expires_in: number;
|
|
57
|
+
refresh_token: string;
|
|
58
|
+
token_type: string;
|
|
59
|
+
scope: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare class AuthenticationEndpoints {
|
|
63
|
+
private endpoint;
|
|
64
|
+
private readonly VERSION;
|
|
65
|
+
private state;
|
|
66
|
+
constructor(api: ApiV1);
|
|
67
|
+
/**
|
|
68
|
+
* builds the full path
|
|
69
|
+
* @param path - The path to the endpoint, e.g. "authentication/login"
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
private getPath;
|
|
73
|
+
/**
|
|
74
|
+
* login to the API
|
|
75
|
+
* @param loginRequest - The login request object
|
|
76
|
+
* @returns the login response object
|
|
77
|
+
*/
|
|
78
|
+
login(loginRequest: LoginRequest): Promise<ApiResponse<LoginResponse>>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface SendContentResponse {
|
|
82
|
+
id: string;
|
|
83
|
+
}
|
|
84
|
+
interface CheckReceiverResponse {
|
|
85
|
+
receiver: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
interface ContentMeta {
|
|
90
|
+
delivered: boolean;
|
|
91
|
+
delivered_date: string;
|
|
92
|
+
read: boolean;
|
|
93
|
+
read_date: string;
|
|
94
|
+
receiver?: string;
|
|
95
|
+
sender?: string;
|
|
96
|
+
receiver_state?: 'unread' | 'read' | 'archived' | 'trashed' | 'deleted' | 'pending';
|
|
97
|
+
sender_state?: 'activate' | 'activated' | 'trashed' | 'deleted' | 'pending';
|
|
98
|
+
sent_date: string;
|
|
99
|
+
size: number;
|
|
100
|
+
subject: string;
|
|
101
|
+
type: string;
|
|
102
|
+
}
|
|
103
|
+
interface ContentResponse {
|
|
104
|
+
content: {
|
|
105
|
+
content: string;
|
|
106
|
+
type: string;
|
|
107
|
+
};
|
|
108
|
+
meta: ContentMeta;
|
|
109
|
+
}
|
|
110
|
+
interface ContentActionsPaymentResponse {
|
|
111
|
+
details: {
|
|
112
|
+
amount: number;
|
|
113
|
+
currency: string;
|
|
114
|
+
due_date: string;
|
|
115
|
+
market: string;
|
|
116
|
+
reference: string;
|
|
117
|
+
iban: string;
|
|
118
|
+
tink_payment_id: string;
|
|
119
|
+
};
|
|
120
|
+
link: string;
|
|
121
|
+
}
|
|
122
|
+
interface ContentActionsSignatureResponse {
|
|
123
|
+
document_signatures: {
|
|
124
|
+
signature_ids: string[];
|
|
125
|
+
signature_reference: string;
|
|
126
|
+
};
|
|
127
|
+
embedded_signatures: {
|
|
128
|
+
created_by: string;
|
|
129
|
+
created_date: string;
|
|
130
|
+
document_signature_id: string;
|
|
131
|
+
due_date: string;
|
|
132
|
+
field_name: string;
|
|
133
|
+
history?: string;
|
|
134
|
+
purpose: string;
|
|
135
|
+
request_date: string;
|
|
136
|
+
requested_to: string;
|
|
137
|
+
signature_date: string;
|
|
138
|
+
signed_by: string;
|
|
139
|
+
signed_for: string;
|
|
140
|
+
value: string;
|
|
141
|
+
}[];
|
|
142
|
+
signature_reference: string;
|
|
143
|
+
}
|
|
144
|
+
interface ContentActionsResponse {
|
|
145
|
+
payments: ContentActionsPaymentResponse[];
|
|
146
|
+
signatures: ContentActionsSignatureResponse[];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface ReceiverRequest {
|
|
150
|
+
account_id?: string;
|
|
151
|
+
birth_information?: BirthInformation;
|
|
152
|
+
email?: string;
|
|
153
|
+
tel?: string;
|
|
154
|
+
vad_id?: string;
|
|
155
|
+
ssn?: string;
|
|
156
|
+
first_name?: string;
|
|
157
|
+
last_name?: string;
|
|
158
|
+
full_name?: string;
|
|
159
|
+
date_of_birth?: string;
|
|
160
|
+
}
|
|
161
|
+
interface BirthInformation {
|
|
162
|
+
birth_name?: string;
|
|
163
|
+
date_of_birth: string;
|
|
164
|
+
place_of_birth: string;
|
|
165
|
+
nationality?: string;
|
|
166
|
+
given_names?: string;
|
|
167
|
+
last_name?: string;
|
|
168
|
+
postaL_address?: string;
|
|
169
|
+
}
|
|
170
|
+
interface PaymentDetails {
|
|
171
|
+
amount: number;
|
|
172
|
+
currency: 'EUR';
|
|
173
|
+
description: string;
|
|
174
|
+
due_date: string;
|
|
175
|
+
iban: string;
|
|
176
|
+
reference: string;
|
|
177
|
+
}
|
|
178
|
+
interface SendContentRequest {
|
|
179
|
+
to: ReceiverRequest;
|
|
180
|
+
type: 'letter' | 'invoice' | 'contract';
|
|
181
|
+
subject: string;
|
|
182
|
+
body: {
|
|
183
|
+
type: 'application/pdf';
|
|
184
|
+
content: string;
|
|
185
|
+
}[];
|
|
186
|
+
payment_info?: {
|
|
187
|
+
details?: PaymentDetails;
|
|
188
|
+
payable: boolean;
|
|
189
|
+
};
|
|
190
|
+
signature_info?: {
|
|
191
|
+
signature_reference: string;
|
|
192
|
+
requesting_signer: {
|
|
193
|
+
field: string;
|
|
194
|
+
signer: 'sender' | 'receiver';
|
|
195
|
+
}[];
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare class ContentEndpoints {
|
|
200
|
+
private endpoint;
|
|
201
|
+
private readonly VERSION;
|
|
202
|
+
private state;
|
|
203
|
+
constructor(api: ApiV1);
|
|
204
|
+
/**
|
|
205
|
+
* builds the full path
|
|
206
|
+
* @param path - The path to the endpoint, e.g. "authentication/login"
|
|
207
|
+
* @returns
|
|
208
|
+
*/
|
|
209
|
+
private getPath;
|
|
210
|
+
/**
|
|
211
|
+
* get the content of a document
|
|
212
|
+
* @param documentId - The id of the document
|
|
213
|
+
* @returns the content of the document
|
|
214
|
+
*/
|
|
215
|
+
getContent(documentId: string): Promise<ApiResponse<ContentResponse>>;
|
|
216
|
+
/**
|
|
217
|
+
* get the actions of a document
|
|
218
|
+
* @param documentId - The id of the document
|
|
219
|
+
* @returns the actions of the document
|
|
220
|
+
*/
|
|
221
|
+
getContentActions(documentId: string): Promise<ApiResponse<ContentActionsResponse>>;
|
|
222
|
+
/**
|
|
223
|
+
* checks if a receiver is existing in Brifle
|
|
224
|
+
* @param receiver - The receiver object to check
|
|
225
|
+
* @returns
|
|
226
|
+
*/
|
|
227
|
+
checkReceiver(receiver: ReceiverRequest): Promise<ApiResponse<CheckReceiverResponse>>;
|
|
228
|
+
/**
|
|
229
|
+
* send a content to a receiver
|
|
230
|
+
* @param tenantId - The tenant id of the receiver
|
|
231
|
+
* @param request - The request object to send
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
234
|
+
sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface CreateSignatureReferenceRequest {
|
|
238
|
+
fields: {
|
|
239
|
+
name: string;
|
|
240
|
+
purpose: string;
|
|
241
|
+
role: string;
|
|
242
|
+
}[];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface CreateSignatureReferenceResponse {
|
|
246
|
+
id: string;
|
|
247
|
+
managed_by: string;
|
|
248
|
+
signature_fields: {
|
|
249
|
+
name: string;
|
|
250
|
+
purpose: string;
|
|
251
|
+
role: string;
|
|
252
|
+
}[];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare class SignaturesEndpoint {
|
|
256
|
+
private endpoint;
|
|
257
|
+
private readonly VERSION;
|
|
258
|
+
private state;
|
|
259
|
+
constructor(api: ApiV1);
|
|
260
|
+
/**
|
|
261
|
+
* builds the full path
|
|
262
|
+
* @param path - The path to the endpoint, e.g. "authentication/login"
|
|
263
|
+
* @returns
|
|
264
|
+
*/
|
|
265
|
+
private getPath;
|
|
266
|
+
/**
|
|
267
|
+
* creates a signature reference
|
|
268
|
+
* @param tenantId - The id of the tenant
|
|
269
|
+
* @param request - The request object
|
|
270
|
+
* @returns the response object
|
|
271
|
+
*/
|
|
272
|
+
createSignatureReference(tenantId: string, request: CreateSignatureReferenceRequest): Promise<ApiResponse<CreateSignatureReferenceResponse>>;
|
|
273
|
+
/**
|
|
274
|
+
* gets a signature reference
|
|
275
|
+
* @param signatureId - The id of the signature
|
|
276
|
+
* @returns the response object
|
|
277
|
+
*/
|
|
278
|
+
exportSignature(signatureId: string, format: 'xml'): Promise<ApiResponse<any>>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
declare class ApiV1 {
|
|
282
|
+
readonly endpoint: string;
|
|
283
|
+
readonly apiState: ApiV1State;
|
|
284
|
+
constructor(endpoint: string);
|
|
285
|
+
static get sandbox(): ApiV1;
|
|
286
|
+
static get production(): ApiV1;
|
|
287
|
+
/**
|
|
288
|
+
* gets an instance of the AuthenticationEndpoints
|
|
289
|
+
* @returns AuthenticationEndpoints
|
|
290
|
+
*/
|
|
291
|
+
authentication(): AuthenticationEndpoints;
|
|
292
|
+
/**
|
|
293
|
+
* gets an instance of the ContentEndpoints
|
|
294
|
+
* @returns ContentEndpoints
|
|
295
|
+
*/
|
|
296
|
+
content(): ContentEndpoints;
|
|
297
|
+
/**
|
|
298
|
+
* gets an instance of the SignatureEndpoints
|
|
299
|
+
* @returns ContentEndpoints
|
|
300
|
+
*/
|
|
301
|
+
signature(): SignaturesEndpoint;
|
|
302
|
+
}
|
|
303
|
+
interface ApiV1State {
|
|
304
|
+
auth_token?: string;
|
|
305
|
+
auth_token_expire_date?: Date;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, SignaturesEndpoint };
|
|
309
|
+
export type { ApiV1State, BirthInformation, CheckReceiverResponse, ContentActionsResponse, ContentMeta, ContentResponse, CreateSignatureReferenceRequest, CreateSignatureReferenceResponse, ErrorResponse, LoginRequest, LoginResponse, LogoutRequest, PaymentDetails, ReceiverRequest, SendContentRequest, SendContentResponse };
|
|
@@ -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,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,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,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";
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@brifle/brifle-sdk",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "The JavaScript SDK to interact with the API of Brifle",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"README",
|
|
8
|
+
"LICENSE"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/cjs/index.js",
|
|
12
|
+
"module": "./dist/esm/index.mjs",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/esm/index.mjs",
|
|
16
|
+
"require": "./dist/cjs/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "jest --setupFiles dotenv/config",
|
|
23
|
+
"test-jest": "jest",
|
|
24
|
+
"rollup": "tsc --project tsconfig.types.json && rollup -c",
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"publish": "npm run rollup && npm publish --access public"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"Brifle"
|
|
30
|
+
],
|
|
31
|
+
"author": "Brifle GmbH",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/jest": "^29.5.14",
|
|
35
|
+
"@types/node": "^20.4.3",
|
|
36
|
+
"jest": "^29.5.0",
|
|
37
|
+
"rollup": "^4.40.0",
|
|
38
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
39
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
40
|
+
"ts-jest": "^29.3.1",
|
|
41
|
+
"ts-node": "^10.9.1",
|
|
42
|
+
"typescript": "^5.8.3"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"axios": "^1.8.4",
|
|
46
|
+
"dotenv": "^16.1.4"
|
|
47
|
+
}
|
|
48
|
+
}
|