repzo 1.0.111 → 1.0.113
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/lib/index.d.ts +10 -0
- package/lib/index.js +39 -0
- package/lib/types/index.d.ts +21 -0
- package/package.json +1 -1
- package/src/index.ts +51 -0
- package/src/types/index.ts +18 -0
package/lib/index.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export default class Repzo {
|
|
|
84
84
|
readonly OCR_INVOICE_JOB: "ocr-invoice-job";
|
|
85
85
|
readonly OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page";
|
|
86
86
|
readonly SETTINGS: "settings";
|
|
87
|
+
readonly MAIL_UNSUBSCRIBE: "mail-unsubscribe";
|
|
87
88
|
};
|
|
88
89
|
private _fetch;
|
|
89
90
|
private _create;
|
|
@@ -1306,4 +1307,13 @@ export default class Repzo {
|
|
|
1306
1307
|
body: Service.Settings.Update.Body
|
|
1307
1308
|
) => Promise<Service.Settings.Update.Result>;
|
|
1308
1309
|
};
|
|
1310
|
+
mailUnsubscribe: {
|
|
1311
|
+
_path: "mail-unsubscribe";
|
|
1312
|
+
get: (
|
|
1313
|
+
id: Service.MailUnsubsrcibe.Get.ID
|
|
1314
|
+
) => Promise<Service.MailUnsubsrcibe.Get.Result>;
|
|
1315
|
+
create: (
|
|
1316
|
+
params: Service.MailUnsubsrcibe.Create.Params
|
|
1317
|
+
) => Promise<Service.MailUnsubsrcibe.Create.Result>;
|
|
1318
|
+
};
|
|
1309
1319
|
}
|
package/lib/index.js
CHANGED
|
@@ -73,6 +73,7 @@ export default class Repzo {
|
|
|
73
73
|
OCR_INVOICE_JOB: "ocr-invoice-job",
|
|
74
74
|
OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page",
|
|
75
75
|
SETTINGS: "settings",
|
|
76
|
+
MAIL_UNSUBSCRIBE: "mail-unsubscribe",
|
|
76
77
|
};
|
|
77
78
|
this.END_POINTS = this._end_points;
|
|
78
79
|
this.client = {
|
|
@@ -2405,6 +2406,24 @@ export default class Repzo {
|
|
|
2405
2406
|
return res;
|
|
2406
2407
|
},
|
|
2407
2408
|
};
|
|
2409
|
+
this.mailUnsubscribe = {
|
|
2410
|
+
_path: this._end_points.MAIL_UNSUBSCRIBE,
|
|
2411
|
+
get: async (id) => {
|
|
2412
|
+
return await this._fetch(
|
|
2413
|
+
this.svAPIEndpoint,
|
|
2414
|
+
this.ocrInvoiceJobPage._path + `/${id}`
|
|
2415
|
+
);
|
|
2416
|
+
},
|
|
2417
|
+
create: async (params) => {
|
|
2418
|
+
let res = await this._create(
|
|
2419
|
+
this.svAPIEndpoint,
|
|
2420
|
+
this.activityAiSalesOrder._path,
|
|
2421
|
+
{},
|
|
2422
|
+
params
|
|
2423
|
+
);
|
|
2424
|
+
return res;
|
|
2425
|
+
},
|
|
2426
|
+
};
|
|
2408
2427
|
this.svAPIEndpoint =
|
|
2409
2428
|
!options?.env || options?.env == "production"
|
|
2410
2429
|
? "https://sv.api.repzo.me"
|
|
@@ -2426,6 +2445,9 @@ export default class Repzo {
|
|
|
2426
2445
|
}
|
|
2427
2446
|
}
|
|
2428
2447
|
async _fetch(baseUrl, path, params) {
|
|
2448
|
+
if (params) {
|
|
2449
|
+
params = normalizeParams(params);
|
|
2450
|
+
}
|
|
2429
2451
|
let res = await axios.get(`${baseUrl}/${path}`, {
|
|
2430
2452
|
params,
|
|
2431
2453
|
headers: this.headers,
|
|
@@ -2762,3 +2784,20 @@ Repzo.CommandLog = class {
|
|
|
2762
2784
|
return this;
|
|
2763
2785
|
}
|
|
2764
2786
|
};
|
|
2787
|
+
function normalizeParams(params) {
|
|
2788
|
+
const normalized = {};
|
|
2789
|
+
for (const key in params) {
|
|
2790
|
+
const value = params[key];
|
|
2791
|
+
if (value === undefined || value === null) continue;
|
|
2792
|
+
if (
|
|
2793
|
+
typeof value === "object" &&
|
|
2794
|
+
!(value instanceof Date) &&
|
|
2795
|
+
!(value instanceof String)
|
|
2796
|
+
) {
|
|
2797
|
+
normalized[key] = JSON.stringify(value);
|
|
2798
|
+
} else {
|
|
2799
|
+
normalized[key] = value;
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
return normalized;
|
|
2803
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -12366,6 +12366,27 @@ export declare namespace Service {
|
|
|
12366
12366
|
type Result = Data;
|
|
12367
12367
|
}
|
|
12368
12368
|
}
|
|
12369
|
+
namespace MailUnsubsrcibe {
|
|
12370
|
+
interface Data {
|
|
12371
|
+
message: string;
|
|
12372
|
+
success?: boolean;
|
|
12373
|
+
}
|
|
12374
|
+
namespace Get {
|
|
12375
|
+
type ID = string;
|
|
12376
|
+
type Result = {
|
|
12377
|
+
message: string;
|
|
12378
|
+
};
|
|
12379
|
+
}
|
|
12380
|
+
namespace Create {
|
|
12381
|
+
type Params = {
|
|
12382
|
+
token: string;
|
|
12383
|
+
};
|
|
12384
|
+
type Result = {
|
|
12385
|
+
message: string;
|
|
12386
|
+
success: boolean;
|
|
12387
|
+
};
|
|
12388
|
+
}
|
|
12389
|
+
}
|
|
12369
12390
|
}
|
|
12370
12391
|
export type StringId = string;
|
|
12371
12392
|
export type NameSpaces = string[];
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -108,9 +108,13 @@ export default class Repzo {
|
|
|
108
108
|
OCR_INVOICE_JOB: "ocr-invoice-job",
|
|
109
109
|
OCR_INVOICE_JOB_PAGE: "ocr-invoice-job-page",
|
|
110
110
|
SETTINGS: "settings",
|
|
111
|
+
MAIL_UNSUBSCRIBE: "mail-unsubscribe",
|
|
111
112
|
} as const;
|
|
112
113
|
public END_POINTS = this._end_points;
|
|
113
114
|
private async _fetch(baseUrl: string, path: string, params?: Params) {
|
|
115
|
+
if (params) {
|
|
116
|
+
params = normalizeParams(params);
|
|
117
|
+
}
|
|
114
118
|
let res = await axios.get(`${baseUrl}/${path}`, {
|
|
115
119
|
params,
|
|
116
120
|
headers: this.headers,
|
|
@@ -3712,4 +3716,51 @@ export default class Repzo {
|
|
|
3712
3716
|
return res;
|
|
3713
3717
|
},
|
|
3714
3718
|
};
|
|
3719
|
+
|
|
3720
|
+
mailUnsubscribe = {
|
|
3721
|
+
_path: this._end_points.MAIL_UNSUBSCRIBE,
|
|
3722
|
+
|
|
3723
|
+
get: async (
|
|
3724
|
+
id: Service.MailUnsubsrcibe.Get.ID
|
|
3725
|
+
): Promise<Service.MailUnsubsrcibe.Get.Result> => {
|
|
3726
|
+
return await this._fetch(
|
|
3727
|
+
this.svAPIEndpoint,
|
|
3728
|
+
this.ocrInvoiceJobPage._path + `/${id}`
|
|
3729
|
+
);
|
|
3730
|
+
},
|
|
3731
|
+
|
|
3732
|
+
create: async (
|
|
3733
|
+
params: Service.MailUnsubsrcibe.Create.Params
|
|
3734
|
+
): Promise<Service.MailUnsubsrcibe.Create.Result> => {
|
|
3735
|
+
let res = await this._create(
|
|
3736
|
+
this.svAPIEndpoint,
|
|
3737
|
+
this.activityAiSalesOrder._path,
|
|
3738
|
+
{},
|
|
3739
|
+
params
|
|
3740
|
+
);
|
|
3741
|
+
return res;
|
|
3742
|
+
},
|
|
3743
|
+
};
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
function normalizeParams(params: Params): { [key: string]: any } {
|
|
3747
|
+
const normalized: Record<string, any> = {};
|
|
3748
|
+
|
|
3749
|
+
for (const key in params) {
|
|
3750
|
+
const value = params[key];
|
|
3751
|
+
|
|
3752
|
+
if (value === undefined || value === null) continue;
|
|
3753
|
+
|
|
3754
|
+
if (
|
|
3755
|
+
typeof value === "object" &&
|
|
3756
|
+
!(value instanceof Date) &&
|
|
3757
|
+
!(value instanceof String)
|
|
3758
|
+
) {
|
|
3759
|
+
normalized[key] = JSON.stringify(value);
|
|
3760
|
+
} else {
|
|
3761
|
+
normalized[key] = value;
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
|
|
3765
|
+
return normalized;
|
|
3715
3766
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -11921,6 +11921,24 @@ export namespace Service {
|
|
|
11921
11921
|
export type Result = Data;
|
|
11922
11922
|
}
|
|
11923
11923
|
}
|
|
11924
|
+
|
|
11925
|
+
export namespace MailUnsubsrcibe {
|
|
11926
|
+
export interface Data {
|
|
11927
|
+
message: string;
|
|
11928
|
+
success?: boolean;
|
|
11929
|
+
}
|
|
11930
|
+
export namespace Get {
|
|
11931
|
+
export type ID = string;
|
|
11932
|
+
export type Result = { message: string };
|
|
11933
|
+
}
|
|
11934
|
+
|
|
11935
|
+
export namespace Create {
|
|
11936
|
+
export type Params = {
|
|
11937
|
+
token: string;
|
|
11938
|
+
};
|
|
11939
|
+
export type Result = { message: string; success: boolean };
|
|
11940
|
+
}
|
|
11941
|
+
}
|
|
11924
11942
|
}
|
|
11925
11943
|
|
|
11926
11944
|
export type StringId = string;
|