@sinch/fax 1.3.0 → 1.4.1
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/cover-page/cover-page.d.ts +25 -0
- package/dist/models/v3/cover-page/cover-page.js +3 -0
- 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/cover-page-file/cover-page-file.js +3 -0
- 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 +3 -0
- package/dist/models/v3/cover-page-file/index.js.map +1 -0
- package/dist/models/v3/email/email.d.ts +4 -0
- package/dist/models/v3/index.d.ts +2 -0
- package/dist/models/v3/index.js +2 -0
- package/dist/models/v3/index.js.map +1 -1
- 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/index.d.ts +1 -0
- package/dist/models/v3/requests/index.js +1 -0
- package/dist/models/v3/requests/index.js.map +1 -1
- package/dist/models/v3/service-phone-number/service-phone-number.d.ts +3 -0
- package/dist/rest/v3/callbacks/callbacks-webhook.d.ts +7 -0
- package/dist/rest/v3/callbacks/callbacks-webhook.js +10 -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/cover-pages/index.js +19 -0
- 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 +18 -15
- package/dist/rest/v3/fax-service.js +59 -27
- package/dist/rest/v3/fax-service.js.map +1 -1
- package/dist/rest/v3/fax-to-email/fax-to-email-api.d.ts +3 -7
- package/dist/rest/v3/fax-to-email/fax-to-email-api.js +3 -13
- package/dist/rest/v3/fax-to-email/fax-to-email-api.js.map +1 -1
- package/dist/rest/v3/faxes/faxes-api.d.ts +4 -8
- package/dist/rest/v3/faxes/faxes-api.js +6 -16
- package/dist/rest/v3/faxes/faxes-api.js.map +1 -1
- package/dist/rest/v3/index.d.ts +2 -0
- package/dist/rest/v3/index.js +2 -0
- 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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CoverPageFile } from '../cover-page-file';
|
|
2
|
+
/**
|
|
3
|
+
* A cover page creation model
|
|
4
|
+
*/
|
|
5
|
+
export interface CoverPageRequest {
|
|
6
|
+
/** The friendly name of the cover page. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** @see CoverPageFile */
|
|
9
|
+
file: CoverPageFile;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A cover page resource
|
|
13
|
+
*/
|
|
14
|
+
export interface CoverPage extends CoverPageRequest {
|
|
15
|
+
/** ID of the cover page */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** The `Id` of the project associated with the call. */
|
|
18
|
+
projectId?: string;
|
|
19
|
+
/** ID of the fax service used. */
|
|
20
|
+
serviceId?: string;
|
|
21
|
+
/** The date and time the cover page was created. */
|
|
22
|
+
createdTime?: Date;
|
|
23
|
+
/** The date and time the cover page was updated. */
|
|
24
|
+
updatedTime?: Date;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cover-page.js","sourceRoot":"","sources":["../../../../src/models/v3/cover-page/cover-page.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CoverPageRequest, CoverPage } from './cover-page';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v3/cover-page/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cover-page-file.js","sourceRoot":"","sources":["../../../../src/models/v3/cover-page-file/cover-page-file.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CoverPageFile } from './cover-page-file';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v3/cover-page-file/index.ts"],"names":[],"mappings":""}
|
|
@@ -9,5 +9,9 @@ export interface EmailRequest extends EmailBase {
|
|
|
9
9
|
export interface Email extends EmailBase {
|
|
10
10
|
/** The `Id` of the project associated with the call. */
|
|
11
11
|
projectId?: string;
|
|
12
|
+
/** The date and time the email was created. */
|
|
13
|
+
createdAt?: Date;
|
|
14
|
+
/** The date and time the email was updated. */
|
|
15
|
+
updatedAt?: Date;
|
|
12
16
|
}
|
|
13
17
|
export {};
|
package/dist/models/v3/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./bar-code"), exports);
|
|
18
|
+
__exportStar(require("./cover-page"), exports);
|
|
19
|
+
__exportStar(require("./cover-page-file"), exports);
|
|
18
20
|
__exportStar(require("./date-range-filter"), exports);
|
|
19
21
|
__exportStar(require("./email"), exports);
|
|
20
22
|
__exportStar(require("./errors"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/v3/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,sDAAoC;AACpC,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB;AACtB,oDAAkC;AAClC,oDAAkC;AAClC,8CAA4B;AAC5B,gDAA8B;AAC9B,+CAA6B;AAC7B,4DAA0C;AAC1C,+CAA6B;AAC7B,4CAA0B;AAC1B,yDAAuC;AACvC,yDAAuC;AACvC,yDAAuC;AACvC,0CAAwB;AACxB,6CAA2B;AAC3B,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/v3/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,+CAA6B;AAC7B,oDAAkC;AAClC,sDAAoC;AACpC,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB;AACtB,oDAAkC;AAClC,oDAAkC;AAClC,8CAA4B;AAC5B,gDAA8B;AAC9B,+CAA6B;AAC7B,4DAA0C;AAC1C,+CAA6B;AAC7B,4CAA0B;AAC1B,yDAAuC;AACvC,yDAAuC;AACvC,yDAAuC;AACvC,0CAAwB;AACxB,6CAA2B;AAC3B,2CAAyB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CoverPageRequest } from '../../cover-page';
|
|
2
|
+
export interface AddCoverPageRequestData {
|
|
3
|
+
/** the serviceId */
|
|
4
|
+
serviceId: string;
|
|
5
|
+
/** */
|
|
6
|
+
addCoverPageRequestBody?: CoverPageRequest;
|
|
7
|
+
}
|
|
8
|
+
export interface DeleteCoverPageRequestData {
|
|
9
|
+
/** The serviceId containing the cover page you want to work with. */
|
|
10
|
+
serviceId: string;
|
|
11
|
+
/** */
|
|
12
|
+
coverPageId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GetCoverPageRequestData {
|
|
15
|
+
/** The serviceId containing the cover page you want to work with. */
|
|
16
|
+
serviceId: string;
|
|
17
|
+
/** */
|
|
18
|
+
coverPageId: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ListCoverPagesRequestData {
|
|
21
|
+
/** the serviceId */
|
|
22
|
+
serviceId: string;
|
|
23
|
+
/** Number of cover pages to return on each request. */
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
/** Optional. The page to fetch. If not specified, the first page will be returned. */
|
|
26
|
+
page?: string;
|
|
27
|
+
}
|
|
@@ -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":""}
|
|
@@ -14,6 +14,7 @@ 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("./cover-pages/cover-pages-request-data"), exports);
|
|
17
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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v3/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2EAAyD;AACzD,6DAA2C;AAC3C,mEAAiD"}
|
|
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,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
|
}
|
|
@@ -59,6 +59,16 @@ class FaxCallbackWebhooks {
|
|
|
59
59
|
// No header validation is implemented for Fax API
|
|
60
60
|
return true;
|
|
61
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
|
+
}
|
|
62
72
|
}
|
|
63
73
|
exports.FaxCallbackWebhooks = FaxCallbackWebhooks;
|
|
64
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,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,gBAAgB,GAA4B,IAAI,CAAC;QACrD,IAAI,iBAAiB,GAA6B,IAAI,CAAC;QACvD,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACpB,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;
|
|
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,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,gBAAgB,GAA4B,IAAI,CAAC;QACrD,IAAI,iBAAiB,GAA6B,IAAI,CAAC;QACvD,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACpB,QAAQ,SAAS,CAAC,KAAK,EAAE,CAAC;gBACxB,KAAK,cAAc;oBACjB,gBAAgB,GAAG,SAA6B,CAAC;oBACjD,IAAI,SAAS,CAAC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AAG,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
|
+
{"version":3,"file":"cover-pages-api.js","sourceRoot":"","sources":["../../../../src/rest/v3/cover-pages/cover-pages-api.ts"],"names":[],"mappings":";;;AAAA,kDAO2B;AAQ3B,sDAAiD;AAGjD,MAAa,aAAc,SAAQ,6BAAY;IAE7C,YAAY,UAA4B;QACtC,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,IAA6B;QAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAA0B,IAAI,EAAE,EAAa,CAAC,CAAC;QAC/F,MAAM,OAAO,GAA0C;YACrD,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;QAEF,MAAM,IAAI,GAAgB,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnH,MAAM,WAAW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AAkB,CAA4B,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;QACxG,MAAM,OAAO,GAA0C;YACrD,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;QAEF,MAAM,IAAI,GAAgB,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,gBAAgB,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,aAAa,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;QAE9J,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;QAEpH,MAAM,mBAAmB,GAA2B;YAClD,UAAU,EAAE,2BAAc,CAAC,KAAK;YAChC,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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cover-pages-api"), exports);
|
|
18
|
+
__exportStar(require("./cover-pages-api.jest.fixture"), exports);
|
|
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;;;OAGG;IACI,cAAc,CAAC,WAAwC;QAC5D,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG;YAC7B,GAAG,gBAAgB;YACnB,GAAG,WAAW;SACf,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,IAA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