@sinch/sms 1.3.0 → 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/README.md +16 -0
- package/dist/rest/v1/batches/batches-api.d.ts +4 -8
- package/dist/rest/v1/batches/batches-api.js +12 -16
- package/dist/rest/v1/batches/batches-api.js.map +1 -1
- package/dist/rest/v1/batches/index.d.ts +1 -0
- package/dist/rest/v1/batches/index.js +1 -0
- package/dist/rest/v1/batches/index.js.map +1 -1
- package/dist/rest/v1/callbacks/callbacks-webhook.d.ts +7 -0
- package/dist/rest/v1/callbacks/callbacks-webhook.js +10 -0
- package/dist/rest/v1/callbacks/callbacks-webhook.js.map +1 -1
- package/dist/rest/v1/delivery-reports/delivery-reports-api.d.ts +4 -8
- package/dist/rest/v1/delivery-reports/delivery-reports-api.js +3 -11
- package/dist/rest/v1/delivery-reports/delivery-reports-api.js.map +1 -1
- package/dist/rest/v1/delivery-reports/index.d.ts +1 -0
- package/dist/rest/v1/delivery-reports/index.js +1 -0
- package/dist/rest/v1/delivery-reports/index.js.map +1 -1
- package/dist/rest/v1/groups/groups-api.d.ts +4 -8
- package/dist/rest/v1/groups/groups-api.js +3 -15
- package/dist/rest/v1/groups/groups-api.js.map +1 -1
- package/dist/rest/v1/groups/index.d.ts +1 -0
- package/dist/rest/v1/groups/index.js +1 -0
- package/dist/rest/v1/groups/index.js.map +1 -1
- package/dist/rest/v1/inbounds/inbounds-api.d.ts +4 -8
- package/dist/rest/v1/inbounds/inbounds-api.js +3 -10
- package/dist/rest/v1/inbounds/inbounds-api.js.map +1 -1
- package/dist/rest/v1/inbounds/index.d.ts +1 -0
- package/dist/rest/v1/inbounds/index.js +1 -0
- package/dist/rest/v1/inbounds/index.js.map +1 -1
- package/dist/rest/v1/index.d.ts +1 -1
- package/dist/rest/v1/index.js +1 -1
- package/dist/rest/v1/index.js.map +1 -1
- package/dist/rest/v1/sms-domain-api.d.ts +12 -15
- package/dist/rest/v1/sms-domain-api.js +23 -58
- package/dist/rest/v1/sms-domain-api.js.map +1 -1
- package/dist/rest/v1/sms-service.d.ts +13 -1
- package/dist/rest/v1/sms-service.js +65 -13
- package/dist/rest/v1/sms-service.js.map +1 -1
- package/package.json +2 -2
- package/dist/rest/v1/fixtures.jest.d.ts +0 -4
- package/dist/rest/v1/fixtures.jest.js +0 -12
- package/dist/rest/v1/fixtures.jest.js.map +0 -1
package/README.md
CHANGED
|
@@ -143,6 +143,22 @@ const response_1: Sms.SendSMSResponse = await smsServiceWithProjectId.batches.se
|
|
|
143
143
|
const response_2: Sms.SendSMSResponse = await smsServiceWithServicePlanId.batches.send(requestData);
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
## Other parameters
|
|
147
|
+
|
|
148
|
+
`smsHostname`: You can override the default hostname used to send requests to the SMS API by providing the `smsHostname` parameter in the `SinchClientParameters` object. By default, the hostname is built based on the selected region and authentication method.
|
|
149
|
+
- For OAuth2 authentication, the default hostname is `zt.{region}.sms.api.sinch.com`
|
|
150
|
+
- For API Token authentication, the default hostname is `{region}.sms.api.sinch.com`
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
const credentials: UnifiedCredentials = {
|
|
154
|
+
projectId: 'PROJECT_ID',
|
|
155
|
+
keyId: 'KEY_ID',
|
|
156
|
+
keySecret: 'KEY_SECRET',
|
|
157
|
+
smsHostname: 'my.custom.domain.com',
|
|
158
|
+
};
|
|
159
|
+
const smsService = new SmsService(credentials);
|
|
160
|
+
```
|
|
161
|
+
|
|
146
162
|
## Promises
|
|
147
163
|
|
|
148
164
|
All the methods that interact with the Sinch APIs use Promises. You can use `await` in an `async` method to wait for the response, or you can resolve them yourself with `then()` / `catch()`.
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import { ApiListPromise } from '@sinch/sdk-client';
|
|
1
2
|
import { CancelBatchMessageResponse, DryRunResponse, ReplaceBatchMessageResponse, SendSMSResponse, BinaryResponse, TextResponse, MediaResponse, CancelBatchMessageRequestData, DeliveryFeedbackRequestData, DryRunRequestData, GetBatchMessageRequestData, ListBatchesRequestData, ReplaceBatchMessageRequestData, SendSMSRequestData, SendTextSMSRequestData, SendBinarySMSRequestData, SendMediaSMSRequestData, UpdateBatchMessageRequestData } from '../../../models';
|
|
2
|
-
import { ApiListPromise, SinchClientParameters } from '@sinch/sdk-client';
|
|
3
3
|
import { SmsDomainApi } from '../sms-domain-api';
|
|
4
|
+
import { LazySmsApiClient } from '../sms-service';
|
|
4
5
|
export declare class BatchesApi extends SmsDomainApi {
|
|
5
|
-
|
|
6
|
-
* Initialize your interface
|
|
7
|
-
*
|
|
8
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
9
|
-
*/
|
|
10
|
-
constructor(sinchClientParameters: SinchClientParameters);
|
|
6
|
+
constructor(lazyClient: LazySmsApiClient);
|
|
11
7
|
/**
|
|
12
8
|
* Cancel a batch message
|
|
13
9
|
* A batch can be canceled at any point. If a batch is canceled while it's currently being delivered some messages currently being processed might still be delivered. The delivery report will indicate which messages were canceled and which weren't. Canceling a batch scheduled in the future will result in an empty delivery report while canceling an already sent batch would result in no change to the completed delivery report.
|
|
@@ -40,7 +36,7 @@ export declare class BatchesApi extends SmsDomainApi {
|
|
|
40
36
|
* @param { ListBatchesRequestData } data - The data to provide to the API call.
|
|
41
37
|
* @return {ApiListPromise<SendSMSResponse>}
|
|
42
38
|
*/
|
|
43
|
-
list(data
|
|
39
|
+
list(data?: ListBatchesRequestData): ApiListPromise<SendSMSResponse>;
|
|
44
40
|
/**
|
|
45
41
|
* Replace a batch
|
|
46
42
|
* This operation will replace all the parameters of a batch with the provided values. It is the same as cancelling a batch and sending a new one instead.
|
|
@@ -4,13 +4,8 @@ exports.BatchesApi = void 0;
|
|
|
4
4
|
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
5
|
const sms_domain_api_1 = require("../sms-domain-api");
|
|
6
6
|
class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
11
|
-
*/
|
|
12
|
-
constructor(sinchClientParameters) {
|
|
13
|
-
super(sinchClientParameters, 'BatchesApi');
|
|
7
|
+
constructor(lazyClient) {
|
|
8
|
+
super(lazyClient, 'BatchesApi');
|
|
14
9
|
}
|
|
15
10
|
/**
|
|
16
11
|
* Cancel a batch message
|
|
@@ -18,7 +13,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
18
13
|
* @param { CancelBatchMessageRequestData } data - The data to provide to the API call.
|
|
19
14
|
*/
|
|
20
15
|
async cancel(data) {
|
|
21
|
-
this.client = this.getSinchClient();
|
|
22
16
|
const getParams = this.client.extractQueryParams(data, []);
|
|
23
17
|
const headers = {
|
|
24
18
|
'Content-Type': 'application/json',
|
|
@@ -43,7 +37,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
43
37
|
* @param { DeliveryFeedbackRequestData } data - The data to provide to the API call.
|
|
44
38
|
*/
|
|
45
39
|
async sendDeliveryFeedback(data) {
|
|
46
|
-
this.client = this.getSinchClient();
|
|
47
40
|
const getParams = this.client.extractQueryParams(data, []);
|
|
48
41
|
const headers = {
|
|
49
42
|
'Content-Type': 'application/json',
|
|
@@ -66,7 +59,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
66
59
|
* @param { DryRunRequestData } data - The data to provide to the API call.
|
|
67
60
|
*/
|
|
68
61
|
async dryRun(data) {
|
|
69
|
-
this.client = this.getSinchClient();
|
|
70
62
|
const getParams = this.client.extractQueryParams(data, [
|
|
71
63
|
'per_recipient',
|
|
72
64
|
'number_of_recipients'
|
|
@@ -92,7 +84,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
92
84
|
* @param { GetBatchMessageRequestData } data - The data to provide to the API call.
|
|
93
85
|
*/
|
|
94
86
|
async get(data) {
|
|
95
|
-
this.client = this.getSinchClient();
|
|
96
87
|
const getParams = this.client.extractQueryParams(data, []);
|
|
97
88
|
const headers = {
|
|
98
89
|
'Content-Type': 'application/json',
|
|
@@ -116,8 +107,7 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
116
107
|
* @return {ApiListPromise<SendSMSResponse>}
|
|
117
108
|
*/
|
|
118
109
|
list(data) {
|
|
119
|
-
|
|
120
|
-
const getParams = this.client.extractQueryParams(data, ['page', 'page_size', 'from', 'start_date', 'end_date', 'client_reference']);
|
|
110
|
+
const getParams = this.client.extractQueryParams(data ?? {}, ['page', 'page_size', 'from', 'start_date', 'end_date', 'client_reference']);
|
|
121
111
|
const headers = {
|
|
122
112
|
'Content-Type': 'application/json',
|
|
123
113
|
'Accept': 'application/json',
|
|
@@ -143,7 +133,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
143
133
|
* @param { ReplaceBatchMessageRequestData } data - The data to provide to the API call.
|
|
144
134
|
*/
|
|
145
135
|
async replace(data) {
|
|
146
|
-
this.client = this.getSinchClient();
|
|
147
136
|
const getParams = this.client.extractQueryParams(data, []);
|
|
148
137
|
const headers = {
|
|
149
138
|
'Content-Type': 'application/json',
|
|
@@ -170,7 +159,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
170
159
|
* @param { SendSMSRequestData } data - The data to provide to the API call.
|
|
171
160
|
*/
|
|
172
161
|
async send(data) {
|
|
173
|
-
this.client = this.getSinchClient();
|
|
174
162
|
const getParams = this.client.extractQueryParams(data, []);
|
|
175
163
|
const headers = {
|
|
176
164
|
'Content-Type': 'application/json',
|
|
@@ -197,6 +185,9 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
197
185
|
* @param { SendTextSMSRequestData } data - The data to provide to the API call.
|
|
198
186
|
*/
|
|
199
187
|
async sendTextMessage(data) {
|
|
188
|
+
if (data.sendSMSRequestBody) {
|
|
189
|
+
data.sendSMSRequestBody.type = 'mt_text';
|
|
190
|
+
}
|
|
200
191
|
const response = await this.send(data);
|
|
201
192
|
return response;
|
|
202
193
|
}
|
|
@@ -210,6 +201,9 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
210
201
|
* @param { SendBinarySMSRequestData } data - The data to provide to the API call.
|
|
211
202
|
*/
|
|
212
203
|
async sendBinaryMessage(data) {
|
|
204
|
+
if (data.sendSMSRequestBody) {
|
|
205
|
+
data.sendSMSRequestBody.type = 'mt_binary';
|
|
206
|
+
}
|
|
213
207
|
const response = await this.send(data);
|
|
214
208
|
return response;
|
|
215
209
|
}
|
|
@@ -223,6 +217,9 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
223
217
|
* @param { SendMediaSMSRequestData } data - The data to provide to the API call.
|
|
224
218
|
*/
|
|
225
219
|
async sendMediaMessage(data) {
|
|
220
|
+
if (data.sendSMSRequestBody) {
|
|
221
|
+
data.sendSMSRequestBody.type = 'mt_media';
|
|
222
|
+
}
|
|
226
223
|
const response = await this.send(data);
|
|
227
224
|
return response;
|
|
228
225
|
}
|
|
@@ -232,7 +229,6 @@ class BatchesApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
232
229
|
* @param { UpdateBatchMessageRequestData } data - The data to provide to the API call.
|
|
233
230
|
*/
|
|
234
231
|
async update(data) {
|
|
235
|
-
this.client = this.getSinchClient();
|
|
236
232
|
const getParams = this.client.extractQueryParams(data, []);
|
|
237
233
|
const headers = {
|
|
238
234
|
'Content-Type': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batches-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/batches/batches-api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"batches-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/batches/batches-api.ts"],"names":[],"mappings":";;;AAAA,kDAO2B;AAqB3B,sDAAiD;AAGjD,MAAa,UAAW,SAAQ,6BAAY;IAE1C,YAAY,UAA4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,CAAC,CAAC;IACL,CAAC;CAEF;AA/SD,gCA+SC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./batches-api"), exports);
|
|
18
|
+
__exportStar(require("./batches-api.jest.fixture"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/batches/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/batches/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6DAA2C"}
|
|
@@ -13,4 +13,11 @@ export declare class SmsCallbackWebhooks implements CallbackProcessor<SmsCallbac
|
|
|
13
13
|
* @return {SmsCallback} - The parsed SMS event object
|
|
14
14
|
*/
|
|
15
15
|
parseEvent(eventBody: any): SmsCallback;
|
|
16
|
+
/**
|
|
17
|
+
* Static reviver for an SMS Event.
|
|
18
|
+
* This method ensures the object can be treated as an SMS Event.
|
|
19
|
+
* @param {any} eventBody - The event body containing the SMS event notification.
|
|
20
|
+
* @return {SmsCallback} - The parsed SMS event object
|
|
21
|
+
*/
|
|
22
|
+
static parseEvent(eventBody: any): SmsCallback;
|
|
16
23
|
}
|
|
@@ -77,6 +77,16 @@ class SmsCallbackWebhooks {
|
|
|
77
77
|
throw new Error(`Unknown SMS event: ${JSON.stringify(eventBody)}`);
|
|
78
78
|
}
|
|
79
79
|
;
|
|
80
|
+
/**
|
|
81
|
+
* Static reviver for an SMS Event.
|
|
82
|
+
* This method ensures the object can be treated as an SMS Event.
|
|
83
|
+
* @param {any} eventBody - The event body containing the SMS event notification.
|
|
84
|
+
* @return {SmsCallback} - The parsed SMS event object
|
|
85
|
+
*/
|
|
86
|
+
static parseEvent(eventBody) {
|
|
87
|
+
const instance = new SmsCallbackWebhooks();
|
|
88
|
+
return instance.parseEvent(eventBody);
|
|
89
|
+
}
|
|
80
90
|
}
|
|
81
91
|
exports.SmsCallbackWebhooks = SmsCallbackWebhooks;
|
|
82
92
|
//# sourceMappingURL=callbacks-webhook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks-webhook.js","sourceRoot":"","sources":["../../../../src/rest/v1/callbacks/callbacks-webhook.ts"],"names":[],"mappings":";;;AACA,kDAAgF;AAKhF,MAAa,mBAAmB;IAI9B,YAAY,SAAkB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEM,4BAA4B,CACjC,OAA4B,EAC5B,IAAS;IACT,6DAA6D;IAC7D,KAAc,EAAE,OAAgB;QAEhC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAA,qCAAwB,EAC7B,IAAI,CAAC,SAAS,EACd,OAAO,EACP,IAAI,CACL,CAAC;IACJ,CAAC;IAED;;;;;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,SAAS,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,uBAAuB,GAAmC,IAAI,CAAC;YACnE,IAAI,MAAM,GAAkB,IAAI,CAAC;YACjC,IAAI,QAAQ,GAAoB,IAAI,CAAC;YACrC,IAAI,OAAO,GAAmB,IAAI,CAAC;YACnC,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"callbacks-webhook.js","sourceRoot":"","sources":["../../../../src/rest/v1/callbacks/callbacks-webhook.ts"],"names":[],"mappings":";;;AAC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AAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IAAA,CAAC;IAEF;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAC,SAAc;QACrC,MAAM,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC3C,OAAO,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;CAEF;AAlGD,kDAkGC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import { ApiListPromise } from '@sinch/sdk-client';
|
|
1
2
|
import { DeliveryReport, GetDeliveryReportByBatchIdRequestData, GetDeliveryReportByPhoneNumberRequestData, ListDeliveryReportsRequestData, RecipientDeliveryReport } from '../../../models';
|
|
2
|
-
import { ApiListPromise, SinchClientParameters } from '@sinch/sdk-client';
|
|
3
3
|
import { SmsDomainApi } from '../sms-domain-api';
|
|
4
|
+
import { LazySmsApiClient } from '../sms-service';
|
|
4
5
|
export declare class DeliveryReportsApi extends SmsDomainApi {
|
|
5
|
-
|
|
6
|
-
* Initialize your interface
|
|
7
|
-
*
|
|
8
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
9
|
-
*/
|
|
10
|
-
constructor(sinchClientParameters: SinchClientParameters);
|
|
6
|
+
constructor(lazyClient: LazySmsApiClient);
|
|
11
7
|
/**
|
|
12
8
|
* Retrieve a delivery report
|
|
13
9
|
* Delivery reports can be retrieved even if no callback was requested. The difference between a summary and a full report is only that the full report contains the phone numbers in <a href=\"https://community.sinch.com/t5/Glossary/E-164/ta-p/7537\" target=\"_blank\">E.164</a> format for each status code.
|
|
@@ -26,5 +22,5 @@ export declare class DeliveryReportsApi extends SmsDomainApi {
|
|
|
26
22
|
* @param { ListDeliveryReportsRequestData } data - The data to provide to the API call.
|
|
27
23
|
* @return {ApiListPromise<RecipientDeliveryReport>}
|
|
28
24
|
*/
|
|
29
|
-
list(data
|
|
25
|
+
list(data?: ListDeliveryReportsRequestData): ApiListPromise<RecipientDeliveryReport>;
|
|
30
26
|
}
|
|
@@ -4,13 +4,8 @@ exports.DeliveryReportsApi = void 0;
|
|
|
4
4
|
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
5
|
const sms_domain_api_1 = require("../sms-domain-api");
|
|
6
6
|
class DeliveryReportsApi extends sms_domain_api_1.SmsDomainApi {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
11
|
-
*/
|
|
12
|
-
constructor(sinchClientParameters) {
|
|
13
|
-
super(sinchClientParameters, 'DeliveryReportsApi');
|
|
7
|
+
constructor(lazyClient) {
|
|
8
|
+
super(lazyClient, 'DeliveryReportsApi');
|
|
14
9
|
}
|
|
15
10
|
/**
|
|
16
11
|
* Retrieve a delivery report
|
|
@@ -18,7 +13,6 @@ class DeliveryReportsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
18
13
|
* @param { GetDeliveryReportByBatchIdRequestData } data - The data to provide to the API call.
|
|
19
14
|
*/
|
|
20
15
|
async get(data) {
|
|
21
|
-
this.client = this.getSinchClient();
|
|
22
16
|
const getParams = this.client.extractQueryParams(data, ['type', 'status', 'code']);
|
|
23
17
|
const headers = {
|
|
24
18
|
'Content-Type': 'application/json',
|
|
@@ -41,7 +35,6 @@ class DeliveryReportsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
41
35
|
* @param { GetDeliveryReportByPhoneNumberRequestData } data - The data to provide to the API call.
|
|
42
36
|
*/
|
|
43
37
|
async getForNumber(data) {
|
|
44
|
-
this.client = this.getSinchClient();
|
|
45
38
|
const getParams = this.client.extractQueryParams(data, []);
|
|
46
39
|
const headers = {
|
|
47
40
|
'Content-Type': 'application/json',
|
|
@@ -73,8 +66,7 @@ class DeliveryReportsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
73
66
|
* @return {ApiListPromise<RecipientDeliveryReport>}
|
|
74
67
|
*/
|
|
75
68
|
list(data) {
|
|
76
|
-
|
|
77
|
-
const getParams = this.client.extractQueryParams(data, ['page', 'page_size', 'start_date', 'end_date', 'status', 'code', 'client_reference']);
|
|
69
|
+
const getParams = this.client.extractQueryParams(data ?? {}, ['page', 'page_size', 'start_date', 'end_date', 'status', 'code', 'client_reference']);
|
|
78
70
|
const headers = {
|
|
79
71
|
'Content-Type': 'application/json',
|
|
80
72
|
'Accept': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-reports-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/delivery-reports/delivery-reports-api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"delivery-reports-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/delivery-reports/delivery-reports-api.ts"],"names":[],"mappings":";;;AAAA,kDAO2B;AAQ3B,sDAAiD;AAGjD,MAAa,kBAAmB,SAAQ,6BAAY;IAElD,YAAY,UAA4B;QACtC,KAAK,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,IAA2C;QAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAC9C,IAAI,EACJ,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAC3B,CAAC;QACF,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,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,YAAY,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;QAE5J,MAAM,cAAc,GAChB,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAA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AI,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,EAAE,mBAAmB,CAAC,CACxE,CAAC;QAEF,OAAO,WAAsD,CAAC;IAChE,CAAC;CAEF;AArHD,gDAqHC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./delivery-reports-api"), exports);
|
|
18
|
+
__exportStar(require("./delivery-reports-api.jest.fixture"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/delivery-reports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/delivery-reports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,sEAAoD"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import { ApiListPromise } from '@sinch/sdk-client';
|
|
1
2
|
import { CreateGroupRequestData, DeleteGroupRequestData, GetGroupRequestData, ListGroupsRequestData, ListMembersRequestData, ReplaceGroupRequestData, UpdateGroupRequestData, Group } from '../../../models';
|
|
2
|
-
import { ApiListPromise, SinchClientParameters } from '@sinch/sdk-client';
|
|
3
3
|
import { SmsDomainApi } from '../sms-domain-api';
|
|
4
|
+
import { LazySmsApiClient } from '../sms-service';
|
|
4
5
|
export declare class GroupsApi extends SmsDomainApi {
|
|
5
|
-
|
|
6
|
-
* Initialize your interface
|
|
7
|
-
*
|
|
8
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
9
|
-
*/
|
|
10
|
-
constructor(sinchClientParameters: SinchClientParameters);
|
|
6
|
+
constructor(lazyClient: LazySmsApiClient);
|
|
11
7
|
/**
|
|
12
8
|
* Create a group
|
|
13
9
|
* A group is a set of phone numbers (MSISDNs) that can be used as a target in the `send_batch_msg` operation. An MSISDN can only occur once in a group and any attempts to add a duplicate would be ignored but not rejected.
|
|
@@ -32,7 +28,7 @@ export declare class GroupsApi extends SmsDomainApi {
|
|
|
32
28
|
* @param { ListGroupsRequestData } data - The data to provide to the API call.
|
|
33
29
|
* @return {ApiListPromise<Group>}
|
|
34
30
|
*/
|
|
35
|
-
list(data
|
|
31
|
+
list(data?: ListGroupsRequestData): ApiListPromise<Group>;
|
|
36
32
|
/**
|
|
37
33
|
* Replace a group
|
|
38
34
|
* The replace operation will replace all parameters, including members, of an existing group with new values. Replacing a group targeted by a batch message scheduled in the future is allowed and changes will be reflected when the batch is sent.
|
|
@@ -4,13 +4,8 @@ exports.GroupsApi = void 0;
|
|
|
4
4
|
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
5
|
const sms_domain_api_1 = require("../sms-domain-api");
|
|
6
6
|
class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
11
|
-
*/
|
|
12
|
-
constructor(sinchClientParameters) {
|
|
13
|
-
super(sinchClientParameters, 'GroupsApi');
|
|
7
|
+
constructor(lazyClient) {
|
|
8
|
+
super(lazyClient, 'GroupsApi');
|
|
14
9
|
}
|
|
15
10
|
/**
|
|
16
11
|
* Create a group
|
|
@@ -18,7 +13,6 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
18
13
|
* @param { CreateGroupRequestData } data - The data to provide to the API call.
|
|
19
14
|
*/
|
|
20
15
|
async create(data) {
|
|
21
|
-
this.client = this.getSinchClient();
|
|
22
16
|
const getParams = this.client.extractQueryParams(data, []);
|
|
23
17
|
const headers = {
|
|
24
18
|
'Content-Type': 'application/json',
|
|
@@ -41,7 +35,6 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
41
35
|
* @param { DeleteGroupRequestData } data - The data to provide to the API call.
|
|
42
36
|
*/
|
|
43
37
|
async delete(data) {
|
|
44
|
-
this.client = this.getSinchClient();
|
|
45
38
|
const getParams = this.client.extractQueryParams(data, []);
|
|
46
39
|
const headers = {
|
|
47
40
|
'Content-Type': 'application/json',
|
|
@@ -64,7 +57,6 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
64
57
|
* @param { ListMembersRequestData } data - The data to provide to the API call.
|
|
65
58
|
*/
|
|
66
59
|
async listMembers(data) {
|
|
67
|
-
this.client = this.getSinchClient();
|
|
68
60
|
const getParams = this.client.extractQueryParams(data, []);
|
|
69
61
|
const headers = {
|
|
70
62
|
'Content-Type': 'application/json',
|
|
@@ -88,8 +80,7 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
88
80
|
* @return {ApiListPromise<Group>}
|
|
89
81
|
*/
|
|
90
82
|
list(data) {
|
|
91
|
-
|
|
92
|
-
const getParams = this.client.extractQueryParams(data, ['page', 'page_size']);
|
|
83
|
+
const getParams = this.client.extractQueryParams(data ?? {}, ['page', 'page_size']);
|
|
93
84
|
const headers = {
|
|
94
85
|
'Content-Type': 'application/json',
|
|
95
86
|
'Accept': 'application/json',
|
|
@@ -115,7 +106,6 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
115
106
|
* @param { ReplaceGroupRequestData } data - The data to provide to the API call.
|
|
116
107
|
*/
|
|
117
108
|
async replace(data) {
|
|
118
|
-
this.client = this.getSinchClient();
|
|
119
109
|
const getParams = this.client.extractQueryParams(data, []);
|
|
120
110
|
const headers = {
|
|
121
111
|
'Content-Type': 'application/json',
|
|
@@ -138,7 +128,6 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
138
128
|
* @param { GetGroupRequestData } data - The data to provide to the API call.
|
|
139
129
|
*/
|
|
140
130
|
async get(data) {
|
|
141
|
-
this.client = this.getSinchClient();
|
|
142
131
|
const getParams = this.client.extractQueryParams(data, []);
|
|
143
132
|
const headers = {
|
|
144
133
|
'Content-Type': 'application/json',
|
|
@@ -161,7 +150,6 @@ class GroupsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
161
150
|
* @param { UpdateGroupRequestData } data - The data to provide to the API call.
|
|
162
151
|
*/
|
|
163
152
|
async update(data) {
|
|
164
|
-
this.client = this.getSinchClient();
|
|
165
153
|
const getParams = this.client.extractQueryParams(data, []);
|
|
166
154
|
const headers = {
|
|
167
155
|
'Content-Type': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/groups/groups-api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"groups-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/groups/groups-api.ts"],"names":[],"mappings":";;;AAAA,kDAO2B;AAW3B,sDAAiD;AAGjD,MAAa,SAAU,SAAQ,6BAAY;IAEzC,YAAY,UAA4B;QACtC,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,IAA4B;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAyB,IAAI,EAAE,EAAa,CAAC,CAAC;QAC9F,MAAM,OAAO,GAA0C;YACrD,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;QAEF,MAAM,IAAI,GAAgB,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjH,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,SAAS,CAAC;QAEvH,MA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perty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./groups-api"), exports);
|
|
18
|
+
__exportStar(require("./groups-api.jest.fixture"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/groups/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/groups/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,4DAA0C"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
+
import { ApiListPromise } from '@sinch/sdk-client';
|
|
1
2
|
import { GetInboundMessageRequestData, InboundMessageResponse, ListInboundMessagesRequestData } from '../../../models';
|
|
2
|
-
import { ApiListPromise, SinchClientParameters } from '@sinch/sdk-client';
|
|
3
3
|
import { SmsDomainApi } from '../sms-domain-api';
|
|
4
|
+
import { LazySmsApiClient } from '../sms-service';
|
|
4
5
|
export declare class InboundsApi extends SmsDomainApi {
|
|
5
|
-
|
|
6
|
-
* Initialize your interface
|
|
7
|
-
*
|
|
8
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
9
|
-
*/
|
|
10
|
-
constructor(sinchClientParameters: SinchClientParameters);
|
|
6
|
+
constructor(lazyClient: LazySmsApiClient);
|
|
11
7
|
/**
|
|
12
8
|
* List incoming messages
|
|
13
9
|
* With the list operation, you can list all inbound messages that you have received. This operation supports pagination. Inbounds are returned in reverse chronological order.
|
|
14
10
|
* @param { ListInboundMessagesRequestData } data - The data to provide to the API call.
|
|
15
11
|
* @return {ApiListPromise<InboundMessageResponse>}
|
|
16
12
|
*/
|
|
17
|
-
list(data
|
|
13
|
+
list(data?: ListInboundMessagesRequestData): ApiListPromise<InboundMessageResponse>;
|
|
18
14
|
/**
|
|
19
15
|
* Retrieve inbound message
|
|
20
16
|
* This operation retrieves a specific inbound message with the provided inbound ID.
|
|
@@ -4,13 +4,8 @@ exports.InboundsApi = void 0;
|
|
|
4
4
|
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
5
|
const sms_domain_api_1 = require("../sms-domain-api");
|
|
6
6
|
class InboundsApi extends sms_domain_api_1.SmsDomainApi {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @param {SinchClientParameters} sinchClientParameters - The parameters used to initialize the API Client.
|
|
11
|
-
*/
|
|
12
|
-
constructor(sinchClientParameters) {
|
|
13
|
-
super(sinchClientParameters, 'InboundsApi');
|
|
7
|
+
constructor(lazyClient) {
|
|
8
|
+
super(lazyClient, 'InboundsApi');
|
|
14
9
|
}
|
|
15
10
|
/**
|
|
16
11
|
* List incoming messages
|
|
@@ -19,8 +14,7 @@ class InboundsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
19
14
|
* @return {ApiListPromise<InboundMessageResponse>}
|
|
20
15
|
*/
|
|
21
16
|
list(data) {
|
|
22
|
-
|
|
23
|
-
const getParams = this.client.extractQueryParams(data, ['page', 'page_size', 'to', 'start_date', 'end_date', 'client_reference']);
|
|
17
|
+
const getParams = this.client.extractQueryParams(data ?? {}, ['page', 'page_size', 'to', 'start_date', 'end_date', 'client_reference']);
|
|
24
18
|
const headers = {
|
|
25
19
|
'Content-Type': 'application/json',
|
|
26
20
|
'Accept': 'application/json',
|
|
@@ -46,7 +40,6 @@ class InboundsApi extends sms_domain_api_1.SmsDomainApi {
|
|
|
46
40
|
* @param { GetInboundMessageRequestData } data - The data to provide to the API call.
|
|
47
41
|
*/
|
|
48
42
|
async get(data) {
|
|
49
|
-
this.client = this.getSinchClient();
|
|
50
43
|
const getParams = this.client.extractQueryParams(data, []);
|
|
51
44
|
const headers = {
|
|
52
45
|
'Content-Type': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbounds-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/inbounds/inbounds-api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"inbounds-api.js","sourceRoot":"","sources":["../../../../src/rest/v1/inbounds/inbounds-api.ts"],"names":[],"mappings":";;;AAAA,kDAO2B;AAM3B,sDAAiD;AAGjD,MAAa,WAAY,SAAQ,6BAAY;IAE3C,YAAY,UAA4B;QACtC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,IAAqC;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAC9C,IAAI,IAAI,EAAE,EACV,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAC1E,CAAC;QACF,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,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,WAAW,CAAC;QAEzH,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CACtD,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;QAE7D,MAAM,mBAAmB,GAA2B;YAClD,UAAU,EAAE,2BAAc,CAAC,IAAI;YAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,qBAAqB;YAClC,OAAO,EAAE,UAAU;SACpB,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,WAAqD,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,IAAkC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAA+B,IAAI,EAAE,EAAa,CAAC,CAAC;QACpG,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,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,aAAa,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QAE/I,MAAM,cAAc,GAChB,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;QAChG,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;QAExF,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAyB;YACrD,GAAG;YACH,cAAc;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,wBAAwB;SACtC,CAAC,CAAC;IACL,CAAC;CAEF;AA9ED,kCA8EC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./inbounds-api"), exports);
|
|
18
|
+
__exportStar(require("./inbounds-api.jest.fixture"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/inbounds/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rest/v1/inbounds/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,8DAA4C"}
|
package/dist/rest/v1/index.d.ts
CHANGED
package/dist/rest/v1/index.js
CHANGED
|
@@ -20,6 +20,6 @@ __exportStar(require("./delivery-reports"), exports);
|
|
|
20
20
|
__exportStar(require("./groups"), exports);
|
|
21
21
|
__exportStar(require("./inbounds"), exports);
|
|
22
22
|
__exportStar(require("./enums"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./sms-domain-api"), exports);
|
|
24
24
|
__exportStar(require("./sms-service"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rest/v1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rest/v1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB;AACxB,mDAAiC;AACjC,gDAA8B"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { Api, ApiClient,
|
|
2
|
-
|
|
1
|
+
import { Api, ApiClient, SmsRegion, UnifiedCredentials, ServicePlanIdCredentials } from '@sinch/sdk-client';
|
|
2
|
+
import { LazySmsApiClient } from './sms-service';
|
|
3
3
|
export declare class SmsDomainApi implements Api {
|
|
4
|
+
readonly lazyClient: LazySmsApiClient;
|
|
4
5
|
readonly apiName: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
constructor(lazyClient: LazySmsApiClient, 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;
|
|
8
14
|
/**
|
|
9
15
|
* Update the default hostname for the API
|
|
10
16
|
* @param {string} hostname - The new hostname to use for the APIs.
|
|
@@ -19,14 +25,5 @@ export declare class SmsDomainApi implements Api {
|
|
|
19
25
|
* Updates the credentials used to authenticate API requests
|
|
20
26
|
* @param {UnifiedCredentials | ServicePlanIdCredentials} credentials
|
|
21
27
|
*/
|
|
22
|
-
setCredentials(credentials: UnifiedCredentials | ServicePlanIdCredentials): void;
|
|
23
|
-
private resetApiClient;
|
|
24
|
-
/**
|
|
25
|
-
* Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
|
|
26
|
-
* be returned for the subsequent API calls (singleton pattern)
|
|
27
|
-
* @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
getSinchClient(): ApiClient;
|
|
31
|
-
private buildHostname;
|
|
28
|
+
setCredentials(credentials: Partial<UnifiedCredentials | ServicePlanIdCredentials>): void;
|
|
32
29
|
}
|
|
@@ -1,93 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SmsDomainApi =
|
|
4
|
-
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
|
-
exports.DEFAULT_SMS_REGION_DEPRECATION_WARNING = '** DEPRECATION NOTICE ** '
|
|
6
|
-
+ 'The "smsRegion" property will become mandatory in the next major version of the SDK and not default '
|
|
7
|
-
+ 'to "us" anymore. Please set it to a valid region.';
|
|
3
|
+
exports.SmsDomainApi = void 0;
|
|
8
4
|
class SmsDomainApi {
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
5
|
+
constructor(lazyClient, apiName) {
|
|
6
|
+
this.lazyClient = lazyClient;
|
|
11
7
|
this.apiName = apiName;
|
|
12
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
|
+
}
|
|
13
20
|
/**
|
|
14
21
|
* Update the default hostname for the API
|
|
15
22
|
* @param {string} hostname - The new hostname to use for the APIs.
|
|
16
23
|
*/
|
|
17
24
|
setHostname(hostname) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.sinchClientParameters.smsHostname = hostname;
|
|
21
|
-
this.client = this.getSinchClient();
|
|
22
|
-
this.client.apiClientOptions.hostname = hostname;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.error('Impossible to set a new hostname, the Application credentials need to be provided first.');
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
25
|
+
this.lazyClient.sharedConfig.smsHostname = hostname;
|
|
26
|
+
this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
29
|
* Update the region in the basePath
|
|
31
30
|
* @param {SmsRegion} region - The new region to send the requests to
|
|
32
31
|
*/
|
|
33
32
|
setRegion(region) {
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
const useZapStack = !this.client.apiClientOptions.useServicePlanId;
|
|
37
|
-
this.client.apiClientOptions.hostname = this.buildHostname(region, useZapStack);
|
|
38
|
-
}
|
|
33
|
+
this.lazyClient.sharedConfig.smsRegion = region;
|
|
34
|
+
this.lazyClient.resetApiClient();
|
|
39
35
|
}
|
|
40
36
|
/**
|
|
41
37
|
* Updates the credentials used to authenticate API requests
|
|
42
38
|
* @param {UnifiedCredentials | ServicePlanIdCredentials} credentials
|
|
43
39
|
*/
|
|
44
40
|
setCredentials(credentials) {
|
|
45
|
-
const parametersBackup = { ...this.
|
|
46
|
-
this.
|
|
41
|
+
const parametersBackup = { ...this.lazyClient.sharedConfig };
|
|
42
|
+
this.lazyClient.sharedConfig = {
|
|
47
43
|
...parametersBackup,
|
|
48
44
|
...credentials,
|
|
49
45
|
};
|
|
50
|
-
this.resetApiClient();
|
|
46
|
+
this.lazyClient.resetApiClient();
|
|
51
47
|
try {
|
|
52
|
-
this.
|
|
48
|
+
this.lazyClient.getApiClient();
|
|
53
49
|
}
|
|
54
50
|
catch (error) {
|
|
55
51
|
console.error('Impossible to assign the new credentials to the SMS API');
|
|
56
|
-
this.
|
|
52
|
+
this.lazyClient.sharedConfig = parametersBackup;
|
|
57
53
|
throw error;
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
|
-
resetApiClient() {
|
|
61
|
-
this.client = undefined;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
|
|
65
|
-
* be returned for the subsequent API calls (singleton pattern)
|
|
66
|
-
* @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
|
|
67
|
-
* @private
|
|
68
|
-
*/
|
|
69
|
-
getSinchClient() {
|
|
70
|
-
if (!this.client) {
|
|
71
|
-
const region = this.sinchClientParameters.smsRegion ?? sdk_client_1.SmsRegion.UNITED_STATES;
|
|
72
|
-
// Deprecation Notice - to remove in 2.0
|
|
73
|
-
if (!this.sinchClientParameters.smsRegion && !this.sinchClientParameters.smsHostname) {
|
|
74
|
-
console.warn(exports.DEFAULT_SMS_REGION_DEPRECATION_WARNING);
|
|
75
|
-
}
|
|
76
|
-
if (!Object.values(sdk_client_1.SupportedSmsRegion).includes(region)) {
|
|
77
|
-
console.warn(`The region "${region}" is not known as a supported region for the SMS API`);
|
|
78
|
-
}
|
|
79
|
-
const apiClientOptions = (0, sdk_client_1.buildFlexibleOAuth2OrApiTokenApiClientOptions)(this.sinchClientParameters);
|
|
80
|
-
this.client = new sdk_client_1.ApiFetchClient(apiClientOptions);
|
|
81
|
-
const useZapStack = !this.client.apiClientOptions.useServicePlanId;
|
|
82
|
-
this.client.apiClientOptions.hostname = this.sinchClientParameters.smsHostname
|
|
83
|
-
?? this.buildHostname(region, useZapStack);
|
|
84
|
-
}
|
|
85
|
-
return this.client;
|
|
86
|
-
}
|
|
87
|
-
buildHostname(region, useZapStack) {
|
|
88
|
-
const formattedRegion = region !== '' ? `${region}.` : '';
|
|
89
|
-
return (0, sdk_client_1.formatRegionalizedHostname)(sdk_client_1.SMS_HOSTNAME, `${useZapStack ? 'zt.' : ''}${formattedRegion}`);
|
|
90
|
-
}
|
|
91
56
|
}
|
|
92
57
|
exports.SmsDomainApi = SmsDomainApi;
|
|
93
58
|
//# sourceMappingURL=sms-domain-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sms-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v1/sms-domain-api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sms-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v1/sms-domain-api.ts"],"names":[],"mappings":";;;AASA,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;;;OAGG;IACI,SAAS,CAAC,MAAiB;QAChC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC;QAChD,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,WAAmE;QACvF,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,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;YACzE,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAEF;AA1DD,oCA0DC"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { SinchClientParameters, SmsRegion } from '@sinch/sdk-client';
|
|
1
|
+
import { ApiFetchClient, SinchClientParameters, SmsRegion, UnifiedCredentials } from '@sinch/sdk-client';
|
|
2
2
|
import { GroupsApi } from './groups';
|
|
3
3
|
import { DeliveryReportsApi } from './delivery-reports';
|
|
4
4
|
import { BatchesApi } from './batches';
|
|
5
5
|
import { InboundsApi } from './inbounds';
|
|
6
|
+
export declare const DEFAULT_SMS_REGION_DEPRECATION_WARNING: string;
|
|
7
|
+
export declare class LazySmsApiClient {
|
|
8
|
+
sharedConfig: SinchClientParameters;
|
|
9
|
+
private apiFetchClient?;
|
|
10
|
+
constructor(sharedConfig: SinchClientParameters);
|
|
11
|
+
getApiClient(): ApiFetchClient;
|
|
12
|
+
private buildHostname;
|
|
13
|
+
resetApiClient(): void;
|
|
14
|
+
}
|
|
6
15
|
/**
|
|
7
16
|
* The SMS Service exposes the following APIs:
|
|
8
17
|
* - groups
|
|
@@ -15,6 +24,7 @@ export declare class SmsService {
|
|
|
15
24
|
readonly deliveryReports: DeliveryReportsApi;
|
|
16
25
|
readonly batches: BatchesApi;
|
|
17
26
|
readonly inbounds: InboundsApi;
|
|
27
|
+
private readonly lazyClient;
|
|
18
28
|
/**
|
|
19
29
|
* Create a new SmsService instance with its configuration. This service can be instantiated with 2 different authentication mechanisms:
|
|
20
30
|
* - OAuth2: the required properties are `projectId`, `keyId` and `keySecret`
|
|
@@ -28,6 +38,7 @@ export declare class SmsService {
|
|
|
28
38
|
* @param {SinchClientParameters} params - an Object containing the necessary properties to initialize the service
|
|
29
39
|
*/
|
|
30
40
|
constructor(params: SinchClientParameters);
|
|
41
|
+
setApiClientConfig(newParams: SinchClientParameters): void;
|
|
31
42
|
/**
|
|
32
43
|
* Update the default hostname for each API
|
|
33
44
|
* @param {string} hostname - The new hostname to use for all the APIs.
|
|
@@ -38,4 +49,5 @@ export declare class SmsService {
|
|
|
38
49
|
* @param {SmsRegion} region - The new region to use in the production URL
|
|
39
50
|
*/
|
|
40
51
|
setRegion(region: SmsRegion): void;
|
|
52
|
+
setCredentials(credentials: Partial<UnifiedCredentials>): void;
|
|
41
53
|
}
|
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SmsService = void 0;
|
|
3
|
+
exports.SmsService = exports.LazySmsApiClient = exports.DEFAULT_SMS_REGION_DEPRECATION_WARNING = void 0;
|
|
4
|
+
const sdk_client_1 = require("@sinch/sdk-client");
|
|
4
5
|
const groups_1 = require("./groups");
|
|
5
6
|
const delivery_reports_1 = require("./delivery-reports");
|
|
6
7
|
const batches_1 = require("./batches");
|
|
7
8
|
const inbounds_1 = require("./inbounds");
|
|
9
|
+
exports.DEFAULT_SMS_REGION_DEPRECATION_WARNING = '** DEPRECATION NOTICE ** '
|
|
10
|
+
+ 'The "smsRegion" property will become mandatory in the next major version of the SDK and not default '
|
|
11
|
+
+ 'to "us" anymore. Please set it to a valid region.';
|
|
12
|
+
class LazySmsApiClient {
|
|
13
|
+
constructor(sharedConfig) {
|
|
14
|
+
this.sharedConfig = sharedConfig;
|
|
15
|
+
}
|
|
16
|
+
getApiClient() {
|
|
17
|
+
if (!this.apiFetchClient) {
|
|
18
|
+
const region = this.sharedConfig.smsRegion ?? sdk_client_1.SmsRegion.UNITED_STATES;
|
|
19
|
+
// Deprecation Notice - to remove in 2.0
|
|
20
|
+
if (!this.sharedConfig.smsRegion && !this.sharedConfig.smsHostname) {
|
|
21
|
+
console.warn(exports.DEFAULT_SMS_REGION_DEPRECATION_WARNING);
|
|
22
|
+
}
|
|
23
|
+
if (!Object.values(sdk_client_1.SupportedSmsRegion).includes(region)) {
|
|
24
|
+
console.warn(`The region "${region}" is not known as a supported region for the SMS API`);
|
|
25
|
+
}
|
|
26
|
+
const apiClientOptions = (0, sdk_client_1.buildFlexibleOAuth2OrApiTokenApiClientOptions)(this.sharedConfig);
|
|
27
|
+
this.apiFetchClient = new sdk_client_1.ApiFetchClient(apiClientOptions);
|
|
28
|
+
const useZapStack = !this.apiFetchClient.apiClientOptions.useServicePlanId;
|
|
29
|
+
this.apiFetchClient.apiClientOptions.hostname = this.sharedConfig.smsHostname
|
|
30
|
+
?? this.buildHostname(region, useZapStack);
|
|
31
|
+
}
|
|
32
|
+
return this.apiFetchClient;
|
|
33
|
+
}
|
|
34
|
+
buildHostname(region, useZapStack) {
|
|
35
|
+
const formattedRegion = region !== '' ? `${region}.` : '';
|
|
36
|
+
return (0, sdk_client_1.formatRegionalizedHostname)(sdk_client_1.SMS_HOSTNAME, `${useZapStack ? 'zt.' : ''}${formattedRegion}`);
|
|
37
|
+
}
|
|
38
|
+
resetApiClient() {
|
|
39
|
+
this.apiFetchClient = undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.LazySmsApiClient = LazySmsApiClient;
|
|
8
43
|
/**
|
|
9
44
|
* The SMS Service exposes the following APIs:
|
|
10
45
|
* - groups
|
|
@@ -26,30 +61,47 @@ class SmsService {
|
|
|
26
61
|
* @param {SinchClientParameters} params - an Object containing the necessary properties to initialize the service
|
|
27
62
|
*/
|
|
28
63
|
constructor(params) {
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
64
|
+
this.lazyClient = new LazySmsApiClient(params);
|
|
65
|
+
this.groups = new groups_1.GroupsApi(this.lazyClient);
|
|
66
|
+
this.deliveryReports = new delivery_reports_1.DeliveryReportsApi(this.lazyClient);
|
|
67
|
+
this.batches = new batches_1.BatchesApi(this.lazyClient);
|
|
68
|
+
this.inbounds = new inbounds_1.InboundsApi(this.lazyClient);
|
|
69
|
+
}
|
|
70
|
+
setApiClientConfig(newParams) {
|
|
71
|
+
this.lazyClient.sharedConfig = newParams;
|
|
72
|
+
this.lazyClient.resetApiClient();
|
|
33
73
|
}
|
|
34
74
|
/**
|
|
35
75
|
* Update the default hostname for each API
|
|
36
76
|
* @param {string} hostname - The new hostname to use for all the APIs.
|
|
37
77
|
*/
|
|
38
78
|
setHostname(hostname) {
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.batches.setHostname(hostname);
|
|
42
|
-
this.inbounds.setHostname(hostname);
|
|
79
|
+
this.lazyClient.sharedConfig.smsHostname = hostname;
|
|
80
|
+
this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
|
|
43
81
|
}
|
|
44
82
|
/**
|
|
45
83
|
* Update the current region for each API
|
|
46
84
|
* @param {SmsRegion} region - The new region to use in the production URL
|
|
47
85
|
*/
|
|
48
86
|
setRegion(region) {
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
87
|
+
this.lazyClient.sharedConfig.smsRegion = region;
|
|
88
|
+
this.lazyClient.resetApiClient();
|
|
89
|
+
}
|
|
90
|
+
setCredentials(credentials) {
|
|
91
|
+
const parametersBackup = { ...this.lazyClient.sharedConfig };
|
|
92
|
+
this.lazyClient.sharedConfig = {
|
|
93
|
+
...parametersBackup,
|
|
94
|
+
...credentials,
|
|
95
|
+
};
|
|
96
|
+
this.lazyClient.resetApiClient();
|
|
97
|
+
try {
|
|
98
|
+
this.lazyClient.getApiClient();
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.error('Impossible to assign the new credentials to the SMS API');
|
|
102
|
+
this.lazyClient.sharedConfig = parametersBackup;
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
53
105
|
}
|
|
54
106
|
}
|
|
55
107
|
exports.SmsService = SmsService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sms-service.js","sourceRoot":"","sources":["../../../src/rest/v1/sms-service.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sms-service.js","sourceRoot":"","sources":["../../../src/rest/v1/sms-service.ts"],"names":[],"mappings":";;;AAAA,kDAQ2B;AAC3B,qCAAqC;AACrC,yDAAwD;AACxD,uCAAuC;AACvC,yCAAyC;AAE5B,QAAA,sCAAsC,GAAG,2BAA2B;MAC7E,sGAAsG;MACtG,mDAAmD,CAAC;AAExD,MAAa,gBAAgB;IAE3B,YAAmB,YAAmC;QAAnC,iBAAY,GAAZ,YAAY,CAAuB;IAAG,CAAC;IAEnD,YAAY;QACjB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,M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CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;YACzE,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAnED,gCAmEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sinch/sms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Sinch SMS API",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test:e2e": "cucumber-js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sinch/sdk-client": "^1.
|
|
32
|
+
"@sinch/sdk-client": "^1.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {},
|
|
35
35
|
"publishConfig": {
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { BatchesApiFixture } from './batches/batches-api.jest.fixture';
|
|
2
|
-
export { DeliveryReportsApiFixture } from './delivery-reports/delivery-reports-api.jest.fixture';
|
|
3
|
-
export { GroupsApiFixture } from './groups/groups-api.jest.fixture';
|
|
4
|
-
export { InboundsApiFixture } from './inbounds/inbounds-api.jest.fixture';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InboundsApiFixture = exports.GroupsApiFixture = exports.DeliveryReportsApiFixture = exports.BatchesApiFixture = void 0;
|
|
4
|
-
var batches_api_jest_fixture_1 = require("./batches/batches-api.jest.fixture");
|
|
5
|
-
Object.defineProperty(exports, "BatchesApiFixture", { enumerable: true, get: function () { return batches_api_jest_fixture_1.BatchesApiFixture; } });
|
|
6
|
-
var delivery_reports_api_jest_fixture_1 = require("./delivery-reports/delivery-reports-api.jest.fixture");
|
|
7
|
-
Object.defineProperty(exports, "DeliveryReportsApiFixture", { enumerable: true, get: function () { return delivery_reports_api_jest_fixture_1.DeliveryReportsApiFixture; } });
|
|
8
|
-
var groups_api_jest_fixture_1 = require("./groups/groups-api.jest.fixture");
|
|
9
|
-
Object.defineProperty(exports, "GroupsApiFixture", { enumerable: true, get: function () { return groups_api_jest_fixture_1.GroupsApiFixture; } });
|
|
10
|
-
var inbounds_api_jest_fixture_1 = require("./inbounds/inbounds-api.jest.fixture");
|
|
11
|
-
Object.defineProperty(exports, "InboundsApiFixture", { enumerable: true, get: function () { return inbounds_api_jest_fixture_1.InboundsApiFixture; } });
|
|
12
|
-
//# sourceMappingURL=fixtures.jest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.jest.js","sourceRoot":"","sources":["../../../src/rest/v1/fixtures.jest.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AAA9D,6HAAA,iBAAiB,OAAA;AAC1B,0GAAiG;AAAxF,8IAAA,yBAAyB,OAAA;AAClC,4EAAoE;AAA3D,2HAAA,gBAAgB,OAAA;AACzB,kFAA0E;AAAjE,+HAAA,kBAAkB,OAAA"}
|