@sinch/sms 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/README.md +16 -0
- package/dist/models/v1/add-keyword/add-keyword.d.ts +13 -0
- package/dist/models/v1/{group-object-auto-update-remove/group-object-auto-update-remove.js → add-keyword/add-keyword.js} +1 -1
- package/dist/models/v1/add-keyword/add-keyword.js.map +1 -0
- package/dist/models/v1/add-keyword/index.d.ts +1 -0
- package/dist/models/v1/add-keyword/index.js.map +1 -0
- package/dist/models/v1/api-mo-message/api-mo-message.d.ts +4 -6
- package/dist/models/v1/api-update-binary-mt-message/api-update-binary-mt-message.d.ts +12 -3
- package/dist/models/v1/api-update-mms-mt-message/api-update-mms-mt-message.d.ts +8 -3
- package/dist/models/v1/api-update-text-mt-message/api-update-text-mt-message.d.ts +17 -2
- package/dist/models/v1/binary-request/binary-request.d.ts +2 -8
- package/dist/models/v1/binary-response/binary-response.d.ts +5 -10
- package/dist/models/v1/create-group-request/create-group-request.d.ts +5 -5
- package/dist/models/v1/enums.d.ts +14 -2
- package/dist/models/v1/group/group.d.ts +2 -2
- package/dist/models/v1/group-auto-update/group-auto-update.d.ts +7 -3
- package/dist/models/v1/inbound-message-response/inbound-message-response.d.ts +2 -1
- package/dist/models/v1/index.d.ts +7 -7
- package/dist/models/v1/index.js +7 -7
- package/dist/models/v1/index.js.map +1 -1
- package/dist/models/v1/media-body/media-body.d.ts +2 -0
- package/dist/models/v1/media-request/media-request.d.ts +5 -5
- package/dist/models/v1/media-response/media-response.d.ts +5 -5
- package/dist/models/v1/message-delivery-status/message-delivery-status.d.ts +4 -4
- package/dist/models/v1/mms-media/index.d.ts +1 -0
- package/dist/models/v1/mms-media/index.js.map +1 -0
- package/dist/models/v1/mms-media/mms-media.d.ts +13 -0
- package/dist/models/v1/mms-media/mms-media.js +3 -0
- package/dist/models/v1/mms-media/mms-media.js.map +1 -0
- package/dist/models/v1/mms-mo-body/index.d.ts +1 -0
- package/dist/models/v1/mms-mo-body/index.js.map +1 -0
- package/dist/models/v1/mms-mo-body/mms-mo-body.d.ts +12 -0
- package/dist/models/v1/mms-mo-body/mms-mo-body.js +3 -0
- package/dist/models/v1/mms-mo-body/mms-mo-body.js.map +1 -0
- package/dist/models/v1/mo-binary/mo-binary.d.ts +1 -1
- package/dist/models/v1/mo-media/index.d.ts +1 -0
- package/dist/models/v1/mo-media/index.js.map +1 -0
- package/dist/models/v1/mo-media/mo-media.d.ts +8 -0
- package/dist/models/v1/mo-media/mo-media.js +3 -0
- package/dist/models/v1/mo-media/mo-media.js.map +1 -0
- package/dist/models/v1/recipient-delivery-report/recipient-delivery-report.d.ts +4 -4
- package/dist/models/v1/remove-keyword/index.d.ts +1 -0
- package/dist/models/v1/remove-keyword/index.js.map +1 -0
- package/dist/models/v1/remove-keyword/remove-keyword.d.ts +13 -0
- package/dist/models/v1/{update-group-request-auto-update-add/update-group-request-auto-update-add.js → remove-keyword/remove-keyword.js} +1 -1
- package/dist/models/v1/remove-keyword/remove-keyword.js.map +1 -0
- package/dist/models/v1/replace-group-request/replace-group-request.d.ts +6 -1
- package/dist/models/v1/requests/delivery-reports/delivery-reports-request-data.d.ts +13 -9
- package/dist/models/v1/requests/groups/groups-request-data.d.ts +3 -3
- package/dist/models/v1/text-request/text-request.d.ts +2 -2
- package/dist/models/v1/text-response/text-response.d.ts +1 -1
- package/dist/models/v1/update-group-request/update-group-request.d.ts +3 -3
- 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 +12 -3
- package/dist/rest/v1/callbacks/callbacks-webhook.js +34 -6
- 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 -14
- package/dist/rest/v1/sms-domain-api.js +22 -48
- 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/models/v1/group-object-auto-update/group-object-auto-update.d.ts +0 -10
- package/dist/models/v1/group-object-auto-update/group-object-auto-update.js +0 -3
- package/dist/models/v1/group-object-auto-update/group-object-auto-update.js.map +0 -1
- package/dist/models/v1/group-object-auto-update/index.d.ts +0 -1
- package/dist/models/v1/group-object-auto-update/index.js.map +0 -1
- package/dist/models/v1/group-object-auto-update-remove/group-object-auto-update-remove.d.ts +0 -13
- package/dist/models/v1/group-object-auto-update-remove/group-object-auto-update-remove.js.map +0 -1
- package/dist/models/v1/group-object-auto-update-remove/index.d.ts +0 -1
- package/dist/models/v1/group-object-auto-update-remove/index.js.map +0 -1
- package/dist/models/v1/update-group-request-auto-update/index.d.ts +0 -1
- package/dist/models/v1/update-group-request-auto-update/index.js.map +0 -1
- package/dist/models/v1/update-group-request-auto-update/update-group-request-auto-update.d.ts +0 -10
- package/dist/models/v1/update-group-request-auto-update/update-group-request-auto-update.js +0 -3
- package/dist/models/v1/update-group-request-auto-update/update-group-request-auto-update.js.map +0 -1
- package/dist/models/v1/update-group-request-auto-update-add/index.d.ts +0 -1
- package/dist/models/v1/update-group-request-auto-update-add/index.js.map +0 -1
- package/dist/models/v1/update-group-request-auto-update-add/update-group-request-auto-update-add.d.ts +0 -10
- package/dist/models/v1/update-group-request-auto-update-add/update-group-request-auto-update-add.js.map +0 -1
- package/dist/models/v1/update-group-request-auto-update-remove/index.d.ts +0 -1
- package/dist/models/v1/update-group-request-auto-update-remove/index.js.map +0 -1
- package/dist/models/v1/update-group-request-auto-update-remove/update-group-request-auto-update-remove.d.ts +0 -13
- package/dist/models/v1/update-group-request-auto-update-remove/update-group-request-auto-update-remove.js +0 -8
- package/dist/models/v1/update-group-request-auto-update-remove/update-group-request-auto-update-remove.js.map +0 -1
- 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/dist/models/v1/{group-object-auto-update-remove → add-keyword}/index.js +0 -0
- /package/dist/models/v1/{group-object-auto-update → mms-media}/index.js +0 -0
- /package/dist/models/v1/{update-group-request-auto-update-add → mms-mo-body}/index.js +0 -0
- /package/dist/models/v1/{update-group-request-auto-update-remove → mo-media}/index.js +0 -0
- /package/dist/models/v1/{update-group-request-auto-update → remove-keyword}/index.js +0 -0
|
@@ -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":";;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GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,WAAW,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,WAAW,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAE3I,MAAM,cAAc,GAChB,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC,CAAC;QACjG,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,CAAQ;YACpC,GAAG;YACH,cAAc;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,aAAa;SAC3B,CAAC,CAAC;IACL,CAAC;CAEF;AAlND,8BAkNC"}
|
|
@@ -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("./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,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AC,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,9 +1,16 @@
|
|
|
1
|
-
import { Api, ApiClient,
|
|
1
|
+
import { Api, ApiClient, SmsRegion, UnifiedCredentials, ServicePlanIdCredentials } from '@sinch/sdk-client';
|
|
2
|
+
import { LazySmsApiClient } from './sms-service';
|
|
2
3
|
export declare class SmsDomainApi implements Api {
|
|
4
|
+
readonly lazyClient: LazySmsApiClient;
|
|
3
5
|
readonly apiName: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
7
14
|
/**
|
|
8
15
|
* Update the default hostname for the API
|
|
9
16
|
* @param {string} hostname - The new hostname to use for the APIs.
|
|
@@ -18,14 +25,5 @@ export declare class SmsDomainApi implements Api {
|
|
|
18
25
|
* Updates the credentials used to authenticate API requests
|
|
19
26
|
* @param {UnifiedCredentials | ServicePlanIdCredentials} credentials
|
|
20
27
|
*/
|
|
21
|
-
setCredentials(credentials: UnifiedCredentials | ServicePlanIdCredentials): 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;
|
|
28
|
+
setCredentials(credentials: Partial<UnifiedCredentials | ServicePlanIdCredentials>): void;
|
|
31
29
|
}
|
|
@@ -1,84 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SmsDomainApi = void 0;
|
|
4
|
-
const sdk_client_1 = require("@sinch/sdk-client");
|
|
5
4
|
class SmsDomainApi {
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
this.client.apiClientOptions.hostname = hostname;
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
console.error('Impossible to set a new hostname, the Application credentials need to be provided first.');
|
|
21
|
-
throw error;
|
|
22
|
-
}
|
|
25
|
+
this.lazyClient.sharedConfig.smsHostname = hostname;
|
|
26
|
+
this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
29
|
* Update the region in the basePath
|
|
26
30
|
* @param {SmsRegion} region - The new region to send the requests to
|
|
27
31
|
*/
|
|
28
32
|
setRegion(region) {
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
const useZapStack = !this.client.apiClientOptions.useServicePlanId;
|
|
32
|
-
this.client.apiClientOptions.hostname = this.buildHostname(region, useZapStack);
|
|
33
|
-
}
|
|
33
|
+
this.lazyClient.sharedConfig.smsRegion = region;
|
|
34
|
+
this.lazyClient.resetApiClient();
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Updates the credentials used to authenticate API requests
|
|
37
38
|
* @param {UnifiedCredentials | ServicePlanIdCredentials} credentials
|
|
38
39
|
*/
|
|
39
40
|
setCredentials(credentials) {
|
|
40
|
-
const parametersBackup = { ...this.
|
|
41
|
-
this.
|
|
41
|
+
const parametersBackup = { ...this.lazyClient.sharedConfig };
|
|
42
|
+
this.lazyClient.sharedConfig = {
|
|
42
43
|
...parametersBackup,
|
|
43
44
|
...credentials,
|
|
44
45
|
};
|
|
45
|
-
this.resetApiClient();
|
|
46
|
+
this.lazyClient.resetApiClient();
|
|
46
47
|
try {
|
|
47
|
-
this.
|
|
48
|
+
this.lazyClient.getApiClient();
|
|
48
49
|
}
|
|
49
50
|
catch (error) {
|
|
50
51
|
console.error('Impossible to assign the new credentials to the SMS API');
|
|
51
|
-
this.
|
|
52
|
+
this.lazyClient.sharedConfig = parametersBackup;
|
|
52
53
|
throw error;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
resetApiClient() {
|
|
56
|
-
this.client = undefined;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
|
|
60
|
-
* be returned for the subsequent API calls (singleton pattern)
|
|
61
|
-
* @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
getSinchClient() {
|
|
65
|
-
if (!this.client) {
|
|
66
|
-
const region = this.sinchClientParameters.smsRegion ?? sdk_client_1.SmsRegion.UNITED_STATES;
|
|
67
|
-
if (!Object.values(sdk_client_1.SupportedSmsRegion).includes(region)) {
|
|
68
|
-
console.warn(`The region "${region}" is not known as a supported region for the SMS API`);
|
|
69
|
-
}
|
|
70
|
-
const apiClientOptions = (0, sdk_client_1.buildFlexibleOAuth2OrApiTokenApiClientOptions)(this.sinchClientParameters);
|
|
71
|
-
this.client = new sdk_client_1.ApiFetchClient(apiClientOptions);
|
|
72
|
-
const useZapStack = !this.client.apiClientOptions.useServicePlanId;
|
|
73
|
-
this.client.apiClientOptions.hostname = this.sinchClientParameters.smsHostname
|
|
74
|
-
?? this.buildHostname(region, useZapStack);
|
|
75
|
-
}
|
|
76
|
-
return this.client;
|
|
77
|
-
}
|
|
78
|
-
buildHostname(region, useZapStack) {
|
|
79
|
-
const formattedRegion = region !== '' ? `${region}.` : '';
|
|
80
|
-
return (0, sdk_client_1.formatRegionalizedHostname)(sdk_client_1.SMS_HOSTNAME, `${useZapStack ? 'zt.' : ''}${formattedRegion}`);
|
|
81
|
-
}
|
|
82
56
|
}
|
|
83
57
|
exports.SmsDomainApi = SmsDomainApi;
|
|
84
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":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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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AU,CAAC,cAAc,EAAE,CAAC;IACnC,CAAC;IAEM,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,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,10 +0,0 @@
|
|
|
1
|
-
import { GroupObjectAutoUpdateRemove } from '../group-object-auto-update-remove';
|
|
2
|
-
import { UpdateGroupRequestAutoUpdateAdd } from '../update-group-request-auto-update-add';
|
|
3
|
-
export interface GroupObjectAutoUpdate {
|
|
4
|
-
/** Short code or long number addressed in <a href=\"https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618\" target=\"_blank\">MO</a>. Constraints: Must be valid phone number or short code. */
|
|
5
|
-
to?: string;
|
|
6
|
-
/** @see UpdateGroupRequestAutoUpdateAdd */
|
|
7
|
-
add?: UpdateGroupRequestAutoUpdateAdd;
|
|
8
|
-
/** @see GroupObjectAutoUpdateRemove */
|
|
9
|
-
remove?: GroupObjectAutoUpdateRemove;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group-object-auto-update.js","sourceRoot":"","sources":["../../../../src/models/v1/group-object-auto-update/group-object-auto-update.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { GroupObjectAutoUpdate } from './group-object-auto-update';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/group-object-auto-update/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keyword to be sent in MO to remove from a group.
|
|
3
|
-
*/
|
|
4
|
-
export interface GroupObjectAutoUpdateRemove {
|
|
5
|
-
/** Opt-out keyword like \"LEAVE\" If auto_update.to is dedicated long/short number or unique brand keyword like \"Sinch\" if it is a shared short code. Constraints: Must be one word. */
|
|
6
|
-
first_word?: string;
|
|
7
|
-
/** Opt-out keyword like \"LEAVE\" if auto_update.to is shared short code. Constraints: Must be one word. */
|
|
8
|
-
second_word?: string;
|
|
9
|
-
}
|
|
10
|
-
/** Validation regex for first_word */
|
|
11
|
-
export declare const firstWordPattern: RegExp;
|
|
12
|
-
/** Validation regex for second_word */
|
|
13
|
-
export declare const secondWordPattern: RegExp;
|
package/dist/models/v1/group-object-auto-update-remove/group-object-auto-update-remove.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group-object-auto-update-remove.js","sourceRoot":"","sources":["../../../../src/models/v1/group-object-auto-update-remove/group-object-auto-update-remove.ts"],"names":[],"mappings":";;;AAYA,sCAAsC;AACzB,QAAA,gBAAgB,GAAG,OAAO,CAAC;AACxC,uCAAuC;AAC1B,QAAA,iBAAiB,GAAG,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { GroupObjectAutoUpdateRemove } from './group-object-auto-update-remove';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/group-object-auto-update-remove/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { UpdateGroupRequestAutoUpdate } from './update-group-request-auto-update';
|