@aws-sdk/client-socialmessaging 3.669.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/LICENSE +201 -0
- package/README.md +334 -0
- package/dist-cjs/SocialMessaging.js +37 -0
- package/dist-cjs/SocialMessagingClient.js +50 -0
- package/dist-cjs/auth/httpAuthExtensionConfiguration.js +43 -0
- package/dist-cjs/auth/httpAuthSchemeProvider.js +47 -0
- package/dist-cjs/commands/AssociateWhatsAppBusinessAccountCommand.js +27 -0
- package/dist-cjs/commands/DeleteWhatsAppMessageMediaCommand.js +26 -0
- package/dist-cjs/commands/DisassociateWhatsAppBusinessAccountCommand.js +26 -0
- package/dist-cjs/commands/GetLinkedWhatsAppBusinessAccountCommand.js +26 -0
- package/dist-cjs/commands/GetLinkedWhatsAppBusinessAccountPhoneNumberCommand.js +26 -0
- package/dist-cjs/commands/GetWhatsAppMessageMediaCommand.js +27 -0
- package/dist-cjs/commands/ListLinkedWhatsAppBusinessAccountsCommand.js +26 -0
- package/dist-cjs/commands/ListTagsForResourceCommand.js +26 -0
- package/dist-cjs/commands/PostWhatsAppMessageMediaCommand.js +27 -0
- package/dist-cjs/commands/PutWhatsAppBusinessAccountEventDestinationsCommand.js +26 -0
- package/dist-cjs/commands/SendWhatsAppMessageCommand.js +27 -0
- package/dist-cjs/commands/TagResourceCommand.js +26 -0
- package/dist-cjs/commands/UntagResourceCommand.js +26 -0
- package/dist-cjs/commands/index.js +16 -0
- package/dist-cjs/endpoint/EndpointParameters.js +18 -0
- package/dist-cjs/endpoint/endpointResolver.js +18 -0
- package/dist-cjs/endpoint/ruleset.js +7 -0
- package/dist-cjs/extensionConfiguration.js +2 -0
- package/dist-cjs/index.js +11 -0
- package/dist-cjs/models/SocialMessagingServiceException.js +12 -0
- package/dist-cjs/models/index.js +4 -0
- package/dist-cjs/models/models_0.js +173 -0
- package/dist-cjs/pagination/Interfaces.js +2 -0
- package/dist-cjs/pagination/ListLinkedWhatsAppBusinessAccountsPaginator.js +7 -0
- package/dist-cjs/pagination/index.js +5 -0
- package/dist-cjs/protocols/Aws_restJson1.js +573 -0
- package/dist-cjs/runtimeConfig.browser.js +39 -0
- package/dist-cjs/runtimeConfig.js +50 -0
- package/dist-cjs/runtimeConfig.native.js +15 -0
- package/dist-cjs/runtimeConfig.shared.js +34 -0
- package/dist-cjs/runtimeExtensions.js +25 -0
- package/dist-es/SocialMessaging.js +33 -0
- package/dist-es/SocialMessagingClient.js +46 -0
- package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
- package/dist-es/auth/httpAuthSchemeProvider.js +41 -0
- package/dist-es/commands/AssociateWhatsAppBusinessAccountCommand.js +23 -0
- package/dist-es/commands/DeleteWhatsAppMessageMediaCommand.js +22 -0
- package/dist-es/commands/DisassociateWhatsAppBusinessAccountCommand.js +22 -0
- package/dist-es/commands/GetLinkedWhatsAppBusinessAccountCommand.js +22 -0
- package/dist-es/commands/GetLinkedWhatsAppBusinessAccountPhoneNumberCommand.js +22 -0
- package/dist-es/commands/GetWhatsAppMessageMediaCommand.js +23 -0
- package/dist-es/commands/ListLinkedWhatsAppBusinessAccountsCommand.js +22 -0
- package/dist-es/commands/ListTagsForResourceCommand.js +22 -0
- package/dist-es/commands/PostWhatsAppMessageMediaCommand.js +23 -0
- package/dist-es/commands/PutWhatsAppBusinessAccountEventDestinationsCommand.js +22 -0
- package/dist-es/commands/SendWhatsAppMessageCommand.js +23 -0
- package/dist-es/commands/TagResourceCommand.js +22 -0
- package/dist-es/commands/UntagResourceCommand.js +22 -0
- package/dist-es/commands/index.js +13 -0
- package/dist-es/endpoint/EndpointParameters.js +14 -0
- package/dist-es/endpoint/endpointResolver.js +14 -0
- package/dist-es/endpoint/ruleset.js +4 -0
- package/dist-es/extensionConfiguration.js +1 -0
- package/dist-es/index.js +6 -0
- package/dist-es/models/SocialMessagingServiceException.js +8 -0
- package/dist-es/models/index.js +1 -0
- package/dist-es/models/models_0.js +152 -0
- package/dist-es/pagination/Interfaces.js +1 -0
- package/dist-es/pagination/ListLinkedWhatsAppBusinessAccountsPaginator.js +4 -0
- package/dist-es/pagination/index.js +2 -0
- package/dist-es/protocols/Aws_restJson1.js +544 -0
- package/dist-es/runtimeConfig.browser.js +34 -0
- package/dist-es/runtimeConfig.js +45 -0
- package/dist-es/runtimeConfig.native.js +11 -0
- package/dist-es/runtimeConfig.shared.js +30 -0
- package/dist-es/runtimeExtensions.js +21 -0
- package/dist-types/SocialMessaging.d.ts +128 -0
- package/dist-types/SocialMessagingClient.d.ts +207 -0
- package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
- package/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
- package/dist-types/commands/AssociateWhatsAppBusinessAccountCommand.d.ts +139 -0
- package/dist-types/commands/DeleteWhatsAppMessageMediaCommand.d.ts +97 -0
- package/dist-types/commands/DisassociateWhatsAppBusinessAccountCommand.d.ts +87 -0
- package/dist-types/commands/GetLinkedWhatsAppBusinessAccountCommand.d.ts +116 -0
- package/dist-types/commands/GetLinkedWhatsAppBusinessAccountPhoneNumberCommand.d.ts +103 -0
- package/dist-types/commands/GetWhatsAppMessageMediaCommand.d.ts +113 -0
- package/dist-types/commands/ListLinkedWhatsAppBusinessAccountsCommand.d.ts +106 -0
- package/dist-types/commands/ListTagsForResourceCommand.d.ts +93 -0
- package/dist-types/commands/PostWhatsAppMessageMediaCommand.d.ts +110 -0
- package/dist-types/commands/PutWhatsAppBusinessAccountEventDestinationsCommand.d.ts +90 -0
- package/dist-types/commands/SendWhatsAppMessageCommand.d.ts +99 -0
- package/dist-types/commands/TagResourceCommand.d.ts +94 -0
- package/dist-types/commands/UntagResourceCommand.d.ts +90 -0
- package/dist-types/commands/index.d.ts +13 -0
- package/dist-types/endpoint/EndpointParameters.d.ts +40 -0
- package/dist-types/endpoint/endpointResolver.d.ts +5 -0
- package/dist-types/endpoint/ruleset.d.ts +2 -0
- package/dist-types/extensionConfiguration.d.ts +9 -0
- package/dist-types/index.d.ts +39 -0
- package/dist-types/models/SocialMessagingServiceException.d.ts +14 -0
- package/dist-types/models/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +969 -0
- package/dist-types/pagination/Interfaces.d.ts +8 -0
- package/dist-types/pagination/ListLinkedWhatsAppBusinessAccountsPaginator.d.ts +7 -0
- package/dist-types/pagination/index.d.ts +2 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +119 -0
- package/dist-types/runtimeConfig.browser.d.ts +48 -0
- package/dist-types/runtimeConfig.d.ts +48 -0
- package/dist-types/runtimeConfig.native.d.ts +47 -0
- package/dist-types/runtimeConfig.shared.d.ts +21 -0
- package/dist-types/runtimeExtensions.d.ts +17 -0
- package/dist-types/ts3.4/SocialMessaging.d.ts +254 -0
- package/dist-types/ts3.4/SocialMessagingClient.d.ts +197 -0
- package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
- package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +44 -0
- package/dist-types/ts3.4/commands/AssociateWhatsAppBusinessAccountCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/DeleteWhatsAppMessageMediaCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/DisassociateWhatsAppBusinessAccountCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/GetLinkedWhatsAppBusinessAccountCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/GetLinkedWhatsAppBusinessAccountPhoneNumberCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/GetWhatsAppMessageMediaCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/ListLinkedWhatsAppBusinessAccountsCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/PostWhatsAppMessageMediaCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/PutWhatsAppBusinessAccountEventDestinationsCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/SendWhatsAppMessageCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +47 -0
- package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +47 -0
- package/dist-types/ts3.4/commands/index.d.ts +13 -0
- package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +51 -0
- package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
- package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
- package/dist-types/ts3.4/extensionConfiguration.d.ts +9 -0
- package/dist-types/ts3.4/index.d.ts +9 -0
- package/dist-types/ts3.4/models/SocialMessagingServiceException.d.ts +9 -0
- package/dist-types/ts3.4/models/index.d.ts +1 -0
- package/dist-types/ts3.4/models/models_0.d.ts +272 -0
- package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
- package/dist-types/ts3.4/pagination/ListLinkedWhatsAppBusinessAccountsPaginator.d.ts +11 -0
- package/dist-types/ts3.4/pagination/index.d.ts +2 -0
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +161 -0
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +93 -0
- package/dist-types/ts3.4/runtimeConfig.d.ts +96 -0
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +87 -0
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +23 -0
- package/dist-types/ts3.4/runtimeExtensions.d.ts +13 -0
- package/package.json +101 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
|
|
2
|
+
import { requestBuilder as rb } from "@smithy/core";
|
|
3
|
+
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
|
|
4
|
+
import { AccessDeniedByMetaException, AccessDeniedException, DependencyException, InternalServiceException, InvalidParametersException, ResourceNotFoundException, ThrottledRequestException, ValidationException, } from "../models/models_0";
|
|
5
|
+
import { SocialMessagingServiceException as __BaseException } from "../models/SocialMessagingServiceException";
|
|
6
|
+
export const se_AssociateWhatsAppBusinessAccountCommand = async (input, context) => {
|
|
7
|
+
const b = rb(input, context);
|
|
8
|
+
const headers = {
|
|
9
|
+
"content-type": "application/json",
|
|
10
|
+
};
|
|
11
|
+
b.bp("/v1/whatsapp/signup");
|
|
12
|
+
let body;
|
|
13
|
+
body = JSON.stringify(take(input, {
|
|
14
|
+
setupFinalization: (_) => _json(_),
|
|
15
|
+
signupCallback: (_) => _json(_),
|
|
16
|
+
}));
|
|
17
|
+
b.m("POST").h(headers).b(body);
|
|
18
|
+
return b.build();
|
|
19
|
+
};
|
|
20
|
+
export const se_DeleteWhatsAppMessageMediaCommand = async (input, context) => {
|
|
21
|
+
const b = rb(input, context);
|
|
22
|
+
const headers = {};
|
|
23
|
+
b.bp("/v1/whatsapp/media");
|
|
24
|
+
const query = map({
|
|
25
|
+
[_mI]: [, __expectNonNull(input[_mI], `mediaId`)],
|
|
26
|
+
[_oPNI]: [, __expectNonNull(input[_oPNI], `originationPhoneNumberId`)],
|
|
27
|
+
});
|
|
28
|
+
let body;
|
|
29
|
+
b.m("DELETE").h(headers).q(query).b(body);
|
|
30
|
+
return b.build();
|
|
31
|
+
};
|
|
32
|
+
export const se_DisassociateWhatsAppBusinessAccountCommand = async (input, context) => {
|
|
33
|
+
const b = rb(input, context);
|
|
34
|
+
const headers = {};
|
|
35
|
+
b.bp("/v1/whatsapp/waba/disassociate");
|
|
36
|
+
const query = map({
|
|
37
|
+
[_i]: [, __expectNonNull(input[_i], `id`)],
|
|
38
|
+
});
|
|
39
|
+
let body;
|
|
40
|
+
b.m("DELETE").h(headers).q(query).b(body);
|
|
41
|
+
return b.build();
|
|
42
|
+
};
|
|
43
|
+
export const se_GetLinkedWhatsAppBusinessAccountCommand = async (input, context) => {
|
|
44
|
+
const b = rb(input, context);
|
|
45
|
+
const headers = {};
|
|
46
|
+
b.bp("/v1/whatsapp/waba/details");
|
|
47
|
+
const query = map({
|
|
48
|
+
[_i]: [, __expectNonNull(input[_i], `id`)],
|
|
49
|
+
});
|
|
50
|
+
let body;
|
|
51
|
+
b.m("GET").h(headers).q(query).b(body);
|
|
52
|
+
return b.build();
|
|
53
|
+
};
|
|
54
|
+
export const se_GetLinkedWhatsAppBusinessAccountPhoneNumberCommand = async (input, context) => {
|
|
55
|
+
const b = rb(input, context);
|
|
56
|
+
const headers = {};
|
|
57
|
+
b.bp("/v1/whatsapp/waba/phone/details");
|
|
58
|
+
const query = map({
|
|
59
|
+
[_i]: [, __expectNonNull(input[_i], `id`)],
|
|
60
|
+
});
|
|
61
|
+
let body;
|
|
62
|
+
b.m("GET").h(headers).q(query).b(body);
|
|
63
|
+
return b.build();
|
|
64
|
+
};
|
|
65
|
+
export const se_GetWhatsAppMessageMediaCommand = async (input, context) => {
|
|
66
|
+
const b = rb(input, context);
|
|
67
|
+
const headers = {
|
|
68
|
+
"content-type": "application/json",
|
|
69
|
+
};
|
|
70
|
+
b.bp("/v1/whatsapp/media/get");
|
|
71
|
+
let body;
|
|
72
|
+
body = JSON.stringify(take(input, {
|
|
73
|
+
destinationS3File: (_) => _json(_),
|
|
74
|
+
destinationS3PresignedUrl: (_) => _json(_),
|
|
75
|
+
mediaId: [],
|
|
76
|
+
metadataOnly: [],
|
|
77
|
+
originationPhoneNumberId: [],
|
|
78
|
+
}));
|
|
79
|
+
b.m("POST").h(headers).b(body);
|
|
80
|
+
return b.build();
|
|
81
|
+
};
|
|
82
|
+
export const se_ListLinkedWhatsAppBusinessAccountsCommand = async (input, context) => {
|
|
83
|
+
const b = rb(input, context);
|
|
84
|
+
const headers = {};
|
|
85
|
+
b.bp("/v1/whatsapp/waba/list");
|
|
86
|
+
const query = map({
|
|
87
|
+
[_nT]: [, input[_nT]],
|
|
88
|
+
[_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
|
|
89
|
+
});
|
|
90
|
+
let body;
|
|
91
|
+
b.m("GET").h(headers).q(query).b(body);
|
|
92
|
+
return b.build();
|
|
93
|
+
};
|
|
94
|
+
export const se_ListTagsForResourceCommand = async (input, context) => {
|
|
95
|
+
const b = rb(input, context);
|
|
96
|
+
const headers = {};
|
|
97
|
+
b.bp("/v1/tags/list");
|
|
98
|
+
const query = map({
|
|
99
|
+
[_rA]: [, __expectNonNull(input[_rA], `resourceArn`)],
|
|
100
|
+
});
|
|
101
|
+
let body;
|
|
102
|
+
b.m("GET").h(headers).q(query).b(body);
|
|
103
|
+
return b.build();
|
|
104
|
+
};
|
|
105
|
+
export const se_PostWhatsAppMessageMediaCommand = async (input, context) => {
|
|
106
|
+
const b = rb(input, context);
|
|
107
|
+
const headers = {
|
|
108
|
+
"content-type": "application/json",
|
|
109
|
+
};
|
|
110
|
+
b.bp("/v1/whatsapp/media");
|
|
111
|
+
let body;
|
|
112
|
+
body = JSON.stringify(take(input, {
|
|
113
|
+
originationPhoneNumberId: [],
|
|
114
|
+
sourceS3File: (_) => _json(_),
|
|
115
|
+
sourceS3PresignedUrl: (_) => _json(_),
|
|
116
|
+
}));
|
|
117
|
+
b.m("POST").h(headers).b(body);
|
|
118
|
+
return b.build();
|
|
119
|
+
};
|
|
120
|
+
export const se_PutWhatsAppBusinessAccountEventDestinationsCommand = async (input, context) => {
|
|
121
|
+
const b = rb(input, context);
|
|
122
|
+
const headers = {
|
|
123
|
+
"content-type": "application/json",
|
|
124
|
+
};
|
|
125
|
+
b.bp("/v1/whatsapp/waba/eventdestinations");
|
|
126
|
+
let body;
|
|
127
|
+
body = JSON.stringify(take(input, {
|
|
128
|
+
eventDestinations: (_) => _json(_),
|
|
129
|
+
id: [],
|
|
130
|
+
}));
|
|
131
|
+
b.m("PUT").h(headers).b(body);
|
|
132
|
+
return b.build();
|
|
133
|
+
};
|
|
134
|
+
export const se_SendWhatsAppMessageCommand = async (input, context) => {
|
|
135
|
+
const b = rb(input, context);
|
|
136
|
+
const headers = {
|
|
137
|
+
"content-type": "application/json",
|
|
138
|
+
};
|
|
139
|
+
b.bp("/v1/whatsapp/send");
|
|
140
|
+
let body;
|
|
141
|
+
body = JSON.stringify(take(input, {
|
|
142
|
+
message: (_) => context.base64Encoder(_),
|
|
143
|
+
metaApiVersion: [],
|
|
144
|
+
originationPhoneNumberId: [],
|
|
145
|
+
}));
|
|
146
|
+
b.m("POST").h(headers).b(body);
|
|
147
|
+
return b.build();
|
|
148
|
+
};
|
|
149
|
+
export const se_TagResourceCommand = async (input, context) => {
|
|
150
|
+
const b = rb(input, context);
|
|
151
|
+
const headers = {
|
|
152
|
+
"content-type": "application/json",
|
|
153
|
+
};
|
|
154
|
+
b.bp("/v1/tags/tag-resource");
|
|
155
|
+
let body;
|
|
156
|
+
body = JSON.stringify(take(input, {
|
|
157
|
+
resourceArn: [],
|
|
158
|
+
tags: (_) => _json(_),
|
|
159
|
+
}));
|
|
160
|
+
b.m("POST").h(headers).b(body);
|
|
161
|
+
return b.build();
|
|
162
|
+
};
|
|
163
|
+
export const se_UntagResourceCommand = async (input, context) => {
|
|
164
|
+
const b = rb(input, context);
|
|
165
|
+
const headers = {
|
|
166
|
+
"content-type": "application/json",
|
|
167
|
+
};
|
|
168
|
+
b.bp("/v1/tags/untag-resource");
|
|
169
|
+
let body;
|
|
170
|
+
body = JSON.stringify(take(input, {
|
|
171
|
+
resourceArn: [],
|
|
172
|
+
tagKeys: (_) => _json(_),
|
|
173
|
+
}));
|
|
174
|
+
b.m("POST").h(headers).b(body);
|
|
175
|
+
return b.build();
|
|
176
|
+
};
|
|
177
|
+
export const de_AssociateWhatsAppBusinessAccountCommand = async (output, context) => {
|
|
178
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
179
|
+
return de_CommandError(output, context);
|
|
180
|
+
}
|
|
181
|
+
const contents = map({
|
|
182
|
+
$metadata: deserializeMetadata(output),
|
|
183
|
+
});
|
|
184
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
185
|
+
const doc = take(data, {
|
|
186
|
+
signupCallbackResult: _json,
|
|
187
|
+
statusCode: __expectInt32,
|
|
188
|
+
});
|
|
189
|
+
Object.assign(contents, doc);
|
|
190
|
+
return contents;
|
|
191
|
+
};
|
|
192
|
+
export const de_DeleteWhatsAppMessageMediaCommand = async (output, context) => {
|
|
193
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
194
|
+
return de_CommandError(output, context);
|
|
195
|
+
}
|
|
196
|
+
const contents = map({
|
|
197
|
+
$metadata: deserializeMetadata(output),
|
|
198
|
+
});
|
|
199
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
200
|
+
const doc = take(data, {
|
|
201
|
+
success: __expectBoolean,
|
|
202
|
+
});
|
|
203
|
+
Object.assign(contents, doc);
|
|
204
|
+
return contents;
|
|
205
|
+
};
|
|
206
|
+
export const de_DisassociateWhatsAppBusinessAccountCommand = async (output, context) => {
|
|
207
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
208
|
+
return de_CommandError(output, context);
|
|
209
|
+
}
|
|
210
|
+
const contents = map({
|
|
211
|
+
$metadata: deserializeMetadata(output),
|
|
212
|
+
});
|
|
213
|
+
await collectBody(output.body, context);
|
|
214
|
+
return contents;
|
|
215
|
+
};
|
|
216
|
+
export const de_GetLinkedWhatsAppBusinessAccountCommand = async (output, context) => {
|
|
217
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
218
|
+
return de_CommandError(output, context);
|
|
219
|
+
}
|
|
220
|
+
const contents = map({
|
|
221
|
+
$metadata: deserializeMetadata(output),
|
|
222
|
+
});
|
|
223
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
224
|
+
const doc = take(data, {
|
|
225
|
+
account: (_) => de_LinkedWhatsAppBusinessAccount(_, context),
|
|
226
|
+
});
|
|
227
|
+
Object.assign(contents, doc);
|
|
228
|
+
return contents;
|
|
229
|
+
};
|
|
230
|
+
export const de_GetLinkedWhatsAppBusinessAccountPhoneNumberCommand = async (output, context) => {
|
|
231
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
232
|
+
return de_CommandError(output, context);
|
|
233
|
+
}
|
|
234
|
+
const contents = map({
|
|
235
|
+
$metadata: deserializeMetadata(output),
|
|
236
|
+
});
|
|
237
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
238
|
+
const doc = take(data, {
|
|
239
|
+
linkedWhatsAppBusinessAccountId: __expectString,
|
|
240
|
+
phoneNumber: _json,
|
|
241
|
+
});
|
|
242
|
+
Object.assign(contents, doc);
|
|
243
|
+
return contents;
|
|
244
|
+
};
|
|
245
|
+
export const de_GetWhatsAppMessageMediaCommand = async (output, context) => {
|
|
246
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
247
|
+
return de_CommandError(output, context);
|
|
248
|
+
}
|
|
249
|
+
const contents = map({
|
|
250
|
+
$metadata: deserializeMetadata(output),
|
|
251
|
+
});
|
|
252
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
253
|
+
const doc = take(data, {
|
|
254
|
+
fileSize: __expectLong,
|
|
255
|
+
mimeType: __expectString,
|
|
256
|
+
});
|
|
257
|
+
Object.assign(contents, doc);
|
|
258
|
+
return contents;
|
|
259
|
+
};
|
|
260
|
+
export const de_ListLinkedWhatsAppBusinessAccountsCommand = async (output, context) => {
|
|
261
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
262
|
+
return de_CommandError(output, context);
|
|
263
|
+
}
|
|
264
|
+
const contents = map({
|
|
265
|
+
$metadata: deserializeMetadata(output),
|
|
266
|
+
});
|
|
267
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
268
|
+
const doc = take(data, {
|
|
269
|
+
linkedAccounts: (_) => de_LinkedWhatsAppBusinessAccountSummaryList(_, context),
|
|
270
|
+
nextToken: __expectString,
|
|
271
|
+
});
|
|
272
|
+
Object.assign(contents, doc);
|
|
273
|
+
return contents;
|
|
274
|
+
};
|
|
275
|
+
export const de_ListTagsForResourceCommand = async (output, context) => {
|
|
276
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
277
|
+
return de_CommandError(output, context);
|
|
278
|
+
}
|
|
279
|
+
const contents = map({
|
|
280
|
+
$metadata: deserializeMetadata(output),
|
|
281
|
+
});
|
|
282
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
283
|
+
const doc = take(data, {
|
|
284
|
+
statusCode: __expectInt32,
|
|
285
|
+
tags: _json,
|
|
286
|
+
});
|
|
287
|
+
Object.assign(contents, doc);
|
|
288
|
+
return contents;
|
|
289
|
+
};
|
|
290
|
+
export const de_PostWhatsAppMessageMediaCommand = async (output, context) => {
|
|
291
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
292
|
+
return de_CommandError(output, context);
|
|
293
|
+
}
|
|
294
|
+
const contents = map({
|
|
295
|
+
$metadata: deserializeMetadata(output),
|
|
296
|
+
});
|
|
297
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
298
|
+
const doc = take(data, {
|
|
299
|
+
mediaId: __expectString,
|
|
300
|
+
});
|
|
301
|
+
Object.assign(contents, doc);
|
|
302
|
+
return contents;
|
|
303
|
+
};
|
|
304
|
+
export const de_PutWhatsAppBusinessAccountEventDestinationsCommand = async (output, context) => {
|
|
305
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
306
|
+
return de_CommandError(output, context);
|
|
307
|
+
}
|
|
308
|
+
const contents = map({
|
|
309
|
+
$metadata: deserializeMetadata(output),
|
|
310
|
+
});
|
|
311
|
+
await collectBody(output.body, context);
|
|
312
|
+
return contents;
|
|
313
|
+
};
|
|
314
|
+
export const de_SendWhatsAppMessageCommand = async (output, context) => {
|
|
315
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
316
|
+
return de_CommandError(output, context);
|
|
317
|
+
}
|
|
318
|
+
const contents = map({
|
|
319
|
+
$metadata: deserializeMetadata(output),
|
|
320
|
+
});
|
|
321
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
322
|
+
const doc = take(data, {
|
|
323
|
+
messageId: __expectString,
|
|
324
|
+
});
|
|
325
|
+
Object.assign(contents, doc);
|
|
326
|
+
return contents;
|
|
327
|
+
};
|
|
328
|
+
export const de_TagResourceCommand = async (output, context) => {
|
|
329
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
330
|
+
return de_CommandError(output, context);
|
|
331
|
+
}
|
|
332
|
+
const contents = map({
|
|
333
|
+
$metadata: deserializeMetadata(output),
|
|
334
|
+
});
|
|
335
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
336
|
+
const doc = take(data, {
|
|
337
|
+
statusCode: __expectInt32,
|
|
338
|
+
});
|
|
339
|
+
Object.assign(contents, doc);
|
|
340
|
+
return contents;
|
|
341
|
+
};
|
|
342
|
+
export const de_UntagResourceCommand = async (output, context) => {
|
|
343
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
344
|
+
return de_CommandError(output, context);
|
|
345
|
+
}
|
|
346
|
+
const contents = map({
|
|
347
|
+
$metadata: deserializeMetadata(output),
|
|
348
|
+
});
|
|
349
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
350
|
+
const doc = take(data, {
|
|
351
|
+
statusCode: __expectInt32,
|
|
352
|
+
});
|
|
353
|
+
Object.assign(contents, doc);
|
|
354
|
+
return contents;
|
|
355
|
+
};
|
|
356
|
+
const de_CommandError = async (output, context) => {
|
|
357
|
+
const parsedOutput = {
|
|
358
|
+
...output,
|
|
359
|
+
body: await parseErrorBody(output.body, context),
|
|
360
|
+
};
|
|
361
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
362
|
+
switch (errorCode) {
|
|
363
|
+
case "AccessDeniedException":
|
|
364
|
+
case "com.amazonaws.socialmessaging#AccessDeniedException":
|
|
365
|
+
throw await de_AccessDeniedExceptionRes(parsedOutput, context);
|
|
366
|
+
case "DependencyException":
|
|
367
|
+
case "com.amazonaws.socialmessaging#DependencyException":
|
|
368
|
+
throw await de_DependencyExceptionRes(parsedOutput, context);
|
|
369
|
+
case "InvalidParametersException":
|
|
370
|
+
case "com.amazonaws.socialmessaging#InvalidParametersException":
|
|
371
|
+
throw await de_InvalidParametersExceptionRes(parsedOutput, context);
|
|
372
|
+
case "ThrottledRequestException":
|
|
373
|
+
case "com.amazonaws.socialmessaging#ThrottledRequestException":
|
|
374
|
+
throw await de_ThrottledRequestExceptionRes(parsedOutput, context);
|
|
375
|
+
case "ValidationException":
|
|
376
|
+
case "com.amazonaws.socialmessaging#ValidationException":
|
|
377
|
+
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
378
|
+
case "AccessDeniedByMetaException":
|
|
379
|
+
case "com.amazonaws.socialmessaging#AccessDeniedByMetaException":
|
|
380
|
+
throw await de_AccessDeniedByMetaExceptionRes(parsedOutput, context);
|
|
381
|
+
case "InternalServiceException":
|
|
382
|
+
case "com.amazonaws.socialmessaging#InternalServiceException":
|
|
383
|
+
throw await de_InternalServiceExceptionRes(parsedOutput, context);
|
|
384
|
+
case "ResourceNotFoundException":
|
|
385
|
+
case "com.amazonaws.socialmessaging#ResourceNotFoundException":
|
|
386
|
+
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
387
|
+
default:
|
|
388
|
+
const parsedBody = parsedOutput.body;
|
|
389
|
+
return throwDefaultError({
|
|
390
|
+
output,
|
|
391
|
+
parsedBody,
|
|
392
|
+
errorCode,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
const throwDefaultError = withBaseException(__BaseException);
|
|
397
|
+
const de_AccessDeniedByMetaExceptionRes = async (parsedOutput, context) => {
|
|
398
|
+
const contents = map({});
|
|
399
|
+
const data = parsedOutput.body;
|
|
400
|
+
const doc = take(data, {
|
|
401
|
+
message: __expectString,
|
|
402
|
+
});
|
|
403
|
+
Object.assign(contents, doc);
|
|
404
|
+
const exception = new AccessDeniedByMetaException({
|
|
405
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
406
|
+
...contents,
|
|
407
|
+
});
|
|
408
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
409
|
+
};
|
|
410
|
+
const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
|
|
411
|
+
const contents = map({});
|
|
412
|
+
const data = parsedOutput.body;
|
|
413
|
+
const doc = take(data, {
|
|
414
|
+
message: __expectString,
|
|
415
|
+
});
|
|
416
|
+
Object.assign(contents, doc);
|
|
417
|
+
const exception = new AccessDeniedException({
|
|
418
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
419
|
+
...contents,
|
|
420
|
+
});
|
|
421
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
422
|
+
};
|
|
423
|
+
const de_DependencyExceptionRes = async (parsedOutput, context) => {
|
|
424
|
+
const contents = map({});
|
|
425
|
+
const data = parsedOutput.body;
|
|
426
|
+
const doc = take(data, {
|
|
427
|
+
message: __expectString,
|
|
428
|
+
});
|
|
429
|
+
Object.assign(contents, doc);
|
|
430
|
+
const exception = new DependencyException({
|
|
431
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
432
|
+
...contents,
|
|
433
|
+
});
|
|
434
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
435
|
+
};
|
|
436
|
+
const de_InternalServiceExceptionRes = async (parsedOutput, context) => {
|
|
437
|
+
const contents = map({});
|
|
438
|
+
const data = parsedOutput.body;
|
|
439
|
+
const doc = take(data, {
|
|
440
|
+
message: __expectString,
|
|
441
|
+
});
|
|
442
|
+
Object.assign(contents, doc);
|
|
443
|
+
const exception = new InternalServiceException({
|
|
444
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
445
|
+
...contents,
|
|
446
|
+
});
|
|
447
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
448
|
+
};
|
|
449
|
+
const de_InvalidParametersExceptionRes = async (parsedOutput, context) => {
|
|
450
|
+
const contents = map({});
|
|
451
|
+
const data = parsedOutput.body;
|
|
452
|
+
const doc = take(data, {
|
|
453
|
+
message: __expectString,
|
|
454
|
+
});
|
|
455
|
+
Object.assign(contents, doc);
|
|
456
|
+
const exception = new InvalidParametersException({
|
|
457
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
458
|
+
...contents,
|
|
459
|
+
});
|
|
460
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
461
|
+
};
|
|
462
|
+
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
|
|
463
|
+
const contents = map({});
|
|
464
|
+
const data = parsedOutput.body;
|
|
465
|
+
const doc = take(data, {
|
|
466
|
+
message: __expectString,
|
|
467
|
+
});
|
|
468
|
+
Object.assign(contents, doc);
|
|
469
|
+
const exception = new ResourceNotFoundException({
|
|
470
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
471
|
+
...contents,
|
|
472
|
+
});
|
|
473
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
474
|
+
};
|
|
475
|
+
const de_ThrottledRequestExceptionRes = async (parsedOutput, context) => {
|
|
476
|
+
const contents = map({});
|
|
477
|
+
const data = parsedOutput.body;
|
|
478
|
+
const doc = take(data, {
|
|
479
|
+
message: __expectString,
|
|
480
|
+
});
|
|
481
|
+
Object.assign(contents, doc);
|
|
482
|
+
const exception = new ThrottledRequestException({
|
|
483
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
484
|
+
...contents,
|
|
485
|
+
});
|
|
486
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
487
|
+
};
|
|
488
|
+
const de_ValidationExceptionRes = async (parsedOutput, context) => {
|
|
489
|
+
const contents = map({});
|
|
490
|
+
const data = parsedOutput.body;
|
|
491
|
+
const doc = take(data, {
|
|
492
|
+
message: __expectString,
|
|
493
|
+
});
|
|
494
|
+
Object.assign(contents, doc);
|
|
495
|
+
const exception = new ValidationException({
|
|
496
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
497
|
+
...contents,
|
|
498
|
+
});
|
|
499
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
500
|
+
};
|
|
501
|
+
const de_LinkedWhatsAppBusinessAccount = (output, context) => {
|
|
502
|
+
return take(output, {
|
|
503
|
+
arn: __expectString,
|
|
504
|
+
eventDestinations: _json,
|
|
505
|
+
id: __expectString,
|
|
506
|
+
linkDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
|
|
507
|
+
phoneNumbers: _json,
|
|
508
|
+
registrationStatus: __expectString,
|
|
509
|
+
wabaId: __expectString,
|
|
510
|
+
wabaName: __expectString,
|
|
511
|
+
});
|
|
512
|
+
};
|
|
513
|
+
const de_LinkedWhatsAppBusinessAccountSummary = (output, context) => {
|
|
514
|
+
return take(output, {
|
|
515
|
+
arn: __expectString,
|
|
516
|
+
eventDestinations: _json,
|
|
517
|
+
id: __expectString,
|
|
518
|
+
linkDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
|
|
519
|
+
registrationStatus: __expectString,
|
|
520
|
+
wabaId: __expectString,
|
|
521
|
+
wabaName: __expectString,
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
const de_LinkedWhatsAppBusinessAccountSummaryList = (output, context) => {
|
|
525
|
+
const retVal = (output || [])
|
|
526
|
+
.filter((e) => e != null)
|
|
527
|
+
.map((entry) => {
|
|
528
|
+
return de_LinkedWhatsAppBusinessAccountSummary(entry, context);
|
|
529
|
+
});
|
|
530
|
+
return retVal;
|
|
531
|
+
};
|
|
532
|
+
const deserializeMetadata = (output) => ({
|
|
533
|
+
httpStatusCode: output.statusCode,
|
|
534
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
535
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
536
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
537
|
+
});
|
|
538
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
539
|
+
const _i = "id";
|
|
540
|
+
const _mI = "mediaId";
|
|
541
|
+
const _mR = "maxResults";
|
|
542
|
+
const _nT = "nextToken";
|
|
543
|
+
const _oPNI = "originationPhoneNumberId";
|
|
544
|
+
const _rA = "resourceArn";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import packageInfo from "../package.json";
|
|
2
|
+
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
3
|
+
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
|
|
4
|
+
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
|
|
5
|
+
import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
|
|
6
|
+
import { invalidProvider } from "@smithy/invalid-dependency";
|
|
7
|
+
import { calculateBodyLength } from "@smithy/util-body-length-browser";
|
|
8
|
+
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
|
9
|
+
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
10
|
+
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
|
11
|
+
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
|
|
12
|
+
export const getRuntimeConfig = (config) => {
|
|
13
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
14
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
15
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
16
|
+
return {
|
|
17
|
+
...clientSharedValues,
|
|
18
|
+
...config,
|
|
19
|
+
runtime: "browser",
|
|
20
|
+
defaultsMode,
|
|
21
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
22
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
23
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
24
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
25
|
+
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
26
|
+
region: config?.region ?? invalidProvider("Region is missing"),
|
|
27
|
+
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
28
|
+
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
|
|
29
|
+
sha256: config?.sha256 ?? Sha256,
|
|
30
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
31
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
32
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import packageInfo from "../package.json";
|
|
2
|
+
import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
|
|
3
|
+
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
4
|
+
import { NODE_APP_ID_CONFIG_OPTIONS, defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
5
|
+
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
|
|
6
|
+
import { Hash } from "@smithy/hash-node";
|
|
7
|
+
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
|
|
8
|
+
import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
|
|
9
|
+
import { NodeHttpHandler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
|
|
10
|
+
import { calculateBodyLength } from "@smithy/util-body-length-node";
|
|
11
|
+
import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
|
12
|
+
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
|
+
import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
|
|
14
|
+
import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
|
|
15
|
+
import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
|
|
16
|
+
export const getRuntimeConfig = (config) => {
|
|
17
|
+
emitWarningIfUnsupportedVersion(process.version);
|
|
18
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
19
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
20
|
+
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
21
|
+
awsCheckVersion(process.version);
|
|
22
|
+
return {
|
|
23
|
+
...clientSharedValues,
|
|
24
|
+
...config,
|
|
25
|
+
runtime: "node",
|
|
26
|
+
defaultsMode,
|
|
27
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
28
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
|
|
29
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
30
|
+
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
31
|
+
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
32
|
+
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
33
|
+
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
34
|
+
retryMode: config?.retryMode ??
|
|
35
|
+
loadNodeConfig({
|
|
36
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
37
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
38
|
+
}),
|
|
39
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
40
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
41
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
42
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
|
|
43
|
+
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
2
|
+
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
3
|
+
export const getRuntimeConfig = (config) => {
|
|
4
|
+
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
5
|
+
return {
|
|
6
|
+
...browserDefaults,
|
|
7
|
+
...config,
|
|
8
|
+
runtime: "react-native",
|
|
9
|
+
sha256: config?.sha256 ?? Sha256,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AwsSdkSigV4Signer } from "@aws-sdk/core";
|
|
2
|
+
import { NoOpLogger } from "@smithy/smithy-client";
|
|
3
|
+
import { parseUrl } from "@smithy/url-parser";
|
|
4
|
+
import { fromBase64, toBase64 } from "@smithy/util-base64";
|
|
5
|
+
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
|
|
6
|
+
import { defaultSocialMessagingHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider";
|
|
7
|
+
import { defaultEndpointResolver } from "./endpoint/endpointResolver";
|
|
8
|
+
export const getRuntimeConfig = (config) => {
|
|
9
|
+
return {
|
|
10
|
+
apiVersion: "2024-01-01",
|
|
11
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
12
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
13
|
+
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
14
|
+
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
|
|
15
|
+
extensions: config?.extensions ?? [],
|
|
16
|
+
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSocialMessagingHttpAuthSchemeProvider,
|
|
17
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
18
|
+
{
|
|
19
|
+
schemeId: "aws.auth#sigv4",
|
|
20
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
21
|
+
signer: new AwsSdkSigV4Signer(),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
logger: config?.logger ?? new NoOpLogger(),
|
|
25
|
+
serviceId: config?.serviceId ?? "SocialMessaging",
|
|
26
|
+
urlParser: config?.urlParser ?? parseUrl,
|
|
27
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
28
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, } from "@aws-sdk/region-config-resolver";
|
|
2
|
+
import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http";
|
|
3
|
+
import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client";
|
|
4
|
+
import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration";
|
|
5
|
+
const asPartial = (t) => t;
|
|
6
|
+
export const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
7
|
+
const extensionConfiguration = {
|
|
8
|
+
...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)),
|
|
9
|
+
...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
|
|
10
|
+
...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
11
|
+
...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)),
|
|
12
|
+
};
|
|
13
|
+
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
|
14
|
+
return {
|
|
15
|
+
...runtimeConfig,
|
|
16
|
+
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
17
|
+
...resolveDefaultRuntimeConfig(extensionConfiguration),
|
|
18
|
+
...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
|
|
19
|
+
...resolveHttpAuthRuntimeConfig(extensionConfiguration),
|
|
20
|
+
};
|
|
21
|
+
};
|