Skip to content

chore: define query while declaring #1161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 31 additions & 40 deletions clients/client-accessanalyzer/protocols/Aws_restJson1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ export const serializeAws_restJson1_1DeleteAnalyzerCommand = async (
} else {
throw new Error("No value provided for input HTTP label: analyzerName.");
}
const query: any = {};
if (input.clientToken !== undefined) {
query["clientToken"] = input.clientToken;
}
const query: any = {
...(input.clientToken !== undefined && { clientToken: input.clientToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -271,10 +270,9 @@ export const serializeAws_restJson1_1DeleteArchiveRuleCommand = async (
} else {
throw new Error("No value provided for input HTTP label: ruleName.");
}
const query: any = {};
if (input.clientToken !== undefined) {
query["clientToken"] = input.clientToken;
}
const query: any = {
...(input.clientToken !== undefined && { clientToken: input.clientToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand All @@ -296,13 +294,10 @@ export const serializeAws_restJson1_1GetAnalyzedResourceCommand = async (
const headers: any = {};
headers["Content-Type"] = "";
let resolvedPath = "/analyzed-resource";
const query: any = {};
if (input.analyzerArn !== undefined) {
query["analyzerArn"] = input.analyzerArn;
}
if (input.resourceArn !== undefined) {
query["resourceArn"] = input.resourceArn;
}
const query: any = {
...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }),
...(input.resourceArn !== undefined && { resourceArn: input.resourceArn })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -416,10 +411,9 @@ export const serializeAws_restJson1_1GetFindingCommand = async (
} else {
throw new Error("No value provided for input HTTP label: id.");
}
const query: any = {};
if (input.analyzerArn !== undefined) {
query["analyzerArn"] = input.analyzerArn;
}
const query: any = {
...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -475,16 +469,13 @@ export const serializeAws_restJson1_1ListAnalyzersCommand = async (
const headers: any = {};
headers["Content-Type"] = "";
let resolvedPath = "/analyzer";
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
if (input.type !== undefined) {
query["type"] = input.type;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken }),
...(input.type !== undefined && { type: input.type })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -520,13 +511,12 @@ export const serializeAws_restJson1_1ListArchiveRulesCommand = async (
} else {
throw new Error("No value provided for input HTTP label: analyzerName.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -706,10 +696,11 @@ export const serializeAws_restJson1_1UntagResourceCommand = async (
} else {
throw new Error("No value provided for input HTTP label: resourceArn.");
}
const query: any = {};
if (input.tagKeys !== undefined) {
query["tagKeys"] = (input.tagKeys || []).map(_entry => _entry);
}
const query: any = {
...(input.tagKeys !== undefined && {
tagKeys: (input.tagKeys || []).map(_entry => _entry)
})
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down
100 changes: 47 additions & 53 deletions clients/client-amplify/protocols/Aws_restJson1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,13 +1133,12 @@ export const serializeAws_restJson1_1ListAppsCommand = async (
const headers: any = {};
headers["Content-Type"] = "";
let resolvedPath = "/apps";
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -1198,13 +1197,12 @@ export const serializeAws_restJson1_1ListArtifactsCommand = async (
} else {
throw new Error("No value provided for input HTTP label: jobId.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -1238,13 +1236,12 @@ export const serializeAws_restJson1_1ListBackendEnvironmentsCommand = async (
} else {
throw new Error("No value provided for input HTTP label: appId.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const bodyParams: any = {};
if (input.environmentName !== undefined) {
Expand Down Expand Up @@ -1283,13 +1280,12 @@ export const serializeAws_restJson1_1ListBranchesCommand = async (
} else {
throw new Error("No value provided for input HTTP label: appId.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -1323,13 +1319,12 @@ export const serializeAws_restJson1_1ListDomainAssociationsCommand = async (
} else {
throw new Error("No value provided for input HTTP label: appId.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -1375,13 +1370,12 @@ export const serializeAws_restJson1_1ListJobsCommand = async (
} else {
throw new Error("No value provided for input HTTP label: branchName.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -1449,13 +1443,12 @@ export const serializeAws_restJson1_1ListWebhooksCommand = async (
} else {
throw new Error("No value provided for input HTTP label: appId.");
}
const query: any = {};
if (input.maxResults !== undefined) {
query["maxResults"] = input.maxResults.toString();
}
if (input.nextToken !== undefined) {
query["nextToken"] = input.nextToken;
}
const query: any = {
...(input.maxResults !== undefined && {
maxResults: input.maxResults.toString()
}),
...(input.nextToken !== undefined && { nextToken: input.nextToken })
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down Expand Up @@ -1702,10 +1695,11 @@ export const serializeAws_restJson1_1UntagResourceCommand = async (
} else {
throw new Error("No value provided for input HTTP label: resourceArn.");
}
const query: any = {};
if (input.tagKeys !== undefined) {
query["tagKeys"] = (input.tagKeys || []).map(_entry => _entry);
}
const query: any = {
...(input.tagKeys !== undefined && {
tagKeys: (input.tagKeys || []).map(_entry => _entry)
})
};
let body: any;
const { hostname, protocol = "https", port } = await context.endpoint();
return new __HttpRequest({
Expand Down
Loading