@sinch/fax 1.2.1 → 1.4.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.
- package/dist/models/v3/bar-code/bar-code.d.ts +2 -1
- package/dist/models/v3/cover-page/cover-page.d.ts +25 -0
- package/dist/models/v3/{service-email-settings/service-email-settings.js → cover-page/cover-page.js} +1 -1
- package/dist/models/v3/cover-page/cover-page.js.map +1 -0
- package/dist/models/v3/cover-page/index.d.ts +1 -0
- package/dist/models/v3/cover-page/index.js +3 -0
- package/dist/models/v3/cover-page/index.js.map +1 -0
- package/dist/models/v3/cover-page-file/cover-page-file.d.ts +9 -0
- package/dist/models/v3/{requests/emails/emails-request-data.js → cover-page-file/cover-page-file.js} +1 -1
- package/dist/models/v3/cover-page-file/cover-page-file.js.map +1 -0
- package/dist/models/v3/cover-page-file/index.d.ts +1 -0
- package/dist/models/v3/cover-page-file/index.js.map +1 -0
- package/dist/models/v3/date-range-filter/date-range-filter.d.ts +2 -2
- package/dist/models/v3/email/email.d.ts +7 -2
- package/dist/models/v3/enums.d.ts +26 -7
- package/dist/models/v3/enums.js +1 -1
- package/dist/models/v3/enums.js.map +1 -1
- package/dist/models/v3/errors/call-error/call-error.d.ts +13 -0
- package/dist/models/v3/errors/call-error/call-error.js +16 -0
- package/dist/models/v3/errors/call-error/call-error.js.map +1 -0
- package/dist/models/v3/errors/call-error/index.d.ts +2 -0
- package/dist/models/v3/errors/call-error/index.js +6 -0
- package/dist/models/v3/errors/call-error/index.js.map +1 -0
- package/dist/models/v3/errors/document-conversion-error/document-conversion-error.d.ts +13 -0
- package/dist/models/v3/errors/document-conversion-error/document-conversion-error.js +16 -0
- package/dist/models/v3/errors/document-conversion-error/document-conversion-error.js.map +1 -0
- package/dist/models/v3/errors/document-conversion-error/index.d.ts +2 -0
- package/dist/models/v3/errors/document-conversion-error/index.js +6 -0
- package/dist/models/v3/errors/document-conversion-error/index.js.map +1 -0
- package/dist/models/v3/errors/fax-error/fax-error.d.ts +13 -0
- package/dist/models/v3/errors/fax-error/fax-error.js +46 -0
- package/dist/models/v3/errors/fax-error/fax-error.js.map +1 -0
- package/dist/models/v3/errors/fax-error/index.d.ts +2 -0
- package/dist/models/v3/errors/fax-error/index.js +6 -0
- package/dist/models/v3/errors/fax-error/index.js.map +1 -0
- package/dist/models/v3/errors/index.d.ts +3 -0
- package/dist/models/v3/errors/index.js +20 -0
- package/dist/models/v3/errors/index.js.map +1 -0
- package/dist/models/v3/fax/fax.d.ts +19 -9
- package/dist/models/v3/fax-request/fax-request.d.ts +9 -1
- package/dist/models/v3/helper.js +5 -1
- package/dist/models/v3/helper.js.map +1 -1
- package/dist/models/v3/index.d.ts +4 -1
- package/dist/models/v3/index.js +4 -1
- package/dist/models/v3/index.js.map +1 -1
- package/dist/models/v3/number-with-permissions/index.d.ts +1 -0
- package/dist/models/v3/number-with-permissions/index.js +3 -0
- package/dist/models/v3/number-with-permissions/index.js.map +1 -0
- package/dist/models/v3/number-with-permissions/number-with-permissions.d.ts +10 -0
- package/dist/models/v3/number-with-permissions/number-with-permissions.js +3 -0
- package/dist/models/v3/number-with-permissions/number-with-permissions.js.map +1 -0
- package/dist/models/v3/requests/cover-pages/cover-pages-request-data.d.ts +27 -0
- package/dist/models/v3/requests/cover-pages/cover-pages-request-data.js +3 -0
- package/dist/models/v3/requests/cover-pages/cover-pages-request-data.js.map +1 -0
- package/dist/models/v3/requests/{emails/emails-request-data.d.ts → fax-to-email/fax-to-email-request-data.d.ts} +10 -0
- package/dist/models/v3/requests/fax-to-email/fax-to-email-request-data.js +3 -0
- package/dist/models/v3/requests/fax-to-email/fax-to-email-request-data.js.map +1 -0
- package/dist/models/v3/requests/faxes/faxes-request-data.d.ts +2 -0
- package/dist/models/v3/requests/index.d.ts +2 -1
- package/dist/models/v3/requests/index.js +2 -1
- package/dist/models/v3/requests/index.js.map +1 -1
- package/dist/models/v3/service/service.d.ts +9 -6
- package/dist/models/v3/service-phone-number/service-phone-number.d.ts +3 -0
- package/dist/models/v3/update-email-request/update-email-request.d.ts +2 -1
- package/dist/rest/v3/callbacks/callbacks-webhook.d.ts +7 -0
- package/dist/rest/v3/callbacks/callbacks-webhook.js +13 -0
- package/dist/rest/v3/callbacks/callbacks-webhook.js.map +1 -1
- package/dist/rest/v3/cover-pages/cover-pages-api.d.ts +32 -0
- package/dist/rest/v3/cover-pages/cover-pages-api.jest.fixture.d.ts +21 -0
- package/dist/rest/v3/cover-pages/cover-pages-api.jest.fixture.js +25 -0
- package/dist/rest/v3/cover-pages/cover-pages-api.jest.fixture.js.map +1 -0
- package/dist/rest/v3/cover-pages/cover-pages-api.js +105 -0
- package/dist/rest/v3/cover-pages/cover-pages-api.js.map +1 -0
- package/dist/rest/v3/cover-pages/index.d.ts +2 -0
- package/dist/rest/v3/{emails → cover-pages}/index.js +2 -2
- package/dist/rest/v3/cover-pages/index.js.map +1 -0
- package/dist/rest/v3/fax-domain-api.d.ts +15 -16
- package/dist/rest/v3/fax-domain-api.js +28 -41
- package/dist/rest/v3/fax-domain-api.js.map +1 -1
- package/dist/rest/v3/fax-service.d.ts +22 -17
- package/dist/rest/v3/fax-service.js +60 -25
- package/dist/rest/v3/fax-service.js.map +1 -1
- package/dist/rest/v3/{emails/emails-api.d.ts → fax-to-email/fax-to-email-api.d.ts} +4 -8
- package/dist/rest/v3/{emails/emails-api.jest.fixture.d.ts → fax-to-email/fax-to-email-api.jest.fixture.d.ts} +2 -2
- package/dist/rest/v3/{emails/emails-api.jest.fixture.js → fax-to-email/fax-to-email-api.jest.fixture.js} +4 -4
- package/dist/rest/v3/fax-to-email/fax-to-email-api.jest.fixture.js.map +1 -0
- package/dist/rest/v3/{emails/emails-api.js → fax-to-email/fax-to-email-api.js} +12 -22
- package/dist/rest/v3/fax-to-email/fax-to-email-api.js.map +1 -0
- package/dist/rest/v3/fax-to-email/index.d.ts +2 -0
- package/dist/rest/v3/fax-to-email/index.js +19 -0
- package/dist/rest/v3/fax-to-email/index.js.map +1 -0
- package/dist/rest/v3/faxes/faxes-api.d.ts +4 -8
- package/dist/rest/v3/faxes/faxes-api.js +7 -16
- package/dist/rest/v3/faxes/faxes-api.js.map +1 -1
- package/dist/rest/v3/index.d.ts +3 -1
- package/dist/rest/v3/index.js +3 -1
- package/dist/rest/v3/index.js.map +1 -1
- package/dist/rest/v3/services/services-api.d.ts +4 -8
- package/dist/rest/v3/services/services-api.js +3 -17
- package/dist/rest/v3/services/services-api.js.map +1 -1
- package/package.json +2 -2
- package/dist/models/v3/requests/emails/emails-request-data.js.map +0 -1
- package/dist/models/v3/service-email-settings/index.d.ts +0 -1
- package/dist/models/v3/service-email-settings/index.js.map +0 -1
- package/dist/models/v3/service-email-settings/service-email-settings.d.ts +0 -6
- package/dist/models/v3/service-email-settings/service-email-settings.js.map +0 -1
- package/dist/rest/v3/emails/emails-api.jest.fixture.js.map +0 -1
- package/dist/rest/v3/emails/emails-api.js.map +0 -1
- package/dist/rest/v3/emails/index.d.ts +0 -2
- package/dist/rest/v3/emails/index.js.map +0 -1
- /package/dist/models/v3/{service-email-settings → cover-page-file}/index.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cover-pages-request-data.js","sourceRoot":"","sources":["../../../../../src/models/v3/requests/cover-pages/cover-pages-request-data.ts"],"names":[],"mappings":""}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { EmailRequest } from '../../email';
|
|
2
2
|
import { UpdateEmailRequest } from '../../update-email-request';
|
|
3
3
|
export interface AddEmailToNumbersRequestData {
|
|
4
|
+
/** The serviceId to which you want to add the email. */
|
|
5
|
+
'serviceId': string;
|
|
4
6
|
/** */
|
|
5
7
|
'emailRequestBody': EmailRequest;
|
|
6
8
|
}
|
|
7
9
|
export interface DeleteEmailRequestData {
|
|
10
|
+
/** The serviceId containing the email you want to work with. */
|
|
11
|
+
'serviceId': string;
|
|
8
12
|
/** The email you want to delete. */
|
|
9
13
|
'email': string;
|
|
10
14
|
}
|
|
11
15
|
export interface ListEmailsForProjectRequestData {
|
|
16
|
+
/** The serviceId containing the emails you want to list. */
|
|
17
|
+
'serviceId': string;
|
|
12
18
|
/** Number of items to return on each page. */
|
|
13
19
|
'pageSize'?: number;
|
|
14
20
|
/** Optional. The page to fetch. If not specified, the first page will be returned. */
|
|
15
21
|
'page'?: string;
|
|
16
22
|
}
|
|
17
23
|
export interface ListNumbersByEmailRequestData {
|
|
24
|
+
/** The serviceId containing the email you want to work with. */
|
|
25
|
+
'serviceId': string;
|
|
18
26
|
/** The email you want to get numbers for. */
|
|
19
27
|
'email': string;
|
|
20
28
|
/** Number of items to return on each page. */
|
|
@@ -23,6 +31,8 @@ export interface ListNumbersByEmailRequestData {
|
|
|
23
31
|
'page'?: string;
|
|
24
32
|
}
|
|
25
33
|
export interface UpdateEmailRequestData {
|
|
34
|
+
/** The serviceId containing the email you want to work with. */
|
|
35
|
+
'serviceId': string;
|
|
26
36
|
/** The email you want to work with. */
|
|
27
37
|
'email': string;
|
|
28
38
|
/** */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fax-to-email-request-data.js","sourceRoot":"","sources":["../../../../../src/models/v3/requests/fax-to-email/fax-to-email-request-data.ts"],"names":[],"mappings":""}
|
|
@@ -16,6 +16,8 @@ export interface GetFaxRequestData {
|
|
|
16
16
|
'id': string;
|
|
17
17
|
}
|
|
18
18
|
export interface ListFaxesRequestData {
|
|
19
|
+
/** Limits results to faxes that were sent using the specified service. */
|
|
20
|
+
'serviceId'?: string;
|
|
19
21
|
/** Filter calls based on `createTime`. It can be a year, a month or a day. */
|
|
20
22
|
'createTime'?: string | Date;
|
|
21
23
|
/** Filter calls based on `createTime`. It will filter the faxes on a range of dates. */
|
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./cover-pages/cover-pages-request-data"), exports);
|
|
18
|
+
__exportStar(require("./fax-to-email/fax-to-email-request-data"), exports);
|
|
18
19
|
__exportStar(require("./faxes/faxes-request-data"), exports);
|
|
19
20
|
__exportStar(require("./services/services-request-data"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v3/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v3/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yEAAuD;AACvD,2EAAyD;AACzD,6DAA2C;AAC3C,mEAAiD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ImageConversionMethod, WebhookContentType } from '../enums';
|
|
2
|
-
import { ServiceEmailSettings } from '../service-email-settings';
|
|
1
|
+
import { ImageConversionMethod, Resolution, WebhookContentType } from '../enums';
|
|
3
2
|
/**
|
|
4
3
|
* You can use the default created service, or create multiple services within the same project to have different default behavior for all your different faxing use cases.
|
|
5
4
|
*/
|
|
@@ -12,20 +11,24 @@ export interface ServiceRequest {
|
|
|
12
11
|
webhookContentType?: WebhookContentType;
|
|
13
12
|
/** If set to true this is the service used to create faxes when no serviceId is specified in the API endpoints. */
|
|
14
13
|
defaultForProject?: boolean;
|
|
15
|
-
/** One of your
|
|
14
|
+
/** One of your Sinch numbers connected to this service or any of your verified numbers */
|
|
16
15
|
defaultFrom?: string;
|
|
17
16
|
/** The number of times to retry sending a fax if it fails. Default is 3. Maximum is 5. */
|
|
18
17
|
numberOfRetries?: number;
|
|
19
18
|
/** The number of seconds to wait between retries if the fax is not yet completed. */
|
|
20
19
|
retryDelaySeconds?: number;
|
|
21
|
-
/** Determines how documents are converted to black and white.
|
|
20
|
+
/** Determines how documents are converted to black and white on OUTBOUND faxes only. Image conversion is not done on INBOUND faxes. Defaults to value selected on Fax Service object. */
|
|
22
21
|
imageConversionMethod?: ImageConversionMethod;
|
|
22
|
+
/** If a value is set, it will always add that cover page id to outbound faxes */
|
|
23
|
+
coverPageId?: string;
|
|
23
24
|
/** Save fax documents with sinch when you send faxes */
|
|
24
25
|
saveOutboundFaxDocuments?: boolean;
|
|
25
26
|
/** Save fax documents with sinch when you receive faxes */
|
|
26
27
|
saveInboundFaxDocuments?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
|
|
28
|
+
/** If set to true, barcodes will be detected on incoming faxes. */
|
|
29
|
+
scanIncomingBarcodes?: boolean;
|
|
30
|
+
/** @see Resolution */
|
|
31
|
+
resolution?: Resolution;
|
|
29
32
|
}
|
|
30
33
|
export interface ServiceResponse extends ServiceRequest {
|
|
31
34
|
/** ID of the fax service used. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Permissions } from '../enums';
|
|
1
2
|
export interface ServicePhoneNumber {
|
|
2
3
|
/** A phone number in [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format, including the leading '+'. */
|
|
3
4
|
phoneNumber?: string;
|
|
@@ -5,4 +6,6 @@ export interface ServicePhoneNumber {
|
|
|
5
6
|
projectId?: string;
|
|
6
7
|
/** ID of the fax service used. */
|
|
7
8
|
serviceId?: string;
|
|
9
|
+
/** Allows you to set permissions for sending and receiving faxes to this email/phone number combination. Default value is `both`. */
|
|
10
|
+
permissions?: Permissions;
|
|
8
11
|
}
|
|
@@ -11,4 +11,11 @@ export declare class FaxCallbackWebhooks implements CallbackProcessor<FaxWebhook
|
|
|
11
11
|
parseEvent(eventBody: any): FaxWebhookEventParsed;
|
|
12
12
|
private reviveFax;
|
|
13
13
|
validateAuthenticationHeader(_headers: IncomingHttpHeaders, _body: any, _path: string, _method: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Static reviver for a Fax Event.
|
|
16
|
+
* This method ensures the object can be treated as a Fax Event.
|
|
17
|
+
* @param {any} eventBody - The event body containing the Fax event notification.
|
|
18
|
+
* @return {FaxWebhookEventParsed} - The parsed Fax event object
|
|
19
|
+
*/
|
|
20
|
+
static parseEvent(eventBody: any): FaxWebhookEventParsed;
|
|
14
21
|
}
|
|
@@ -9,6 +9,9 @@ class FaxCallbackWebhooks {
|
|
|
9
9
|
* @return {FaxWebhookEventParsed} - The parsed Fax event object
|
|
10
10
|
*/
|
|
11
11
|
parseEvent(eventBody) {
|
|
12
|
+
if (typeof eventBody === 'string') {
|
|
13
|
+
eventBody = JSON.parse(eventBody);
|
|
14
|
+
}
|
|
12
15
|
let incomingFaxEvent = null;
|
|
13
16
|
let faxCompletedEvent = null;
|
|
14
17
|
if (eventBody.event) {
|
|
@@ -56,6 +59,16 @@ class FaxCallbackWebhooks {
|
|
|
56
59
|
// No header validation is implemented for Fax API
|
|
57
60
|
return true;
|
|
58
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Static reviver for a Fax Event.
|
|
64
|
+
* This method ensures the object can be treated as a Fax Event.
|
|
65
|
+
* @param {any} eventBody - The event body containing the Fax event notification.
|
|
66
|
+
* @return {FaxWebhookEventParsed} - The parsed Fax event object
|
|
67
|
+
*/
|
|
68
|
+
static parseEvent(eventBody) {
|
|
69
|
+
const instance = new FaxCallbackWebhooks();
|
|
70
|
+
return instance.parseEvent(eventBody);
|
|
71
|
+
}
|
|
59
72
|
}
|
|
60
73
|
exports.FaxCallbackWebhooks = FaxCallbackWebhooks;
|
|
61
74
|
//# sourceMappingURL=callbacks-webhook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks-webhook.js","sourceRoot":"","sources":["../../../../src/rest/v3/callbacks/callbacks-webhook.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAE9B;;;;;OAKG;IACI,UAAU,CAAC,SAAc;QAC9B,IAAI,gBAAgB,GAA4B,IAAI,CAAC;QACrD,I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,EAAE,CAAC;wBACtC,iBAAiB,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;oBACxD,CAAC;oBACD,OAAO,iBAAiB,CAAC;gBAC3B;oBACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAEO,SAAS,CAAC,WAAmB;QACnC,MAAM,GAAG,GAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;YACnB,GAAG,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;YACtB,GAAG,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,4BAA4B;IACjC,6DAA6D;IAC7D,QAA6B,EAAE,KAAU,EAAE,KAAa,EAAE,OAAe;QACzE,kDAAkD;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAC,SAAa;QACpC,MAAM,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC3C,OAAO,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;CAEF;AAzED,kDAyEC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ApiListPromise } from '@sinch/sdk-client';
|
|
2
|
+
import { CoverPage, AddCoverPageRequestData, DeleteCoverPageRequestData, GetCoverPageRequestData, ListCoverPagesRequestData } from '../../../models';
|
|
3
|
+
import { FaxDomainApi } from '../fax-domain-api';
|
|
4
|
+
import { LazyFaxApiClient } from '../fax-service';
|
|
5
|
+
export declare class CoverPagesApi extends FaxDomainApi {
|
|
6
|
+
constructor(lazyClient: LazyFaxApiClient);
|
|
7
|
+
/**
|
|
8
|
+
* Add cover page
|
|
9
|
+
* Add a cover page to your service
|
|
10
|
+
* @param { AddCoverPageRequestData } data - The data to provide to the API call.
|
|
11
|
+
*/
|
|
12
|
+
add(data: AddCoverPageRequestData): Promise<CoverPage>;
|
|
13
|
+
/**
|
|
14
|
+
* Delete a cover page
|
|
15
|
+
* Remove delete a cover page from a service.
|
|
16
|
+
* @param { DeleteCoverPageRequestData } data - The data to provide to the API call.
|
|
17
|
+
*/
|
|
18
|
+
delete(data: DeleteCoverPageRequestData): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Get a cover page
|
|
21
|
+
* Get a cover page by ID.
|
|
22
|
+
* @param { GetCoverPageRequestData } data - The data to provide to the API call.
|
|
23
|
+
*/
|
|
24
|
+
get(data: GetCoverPageRequestData): Promise<CoverPage>;
|
|
25
|
+
/**
|
|
26
|
+
* List cover pages
|
|
27
|
+
* List all cover page to a service
|
|
28
|
+
* @param { ListCoverPagesRequestData } data - The data to provide to the API call.
|
|
29
|
+
* @return {ApiListPromise<CoverPage>}
|
|
30
|
+
*/
|
|
31
|
+
list(data: ListCoverPagesRequestData): ApiListPromise<CoverPage>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CoverPagesApi } from './cover-pages-api';
|
|
2
|
+
import { ApiListPromise } from '@sinch/sdk-client';
|
|
3
|
+
import { AddCoverPageRequestData, CoverPage, DeleteCoverPageRequestData, GetCoverPageRequestData, ListCoverPagesRequestData } from '../../../models';
|
|
4
|
+
export declare class CoverPagesApiFixture implements Partial<Readonly<CoverPagesApi>> {
|
|
5
|
+
/**
|
|
6
|
+
* Fixture associated to function add
|
|
7
|
+
*/
|
|
8
|
+
add: jest.Mock<Promise<CoverPage>, [AddCoverPageRequestData]>;
|
|
9
|
+
/**
|
|
10
|
+
* Fixture associated to function delete
|
|
11
|
+
*/
|
|
12
|
+
delete: jest.Mock<Promise<void>, [DeleteCoverPageRequestData]>;
|
|
13
|
+
/**
|
|
14
|
+
* Fixture associated to function get
|
|
15
|
+
*/
|
|
16
|
+
get: jest.Mock<Promise<CoverPage>, [GetCoverPageRequestData]>;
|
|
17
|
+
/**
|
|
18
|
+
* Fixture associated to function list
|
|
19
|
+
*/
|
|
20
|
+
list: jest.Mock<ApiListPromise<CoverPage>, [ListCoverPagesRequestData]>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoverPagesApiFixture = void 0;
|
|
4
|
+
class CoverPagesApiFixture {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Fixture associated to function add
|
|
8
|
+
*/
|
|
9
|
+
this.add = jest.fn();
|
|
10
|
+
/**
|
|
11
|
+
* Fixture associated to function delete
|
|
12
|
+
*/
|
|
13
|
+
this.delete = jest.fn();
|
|
14
|
+
/**
|
|
15
|
+
* Fixture associated to function get
|
|
16
|
+
*/
|
|
17
|
+
this.get = jest.fn();
|
|
18
|
+
/**
|
|
19
|
+
* Fixture associated to function list
|
|
20
|
+
*/
|
|
21
|
+
this.list = jest.fn();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CoverPagesApiFixture = CoverPagesApiFixture;
|
|
25
|
+
//# sourceMappingURL=cover-pages-api.jest.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cover-pages-api.jest.fixture.js","sourceRoot":"","sources":["../../../../src/rest/v3/cover-pages/cover-pages-api.jest.fixture.ts"],"names":[],"mappings":";;;AAUA,MAAa,oBAAoB;IAAjC;QAEE;;WAEG;QACI,QAAG,GAA6D,IAAI,CAAC,EAAE,EAAE,CAAC;QACjF;;WAEG;QACI,WAAM,GAA2D,IAAI,CAAC,EAAE,EAAE,CAAC;QAClF;;WAEG;QACI,QAAG,GAA6D,IAAI,CAAC,EAAE,EAAE,CAAC;QACjF;;WAEG;QACI,SAAI,GAAsE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC7F,CAAC;CAAA;AAlBD,oDAkBC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoverPagesApi = void 0;
|
|
4
|
+
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
|
+
const fax_domain_api_1 = require("../fax-domain-api");
|
|
6
|
+
class CoverPagesApi extends fax_domain_api_1.FaxDomainApi {
|
|
7
|
+
constructor(lazyClient) {
|
|
8
|
+
super(lazyClient, 'CoverPagesApi');
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Add cover page
|
|
12
|
+
* Add a cover page to your service
|
|
13
|
+
* @param { AddCoverPageRequestData } data - The data to provide to the API call.
|
|
14
|
+
*/
|
|
15
|
+
async add(data) {
|
|
16
|
+
const getParams = this.client.extractQueryParams(data, []);
|
|
17
|
+
const headers = {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'Accept': 'application/json',
|
|
20
|
+
};
|
|
21
|
+
const body = data['addCoverPageRequestBody'] ? JSON.stringify(data['addCoverPageRequestBody']) : '{}';
|
|
22
|
+
const basePathUrl = `${this.client.apiClientOptions.hostname}/v3/projects/${this.client.apiClientOptions.projectId}/services/${data['serviceId']}/coverPages`;
|
|
23
|
+
const requestOptions = await this.client.prepareOptions(basePathUrl, 'POST', getParams, headers, body || undefined);
|
|
24
|
+
const url = this.client.prepareUrl(requestOptions.hostname, requestOptions.queryParams);
|
|
25
|
+
return this.client.processCall({
|
|
26
|
+
url,
|
|
27
|
+
requestOptions,
|
|
28
|
+
apiName: this.apiName,
|
|
29
|
+
operationId: 'AddCoverPage',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Delete a cover page
|
|
34
|
+
* Remove delete a cover page from a service.
|
|
35
|
+
* @param { DeleteCoverPageRequestData } data - The data to provide to the API call.
|
|
36
|
+
*/
|
|
37
|
+
async delete(data) {
|
|
38
|
+
const getParams = this.client.extractQueryParams(data, []);
|
|
39
|
+
const headers = {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
'Accept': 'application/json',
|
|
42
|
+
};
|
|
43
|
+
const body = '';
|
|
44
|
+
const basePathUrl = `${this.client.apiClientOptions.hostname}/v3/projects/${this.client.apiClientOptions.projectId}/services/${data['serviceId']}/coverPages/${data['coverPageId']}`;
|
|
45
|
+
const requestOptions = await this.client.prepareOptions(basePathUrl, 'DELETE', getParams, headers, body || undefined);
|
|
46
|
+
const url = this.client.prepareUrl(requestOptions.hostname, requestOptions.queryParams);
|
|
47
|
+
return this.client.processCall({
|
|
48
|
+
url,
|
|
49
|
+
requestOptions,
|
|
50
|
+
apiName: this.apiName,
|
|
51
|
+
operationId: 'DeleteCoverPage',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get a cover page
|
|
56
|
+
* Get a cover page by ID.
|
|
57
|
+
* @param { GetCoverPageRequestData } data - The data to provide to the API call.
|
|
58
|
+
*/
|
|
59
|
+
async get(data) {
|
|
60
|
+
const getParams = this.client.extractQueryParams(data, []);
|
|
61
|
+
const headers = {
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
'Accept': 'application/json',
|
|
64
|
+
};
|
|
65
|
+
const body = '';
|
|
66
|
+
const basePathUrl = `${this.client.apiClientOptions.hostname}/v3/projects/${this.client.apiClientOptions.projectId}/services/${data['serviceId']}/coverPages/${data['coverPageId']}`;
|
|
67
|
+
const requestOptions = await this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, body || undefined);
|
|
68
|
+
const url = this.client.prepareUrl(requestOptions.hostname, requestOptions.queryParams);
|
|
69
|
+
return this.client.processCall({
|
|
70
|
+
url,
|
|
71
|
+
requestOptions,
|
|
72
|
+
apiName: this.apiName,
|
|
73
|
+
operationId: 'GetCoverPage',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* List cover pages
|
|
78
|
+
* List all cover page to a service
|
|
79
|
+
* @param { ListCoverPagesRequestData } data - The data to provide to the API call.
|
|
80
|
+
* @return {ApiListPromise<CoverPage>}
|
|
81
|
+
*/
|
|
82
|
+
list(data) {
|
|
83
|
+
const getParams = this.client.extractQueryParams(data, ['pageSize', 'page']);
|
|
84
|
+
const headers = {
|
|
85
|
+
'Content-Type': 'application/json',
|
|
86
|
+
'Accept': 'application/json',
|
|
87
|
+
};
|
|
88
|
+
const body = '';
|
|
89
|
+
const basePathUrl = `${this.client.apiClientOptions.hostname}/v3/projects/${this.client.apiClientOptions.projectId}/services/${data['serviceId']}/coverPages`;
|
|
90
|
+
const requestOptionsPromise = this.client.prepareOptions(basePathUrl, 'GET', getParams, headers, body || undefined);
|
|
91
|
+
const operationProperties = {
|
|
92
|
+
pagination: sdk_client_1.PaginationEnum.PAGE3,
|
|
93
|
+
apiName: this.apiName,
|
|
94
|
+
operationId: 'ListCoverPages',
|
|
95
|
+
dataKey: 'coverPages',
|
|
96
|
+
};
|
|
97
|
+
// Create the promise containing the response wrapped as a PageResult
|
|
98
|
+
const listPromise = (0, sdk_client_1.buildPageResultPromise)(this.client, requestOptionsPromise, operationProperties);
|
|
99
|
+
// Add properties to the Promise to offer the possibility to use it as an iterator
|
|
100
|
+
Object.assign(listPromise, (0, sdk_client_1.createIteratorMethodsForPagination)(this.client, requestOptionsPromise, listPromise, operationProperties));
|
|
101
|
+
return listPromise;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.CoverPagesApi = CoverPagesApi;
|
|
105
|
+
//# sourceMappingURL=cover-pages-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,gBAAgB;YAC7B,OAAO,EAAE,YAAY;SACtB,CAAC;QAEF,qEAAqE;QACrE,MAAM,WAAW,GAAG,IAAA,mCAAsB,EACxC,IAAI,CAAC,MAAM,EACX,qBAAqB,EACrB,mBAAmB,CAAC,CAAC;QAEvB,kFAAkF;QAClF,MAAM,CAAC,MAAM,CACX,WAAW,EACX,IAAA,+CAAkC,EAChC,IAAI,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,EAAE,mBAAmB,CAAC,CACxE,CAAC;QAEF,OAAO,WAAwC,CAAC;IAClD,CAAC;CAGF;AA/HD,sCA+HC"}
|
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./cover-pages-api"), exports);
|
|
18
|
+
__exportStar(require("./cover-pages-api.jest.fixture"), exports);
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v3/cover-pages/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iEAA+C"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { Api, ApiClient, FaxRegion,
|
|
1
|
+
import { Api, ApiClient, FaxRegion, UnifiedCredentials } from '@sinch/sdk-client';
|
|
2
|
+
import { LazyFaxApiClient } from './fax-service';
|
|
2
3
|
export declare class FaxDomainApi implements Api {
|
|
4
|
+
readonly lazyClient: LazyFaxApiClient;
|
|
3
5
|
readonly apiName: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
constructor(lazyClient: LazyFaxApiClient, apiName: string);
|
|
7
|
+
get client(): ApiClient;
|
|
8
|
+
/**
|
|
9
|
+
* Kept for backward compatibility - TODO: remove in future major release
|
|
10
|
+
* @return {ApiClient}
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
getSinchClient(): ApiClient;
|
|
7
14
|
/**
|
|
8
15
|
* Update the default hostname for the API
|
|
9
16
|
* @param {string} hostname - The new hostname to use for the APIs.
|
|
@@ -11,21 +18,13 @@ export declare class FaxDomainApi implements Api {
|
|
|
11
18
|
setHostname(hostname: string): void;
|
|
12
19
|
/**
|
|
13
20
|
* Update the region in the basePath
|
|
14
|
-
* @param {FaxRegion}
|
|
21
|
+
* @param {FaxRegion} _region - The new region to send the requests to
|
|
22
|
+
* @deprecated
|
|
15
23
|
*/
|
|
16
|
-
setRegion(
|
|
24
|
+
setRegion(_region: FaxRegion): void;
|
|
17
25
|
/**
|
|
18
26
|
* Updates the credentials used to authenticate API requests
|
|
19
27
|
* @param {UnifiedCredentials} credentials
|
|
20
28
|
*/
|
|
21
|
-
setCredentials(credentials: UnifiedCredentials): void;
|
|
22
|
-
private resetApiClient;
|
|
23
|
-
/**
|
|
24
|
-
* Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
|
|
25
|
-
* be returned for the subsequent API calls (singleton pattern)
|
|
26
|
-
* @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
getSinchClient(): ApiClient;
|
|
30
|
-
private buildHostname;
|
|
29
|
+
setCredentials(credentials: Partial<UnifiedCredentials>): void;
|
|
31
30
|
}
|
|
@@ -1,75 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FaxDomainApi = void 0;
|
|
4
|
-
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
4
|
class FaxDomainApi {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
5
|
+
constructor(lazyClient, apiName) {
|
|
6
|
+
this.lazyClient = lazyClient;
|
|
8
7
|
this.apiName = apiName;
|
|
9
8
|
}
|
|
9
|
+
get client() {
|
|
10
|
+
return this.lazyClient.getApiClient();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Kept for backward compatibility - TODO: remove in future major release
|
|
14
|
+
* @return {ApiClient}
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
getSinchClient() {
|
|
18
|
+
return this.lazyClient.getApiClient();
|
|
19
|
+
}
|
|
10
20
|
/**
|
|
11
21
|
* Update the default hostname for the API
|
|
12
22
|
* @param {string} hostname - The new hostname to use for the APIs.
|
|
13
23
|
*/
|
|
14
24
|
setHostname(hostname) {
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
25
|
+
this.lazyClient.sharedConfig.faxHostname = hostname;
|
|
26
|
+
this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
|
|
17
27
|
}
|
|
18
28
|
/**
|
|
19
29
|
* Update the region in the basePath
|
|
20
|
-
* @param {FaxRegion}
|
|
30
|
+
* @param {FaxRegion} _region - The new region to send the requests to
|
|
31
|
+
* @deprecated
|
|
21
32
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34
|
+
setRegion(_region) {
|
|
35
|
+
// Deprecated: regions are ignored by the Fax API which uses a single global endpoint.
|
|
36
|
+
// Keep this method for backward compatibility but avoid mutating shared state or
|
|
37
|
+
// resetting the client to prevent unexpected side effects.
|
|
38
|
+
console.info(`Deprecated: The regions are not used for the Fax API, the request will be perform against the global endpoint ${this.lazyClient.sharedConfig.faxHostname ?? 'https://fax.api.sinch.com'}`);
|
|
27
39
|
}
|
|
28
40
|
/**
|
|
29
41
|
* Updates the credentials used to authenticate API requests
|
|
30
42
|
* @param {UnifiedCredentials} credentials
|
|
31
43
|
*/
|
|
32
44
|
setCredentials(credentials) {
|
|
33
|
-
const parametersBackup = { ...this.
|
|
34
|
-
this.
|
|
45
|
+
const parametersBackup = { ...this.lazyClient.sharedConfig };
|
|
46
|
+
this.lazyClient.sharedConfig = {
|
|
35
47
|
...parametersBackup,
|
|
36
48
|
...credentials,
|
|
37
49
|
};
|
|
38
|
-
this.resetApiClient();
|
|
50
|
+
this.lazyClient.resetApiClient();
|
|
39
51
|
try {
|
|
40
|
-
this.
|
|
52
|
+
this.lazyClient.getApiClient();
|
|
41
53
|
}
|
|
42
54
|
catch (error) {
|
|
43
55
|
console.error('Impossible to assign the new credentials to the Fax API');
|
|
44
|
-
this.
|
|
56
|
+
this.lazyClient.sharedConfig = parametersBackup;
|
|
45
57
|
throw error;
|
|
46
58
|
}
|
|
47
59
|
}
|
|
48
|
-
resetApiClient() {
|
|
49
|
-
this.client = undefined;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
|
|
53
|
-
* be returned for the subsequent API calls (singleton pattern)
|
|
54
|
-
* @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
|
|
55
|
-
* @private
|
|
56
|
-
*/
|
|
57
|
-
getSinchClient() {
|
|
58
|
-
if (!this.client) {
|
|
59
|
-
const apiClientOptions = (0, sdk_client_1.buildOAuth2ApiClientOptions)(this.sinchClientParameters, 'Fax');
|
|
60
|
-
this.client = new sdk_client_1.ApiFetchClient(apiClientOptions);
|
|
61
|
-
const region = this.sinchClientParameters.faxRegion ?? sdk_client_1.FaxRegion.DEFAULT;
|
|
62
|
-
if (!Object.values(sdk_client_1.SupportedFaxRegion).includes(region)) {
|
|
63
|
-
console.warn(`The region "${region}" is not known as a supported region for the Fax API`);
|
|
64
|
-
}
|
|
65
|
-
this.client.apiClientOptions.hostname = this.sinchClientParameters.faxHostname ?? this.buildHostname(region);
|
|
66
|
-
}
|
|
67
|
-
return this.client;
|
|
68
|
-
}
|
|
69
|
-
buildHostname(region) {
|
|
70
|
-
const formattedRegion = region !== '' ? `${region}.` : '';
|
|
71
|
-
return (0, sdk_client_1.formatRegionalizedHostname)(sdk_client_1.FAX_HOSTNAME, formattedRegion);
|
|
72
|
-
}
|
|
73
60
|
}
|
|
74
61
|
exports.FaxDomainApi = FaxDomainApi;
|
|
75
62
|
//# sourceMappingURL=fax-domain-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fax-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v3/fax-domain-api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"fax-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v3/fax-domain-api.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IAEvB,YACkB,UAA4B,EAC5B,OAAe;QADf,eAAU,GAAV,UAAU,CAAkB;QAC5B,YAAO,GAAP,OAAO,CAAQ;IAC9B,CAAC;IAEJ,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAgB;QACjC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,GAAG,QAAQ,CAAC;QACpD,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,gBAAgB,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtE,CAAC;IAED;;;;OAIG;IACH,6DAA6D;IACtD,SAAS,CAAC,OAAkB;QACjC,sFAAsF;QACtF,iFAAiF;QACjF,2DAA2D;QAC3D,OAAO,CAAC,IAAI,CAAC,iHAAiH,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,IAAI,2BAA2B,EAAE,CAAC,CAAC;IAC3M,CAAC;IAED;;;OAG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