Skip to content

Commit 2665c30

Browse files
authored
chore: define query while declaring (#1161)
1 parent 0ab6a0f commit 2665c30

File tree

78 files changed

+4031
-5237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4031
-5237
lines changed

clients/client-accessanalyzer/protocols/Aws_restJson1_1.ts

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ export const serializeAws_restJson1_1DeleteAnalyzerCommand = async (
220220
} else {
221221
throw new Error("No value provided for input HTTP label: analyzerName.");
222222
}
223-
const query: any = {};
224-
if (input.clientToken !== undefined) {
225-
query["clientToken"] = input.clientToken;
226-
}
223+
const query: any = {
224+
...(input.clientToken !== undefined && { clientToken: input.clientToken })
225+
};
227226
let body: any;
228227
const { hostname, protocol = "https", port } = await context.endpoint();
229228
return new __HttpRequest({
@@ -271,10 +270,9 @@ export const serializeAws_restJson1_1DeleteArchiveRuleCommand = async (
271270
} else {
272271
throw new Error("No value provided for input HTTP label: ruleName.");
273272
}
274-
const query: any = {};
275-
if (input.clientToken !== undefined) {
276-
query["clientToken"] = input.clientToken;
277-
}
273+
const query: any = {
274+
...(input.clientToken !== undefined && { clientToken: input.clientToken })
275+
};
278276
let body: any;
279277
const { hostname, protocol = "https", port } = await context.endpoint();
280278
return new __HttpRequest({
@@ -296,13 +294,10 @@ export const serializeAws_restJson1_1GetAnalyzedResourceCommand = async (
296294
const headers: any = {};
297295
headers["Content-Type"] = "";
298296
let resolvedPath = "/analyzed-resource";
299-
const query: any = {};
300-
if (input.analyzerArn !== undefined) {
301-
query["analyzerArn"] = input.analyzerArn;
302-
}
303-
if (input.resourceArn !== undefined) {
304-
query["resourceArn"] = input.resourceArn;
305-
}
297+
const query: any = {
298+
...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }),
299+
...(input.resourceArn !== undefined && { resourceArn: input.resourceArn })
300+
};
306301
let body: any;
307302
const { hostname, protocol = "https", port } = await context.endpoint();
308303
return new __HttpRequest({
@@ -416,10 +411,9 @@ export const serializeAws_restJson1_1GetFindingCommand = async (
416411
} else {
417412
throw new Error("No value provided for input HTTP label: id.");
418413
}
419-
const query: any = {};
420-
if (input.analyzerArn !== undefined) {
421-
query["analyzerArn"] = input.analyzerArn;
422-
}
414+
const query: any = {
415+
...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn })
416+
};
423417
let body: any;
424418
const { hostname, protocol = "https", port } = await context.endpoint();
425419
return new __HttpRequest({
@@ -475,16 +469,13 @@ export const serializeAws_restJson1_1ListAnalyzersCommand = async (
475469
const headers: any = {};
476470
headers["Content-Type"] = "";
477471
let resolvedPath = "/analyzer";
478-
const query: any = {};
479-
if (input.maxResults !== undefined) {
480-
query["maxResults"] = input.maxResults.toString();
481-
}
482-
if (input.nextToken !== undefined) {
483-
query["nextToken"] = input.nextToken;
484-
}
485-
if (input.type !== undefined) {
486-
query["type"] = input.type;
487-
}
472+
const query: any = {
473+
...(input.maxResults !== undefined && {
474+
maxResults: input.maxResults.toString()
475+
}),
476+
...(input.nextToken !== undefined && { nextToken: input.nextToken }),
477+
...(input.type !== undefined && { type: input.type })
478+
};
488479
let body: any;
489480
const { hostname, protocol = "https", port } = await context.endpoint();
490481
return new __HttpRequest({
@@ -520,13 +511,12 @@ export const serializeAws_restJson1_1ListArchiveRulesCommand = async (
520511
} else {
521512
throw new Error("No value provided for input HTTP label: analyzerName.");
522513
}
523-
const query: any = {};
524-
if (input.maxResults !== undefined) {
525-
query["maxResults"] = input.maxResults.toString();
526-
}
527-
if (input.nextToken !== undefined) {
528-
query["nextToken"] = input.nextToken;
529-
}
514+
const query: any = {
515+
...(input.maxResults !== undefined && {
516+
maxResults: input.maxResults.toString()
517+
}),
518+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
519+
};
530520
let body: any;
531521
const { hostname, protocol = "https", port } = await context.endpoint();
532522
return new __HttpRequest({
@@ -706,10 +696,11 @@ export const serializeAws_restJson1_1UntagResourceCommand = async (
706696
} else {
707697
throw new Error("No value provided for input HTTP label: resourceArn.");
708698
}
709-
const query: any = {};
710-
if (input.tagKeys !== undefined) {
711-
query["tagKeys"] = (input.tagKeys || []).map(_entry => _entry);
712-
}
699+
const query: any = {
700+
...(input.tagKeys !== undefined && {
701+
tagKeys: (input.tagKeys || []).map(_entry => _entry)
702+
})
703+
};
713704
let body: any;
714705
const { hostname, protocol = "https", port } = await context.endpoint();
715706
return new __HttpRequest({

clients/client-amplify/protocols/Aws_restJson1_1.ts

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,13 +1133,12 @@ export const serializeAws_restJson1_1ListAppsCommand = async (
11331133
const headers: any = {};
11341134
headers["Content-Type"] = "";
11351135
let resolvedPath = "/apps";
1136-
const query: any = {};
1137-
if (input.maxResults !== undefined) {
1138-
query["maxResults"] = input.maxResults.toString();
1139-
}
1140-
if (input.nextToken !== undefined) {
1141-
query["nextToken"] = input.nextToken;
1142-
}
1136+
const query: any = {
1137+
...(input.maxResults !== undefined && {
1138+
maxResults: input.maxResults.toString()
1139+
}),
1140+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1141+
};
11431142
let body: any;
11441143
const { hostname, protocol = "https", port } = await context.endpoint();
11451144
return new __HttpRequest({
@@ -1198,13 +1197,12 @@ export const serializeAws_restJson1_1ListArtifactsCommand = async (
11981197
} else {
11991198
throw new Error("No value provided for input HTTP label: jobId.");
12001199
}
1201-
const query: any = {};
1202-
if (input.maxResults !== undefined) {
1203-
query["maxResults"] = input.maxResults.toString();
1204-
}
1205-
if (input.nextToken !== undefined) {
1206-
query["nextToken"] = input.nextToken;
1207-
}
1200+
const query: any = {
1201+
...(input.maxResults !== undefined && {
1202+
maxResults: input.maxResults.toString()
1203+
}),
1204+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1205+
};
12081206
let body: any;
12091207
const { hostname, protocol = "https", port } = await context.endpoint();
12101208
return new __HttpRequest({
@@ -1238,13 +1236,12 @@ export const serializeAws_restJson1_1ListBackendEnvironmentsCommand = async (
12381236
} else {
12391237
throw new Error("No value provided for input HTTP label: appId.");
12401238
}
1241-
const query: any = {};
1242-
if (input.maxResults !== undefined) {
1243-
query["maxResults"] = input.maxResults.toString();
1244-
}
1245-
if (input.nextToken !== undefined) {
1246-
query["nextToken"] = input.nextToken;
1247-
}
1239+
const query: any = {
1240+
...(input.maxResults !== undefined && {
1241+
maxResults: input.maxResults.toString()
1242+
}),
1243+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1244+
};
12481245
let body: any;
12491246
const bodyParams: any = {};
12501247
if (input.environmentName !== undefined) {
@@ -1283,13 +1280,12 @@ export const serializeAws_restJson1_1ListBranchesCommand = async (
12831280
} else {
12841281
throw new Error("No value provided for input HTTP label: appId.");
12851282
}
1286-
const query: any = {};
1287-
if (input.maxResults !== undefined) {
1288-
query["maxResults"] = input.maxResults.toString();
1289-
}
1290-
if (input.nextToken !== undefined) {
1291-
query["nextToken"] = input.nextToken;
1292-
}
1283+
const query: any = {
1284+
...(input.maxResults !== undefined && {
1285+
maxResults: input.maxResults.toString()
1286+
}),
1287+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1288+
};
12931289
let body: any;
12941290
const { hostname, protocol = "https", port } = await context.endpoint();
12951291
return new __HttpRequest({
@@ -1323,13 +1319,12 @@ export const serializeAws_restJson1_1ListDomainAssociationsCommand = async (
13231319
} else {
13241320
throw new Error("No value provided for input HTTP label: appId.");
13251321
}
1326-
const query: any = {};
1327-
if (input.maxResults !== undefined) {
1328-
query["maxResults"] = input.maxResults.toString();
1329-
}
1330-
if (input.nextToken !== undefined) {
1331-
query["nextToken"] = input.nextToken;
1332-
}
1322+
const query: any = {
1323+
...(input.maxResults !== undefined && {
1324+
maxResults: input.maxResults.toString()
1325+
}),
1326+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1327+
};
13331328
let body: any;
13341329
const { hostname, protocol = "https", port } = await context.endpoint();
13351330
return new __HttpRequest({
@@ -1375,13 +1370,12 @@ export const serializeAws_restJson1_1ListJobsCommand = async (
13751370
} else {
13761371
throw new Error("No value provided for input HTTP label: branchName.");
13771372
}
1378-
const query: any = {};
1379-
if (input.maxResults !== undefined) {
1380-
query["maxResults"] = input.maxResults.toString();
1381-
}
1382-
if (input.nextToken !== undefined) {
1383-
query["nextToken"] = input.nextToken;
1384-
}
1373+
const query: any = {
1374+
...(input.maxResults !== undefined && {
1375+
maxResults: input.maxResults.toString()
1376+
}),
1377+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1378+
};
13851379
let body: any;
13861380
const { hostname, protocol = "https", port } = await context.endpoint();
13871381
return new __HttpRequest({
@@ -1449,13 +1443,12 @@ export const serializeAws_restJson1_1ListWebhooksCommand = async (
14491443
} else {
14501444
throw new Error("No value provided for input HTTP label: appId.");
14511445
}
1452-
const query: any = {};
1453-
if (input.maxResults !== undefined) {
1454-
query["maxResults"] = input.maxResults.toString();
1455-
}
1456-
if (input.nextToken !== undefined) {
1457-
query["nextToken"] = input.nextToken;
1458-
}
1446+
const query: any = {
1447+
...(input.maxResults !== undefined && {
1448+
maxResults: input.maxResults.toString()
1449+
}),
1450+
...(input.nextToken !== undefined && { nextToken: input.nextToken })
1451+
};
14591452
let body: any;
14601453
const { hostname, protocol = "https", port } = await context.endpoint();
14611454
return new __HttpRequest({
@@ -1702,10 +1695,11 @@ export const serializeAws_restJson1_1UntagResourceCommand = async (
17021695
} else {
17031696
throw new Error("No value provided for input HTTP label: resourceArn.");
17041697
}
1705-
const query: any = {};
1706-
if (input.tagKeys !== undefined) {
1707-
query["tagKeys"] = (input.tagKeys || []).map(_entry => _entry);
1708-
}
1698+
const query: any = {
1699+
...(input.tagKeys !== undefined && {
1700+
tagKeys: (input.tagKeys || []).map(_entry => _entry)
1701+
})
1702+
};
17091703
let body: any;
17101704
const { hostname, protocol = "https", port } = await context.endpoint();
17111705
return new __HttpRequest({

0 commit comments

Comments
 (0)