@brifle/brifle-sdk 0.0.3 → 0.0.4

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.
@@ -1,6 +1,7 @@
1
1
  import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
2
  import { ContentEndpoints } from "../endpoints/v1/content";
3
3
  import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
+ import { MailboxEndpoints } from "../endpoints/v1/mailbox";
4
5
  declare class ApiV1 {
5
6
  readonly endpoint: string;
6
7
  readonly apiState: ApiV1State;
@@ -22,6 +23,11 @@ declare class ApiV1 {
22
23
  * @returns ContentEndpoints
23
24
  */
24
25
  signature(): SignaturesEndpoint;
26
+ /**
27
+ * gets an instance of the MailboxEndpoints
28
+ * @returns MailboxEndpoints
29
+ */
30
+ mailbox(): MailboxEndpoints;
25
31
  }
26
32
  export interface ApiV1State {
27
33
  auth_token?: string;
@@ -0,0 +1,18 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { InboxFilter, OutboxFilter } from "./requests/mailbox";
3
+ import { MailboxResponse } from "./responses/mailbox";
4
+ import { ApiResponse } from "./apiResponse";
5
+ declare class MailboxEndpoints {
6
+ private endpoint;
7
+ private readonly VERSION;
8
+ private state;
9
+ constructor(api: ApiV1);
10
+ private getPath;
11
+ /**
12
+ * Get the inbox of an account
13
+ * @returns the mailbox response object
14
+ */
15
+ getInbox(filter: InboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
16
+ getOutbox(tenant: string, filter: OutboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
17
+ }
18
+ export { MailboxEndpoints };
@@ -0,0 +1,10 @@
1
+ interface InboxFilter {
2
+ state?: Array<'read' | 'unread' | 'trashed'>;
3
+ subject?: string;
4
+ sub_mailbox?: string;
5
+ type?: 'letter' | 'invoice' | 'contract';
6
+ }
7
+ interface OutboxFilter {
8
+ state?: Array<'active' | 'trashed'>;
9
+ }
10
+ export type { InboxFilter, OutboxFilter };
@@ -0,0 +1,21 @@
1
+ interface MailboxResponse {
2
+ total: number;
3
+ results: Meta[];
4
+ }
5
+ interface Meta {
6
+ id: string;
7
+ sender: string;
8
+ receiver: string;
9
+ read: boolean;
10
+ read_date: string;
11
+ size: number;
12
+ type: string;
13
+ delivered: boolean;
14
+ delivered_date: string;
15
+ sent_date: string;
16
+ subject: string;
17
+ sender_state?: string;
18
+ receiver_state?: string;
19
+ size_responsive?: number;
20
+ }
21
+ export type { MailboxResponse, Meta };
@@ -9,3 +9,6 @@ export * from "./endpoints/v1/apiResponse";
9
9
  export * from "./endpoints/v1/authentication";
10
10
  export * from "./endpoints/v1/content";
11
11
  export * from "./endpoints/v1/signatures";
12
+ export * from "./endpoints/v1/mailbox";
13
+ export * from "./endpoints/v1/requests/mailbox";
14
+ export * from "./endpoints/v1/responses/mailbox";
package/dist/cjs/index.js CHANGED
@@ -254,6 +254,59 @@ class SignaturesEndpoint {
254
254
  }
255
255
  }
256
256
 
257
+ class MailboxEndpoints {
258
+ constructor(api) {
259
+ this.VERSION = "v1";
260
+ this.endpoint = api.endpoint;
261
+ this.state = api.apiState;
262
+ }
263
+ getPath(path) {
264
+ return `${this.endpoint}/${this.VERSION}/mailbox/${path}`;
265
+ }
266
+ /**
267
+ * Get the inbox of an account
268
+ * @returns the mailbox response object
269
+ */
270
+ getInbox(filter, page = 1) {
271
+ const path = this.getPath(`inbox`);
272
+ const body = {
273
+ filter: filter,
274
+ page: page
275
+ };
276
+ return axios.post(path, body, {
277
+ headers: {
278
+ "Authorization": `Bearer ${this.state.auth_token}`,
279
+ "Content-Type": "application/json"
280
+ }
281
+ })
282
+ .then((response) => {
283
+ return ApiResponse.success(response.data);
284
+ })
285
+ .catch((error) => {
286
+ return ApiResponse.errorAxios(error);
287
+ });
288
+ }
289
+ getOutbox(tenant, filter, page = 1) {
290
+ const path = this.getPath(`outbox/${tenant}`);
291
+ const body = {
292
+ filter: filter,
293
+ page: page
294
+ };
295
+ return axios.post(path, body, {
296
+ headers: {
297
+ "Authorization": `Bearer ${this.state.auth_token}`,
298
+ "Content-Type": "application/json"
299
+ }
300
+ })
301
+ .then((response) => {
302
+ return ApiResponse.success(response.data);
303
+ })
304
+ .catch((error) => {
305
+ return ApiResponse.errorAxios(error);
306
+ });
307
+ }
308
+ }
309
+
257
310
  var ENDPOINTS;
258
311
  (function (ENDPOINTS) {
259
312
  ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
@@ -296,11 +349,19 @@ class ApiV1 {
296
349
  signature() {
297
350
  return new SignaturesEndpoint(this);
298
351
  }
352
+ /**
353
+ * gets an instance of the MailboxEndpoints
354
+ * @returns MailboxEndpoints
355
+ */
356
+ mailbox() {
357
+ return new MailboxEndpoints(this);
358
+ }
299
359
  }
300
360
 
301
361
  exports.ApiResponse = ApiResponse;
302
362
  exports.ApiV1 = ApiV1;
303
363
  exports.AuthenticationEndpoints = AuthenticationEndpoints;
304
364
  exports.ContentEndpoints = ContentEndpoints;
365
+ exports.MailboxEndpoints = MailboxEndpoints;
305
366
  exports.SignaturesEndpoint = SignaturesEndpoint;
306
367
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
2
  import { ContentEndpoints } from "../endpoints/v1/content";
3
3
  import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
+ import { MailboxEndpoints } from "../endpoints/v1/mailbox";
4
5
  declare class ApiV1 {
5
6
  readonly endpoint: string;
6
7
  readonly apiState: ApiV1State;
@@ -22,6 +23,11 @@ declare class ApiV1 {
22
23
  * @returns ContentEndpoints
23
24
  */
24
25
  signature(): SignaturesEndpoint;
26
+ /**
27
+ * gets an instance of the MailboxEndpoints
28
+ * @returns MailboxEndpoints
29
+ */
30
+ mailbox(): MailboxEndpoints;
25
31
  }
26
32
  export interface ApiV1State {
27
33
  auth_token?: string;
@@ -0,0 +1,18 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { InboxFilter, OutboxFilter } from "./requests/mailbox";
3
+ import { MailboxResponse } from "./responses/mailbox";
4
+ import { ApiResponse } from "./apiResponse";
5
+ declare class MailboxEndpoints {
6
+ private endpoint;
7
+ private readonly VERSION;
8
+ private state;
9
+ constructor(api: ApiV1);
10
+ private getPath;
11
+ /**
12
+ * Get the inbox of an account
13
+ * @returns the mailbox response object
14
+ */
15
+ getInbox(filter: InboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
16
+ getOutbox(tenant: string, filter: OutboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
17
+ }
18
+ export { MailboxEndpoints };
@@ -0,0 +1,10 @@
1
+ interface InboxFilter {
2
+ state?: Array<'read' | 'unread' | 'trashed'>;
3
+ subject?: string;
4
+ sub_mailbox?: string;
5
+ type?: 'letter' | 'invoice' | 'contract';
6
+ }
7
+ interface OutboxFilter {
8
+ state?: Array<'active' | 'trashed'>;
9
+ }
10
+ export type { InboxFilter, OutboxFilter };
@@ -0,0 +1,21 @@
1
+ interface MailboxResponse {
2
+ total: number;
3
+ results: Meta[];
4
+ }
5
+ interface Meta {
6
+ id: string;
7
+ sender: string;
8
+ receiver: string;
9
+ read: boolean;
10
+ read_date: string;
11
+ size: number;
12
+ type: string;
13
+ delivered: boolean;
14
+ delivered_date: string;
15
+ sent_date: string;
16
+ subject: string;
17
+ sender_state?: string;
18
+ receiver_state?: string;
19
+ size_responsive?: number;
20
+ }
21
+ export type { MailboxResponse, Meta };
@@ -9,3 +9,6 @@ export * from "./endpoints/v1/apiResponse";
9
9
  export * from "./endpoints/v1/authentication";
10
10
  export * from "./endpoints/v1/content";
11
11
  export * from "./endpoints/v1/signatures";
12
+ export * from "./endpoints/v1/mailbox";
13
+ export * from "./endpoints/v1/requests/mailbox";
14
+ export * from "./endpoints/v1/responses/mailbox";
@@ -252,6 +252,59 @@ class SignaturesEndpoint {
252
252
  }
253
253
  }
254
254
 
255
+ class MailboxEndpoints {
256
+ constructor(api) {
257
+ this.VERSION = "v1";
258
+ this.endpoint = api.endpoint;
259
+ this.state = api.apiState;
260
+ }
261
+ getPath(path) {
262
+ return `${this.endpoint}/${this.VERSION}/mailbox/${path}`;
263
+ }
264
+ /**
265
+ * Get the inbox of an account
266
+ * @returns the mailbox response object
267
+ */
268
+ getInbox(filter, page = 1) {
269
+ const path = this.getPath(`inbox`);
270
+ const body = {
271
+ filter: filter,
272
+ page: page
273
+ };
274
+ return axios.post(path, body, {
275
+ headers: {
276
+ "Authorization": `Bearer ${this.state.auth_token}`,
277
+ "Content-Type": "application/json"
278
+ }
279
+ })
280
+ .then((response) => {
281
+ return ApiResponse.success(response.data);
282
+ })
283
+ .catch((error) => {
284
+ return ApiResponse.errorAxios(error);
285
+ });
286
+ }
287
+ getOutbox(tenant, filter, page = 1) {
288
+ const path = this.getPath(`outbox/${tenant}`);
289
+ const body = {
290
+ filter: filter,
291
+ page: page
292
+ };
293
+ return axios.post(path, body, {
294
+ headers: {
295
+ "Authorization": `Bearer ${this.state.auth_token}`,
296
+ "Content-Type": "application/json"
297
+ }
298
+ })
299
+ .then((response) => {
300
+ return ApiResponse.success(response.data);
301
+ })
302
+ .catch((error) => {
303
+ return ApiResponse.errorAxios(error);
304
+ });
305
+ }
306
+ }
307
+
255
308
  var ENDPOINTS;
256
309
  (function (ENDPOINTS) {
257
310
  ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
@@ -294,7 +347,14 @@ class ApiV1 {
294
347
  signature() {
295
348
  return new SignaturesEndpoint(this);
296
349
  }
350
+ /**
351
+ * gets an instance of the MailboxEndpoints
352
+ * @returns MailboxEndpoints
353
+ */
354
+ mailbox() {
355
+ return new MailboxEndpoints(this);
356
+ }
297
357
  }
298
358
 
299
- export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, SignaturesEndpoint };
359
+ export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint };
300
360
  //# 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
@@ -278,6 +278,51 @@ declare class SignaturesEndpoint {
278
278
  exportSignature(signatureId: string, format: 'xml'): Promise<ApiResponse<any>>;
279
279
  }
280
280
 
281
+ interface InboxFilter {
282
+ state?: Array<'read' | 'unread' | 'trashed'>;
283
+ subject?: string;
284
+ sub_mailbox?: string;
285
+ type?: 'letter' | 'invoice' | 'contract';
286
+ }
287
+ interface OutboxFilter {
288
+ state?: Array<'active' | 'trashed'>;
289
+ }
290
+
291
+ interface MailboxResponse {
292
+ total: number;
293
+ results: Meta[];
294
+ }
295
+ interface Meta {
296
+ id: string;
297
+ sender: string;
298
+ receiver: string;
299
+ read: boolean;
300
+ read_date: string;
301
+ size: number;
302
+ type: string;
303
+ delivered: boolean;
304
+ delivered_date: string;
305
+ sent_date: string;
306
+ subject: string;
307
+ sender_state?: string;
308
+ receiver_state?: string;
309
+ size_responsive?: number;
310
+ }
311
+
312
+ declare class MailboxEndpoints {
313
+ private endpoint;
314
+ private readonly VERSION;
315
+ private state;
316
+ constructor(api: ApiV1);
317
+ private getPath;
318
+ /**
319
+ * Get the inbox of an account
320
+ * @returns the mailbox response object
321
+ */
322
+ getInbox(filter: InboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
323
+ getOutbox(tenant: string, filter: OutboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
324
+ }
325
+
281
326
  declare class ApiV1 {
282
327
  readonly endpoint: string;
283
328
  readonly apiState: ApiV1State;
@@ -299,11 +344,16 @@ declare class ApiV1 {
299
344
  * @returns ContentEndpoints
300
345
  */
301
346
  signature(): SignaturesEndpoint;
347
+ /**
348
+ * gets an instance of the MailboxEndpoints
349
+ * @returns MailboxEndpoints
350
+ */
351
+ mailbox(): MailboxEndpoints;
302
352
  }
303
353
  interface ApiV1State {
304
354
  auth_token?: string;
305
355
  auth_token_expire_date?: Date;
306
356
  }
307
357
 
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 };
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 };
@@ -1,6 +1,7 @@
1
1
  import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
2
2
  import { ContentEndpoints } from "../endpoints/v1/content";
3
3
  import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
+ import { MailboxEndpoints } from "../endpoints/v1/mailbox";
4
5
  declare class ApiV1 {
5
6
  readonly endpoint: string;
6
7
  readonly apiState: ApiV1State;
@@ -22,6 +23,11 @@ declare class ApiV1 {
22
23
  * @returns ContentEndpoints
23
24
  */
24
25
  signature(): SignaturesEndpoint;
26
+ /**
27
+ * gets an instance of the MailboxEndpoints
28
+ * @returns MailboxEndpoints
29
+ */
30
+ mailbox(): MailboxEndpoints;
25
31
  }
26
32
  export interface ApiV1State {
27
33
  auth_token?: string;
@@ -0,0 +1,18 @@
1
+ import { ApiV1 } from "../../api/api";
2
+ import { InboxFilter, OutboxFilter } from "./requests/mailbox";
3
+ import { MailboxResponse } from "./responses/mailbox";
4
+ import { ApiResponse } from "./apiResponse";
5
+ declare class MailboxEndpoints {
6
+ private endpoint;
7
+ private readonly VERSION;
8
+ private state;
9
+ constructor(api: ApiV1);
10
+ private getPath;
11
+ /**
12
+ * Get the inbox of an account
13
+ * @returns the mailbox response object
14
+ */
15
+ getInbox(filter: InboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
16
+ getOutbox(tenant: string, filter: OutboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
17
+ }
18
+ export { MailboxEndpoints };
@@ -0,0 +1,10 @@
1
+ interface InboxFilter {
2
+ state?: Array<'read' | 'unread' | 'trashed'>;
3
+ subject?: string;
4
+ sub_mailbox?: string;
5
+ type?: 'letter' | 'invoice' | 'contract';
6
+ }
7
+ interface OutboxFilter {
8
+ state?: Array<'active' | 'trashed'>;
9
+ }
10
+ export type { InboxFilter, OutboxFilter };
@@ -0,0 +1,21 @@
1
+ interface MailboxResponse {
2
+ total: number;
3
+ results: Meta[];
4
+ }
5
+ interface Meta {
6
+ id: string;
7
+ sender: string;
8
+ receiver: string;
9
+ read: boolean;
10
+ read_date: string;
11
+ size: number;
12
+ type: string;
13
+ delivered: boolean;
14
+ delivered_date: string;
15
+ sent_date: string;
16
+ subject: string;
17
+ sender_state?: string;
18
+ receiver_state?: string;
19
+ size_responsive?: number;
20
+ }
21
+ export type { MailboxResponse, Meta };
@@ -9,3 +9,6 @@ export * from "./endpoints/v1/apiResponse";
9
9
  export * from "./endpoints/v1/authentication";
10
10
  export * from "./endpoints/v1/content";
11
11
  export * from "./endpoints/v1/signatures";
12
+ export * from "./endpoints/v1/mailbox";
13
+ export * from "./endpoints/v1/requests/mailbox";
14
+ export * from "./endpoints/v1/responses/mailbox";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brifle/brifle-sdk",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "The JavaScript SDK to interact with the API of Brifle",
5
5
  "files": [
6
6
  "dist",