cdk-amazon-chime-resources
Version:

1,201 lines (1,200 loc) • 218 kB
JavaScript
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
import { v4 as generateIdempotencyToken } from "uuid";
import { ChimeSDKMessagingServiceException as __BaseException } from "../models/ChimeSDKMessagingServiceException";
import { BadRequestException, ConflictException, ForbiddenException, NotFoundException, ResourceLimitExceededException, ServiceFailureException, ServiceUnavailableException, ThrottledClientException, UnauthorizedClientException, } from "../models/models_0";
export const serializeAws_restJson1AssociateChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/channel-flow";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.ChannelFlowArn != null && { ChannelFlowArn: input.ChannelFlowArn }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1BatchCreateChannelMembershipCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
operation: [, "batch-create"],
});
let body;
body = JSON.stringify({
...(input.MemberArns != null && { MemberArns: serializeAws_restJson1MemberArns(input.MemberArns, context) }),
...(input.SubChannelId != null && { SubChannelId: input.SubChannelId }),
...(input.Type != null && { Type: input.Type }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ChannelFlowCallbackCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
operation: [, "channel-flow-callback"],
});
let body;
body = JSON.stringify({
CallbackId: input.CallbackId ?? generateIdempotencyToken(),
...(input.ChannelMessage != null && {
ChannelMessage: serializeAws_restJson1ChannelMessageCallback(input.ChannelMessage, context),
}),
...(input.DeleteResource != null && { DeleteResource: input.DeleteResource }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1CreateChannelCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
let body;
body = JSON.stringify({
...(input.AppInstanceArn != null && { AppInstanceArn: input.AppInstanceArn }),
...(input.ChannelId != null && { ChannelId: input.ChannelId }),
ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(),
...(input.ElasticChannelConfiguration != null && {
ElasticChannelConfiguration: serializeAws_restJson1ElasticChannelConfiguration(input.ElasticChannelConfiguration, context),
}),
...(input.ExpirationSettings != null && {
ExpirationSettings: serializeAws_restJson1ExpirationSettings(input.ExpirationSettings, context),
}),
...(input.MemberArns != null && { MemberArns: serializeAws_restJson1ChannelMemberArns(input.MemberArns, context) }),
...(input.Metadata != null && { Metadata: input.Metadata }),
...(input.Mode != null && { Mode: input.Mode }),
...(input.ModeratorArns != null && {
ModeratorArns: serializeAws_restJson1ChannelModeratorArns(input.ModeratorArns, context),
}),
...(input.Name != null && { Name: input.Name }),
...(input.Privacy != null && { Privacy: input.Privacy }),
...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1CreateChannelBanCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.MemberArn != null && { MemberArn: input.MemberArn }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1CreateChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows";
let body;
body = JSON.stringify({
...(input.AppInstanceArn != null && { AppInstanceArn: input.AppInstanceArn }),
...(input.ClientRequestToken != null && { ClientRequestToken: input.ClientRequestToken }),
...(input.Name != null && { Name: input.Name }),
...(input.Processors != null && { Processors: serializeAws_restJson1ProcessorList(input.Processors, context) }),
...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1CreateChannelMembershipCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.MemberArn != null && { MemberArn: input.MemberArn }),
...(input.SubChannelId != null && { SubChannelId: input.SubChannelId }),
...(input.Type != null && { Type: input.Type }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1CreateChannelModeratorCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/moderators";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.ChannelModeratorArn != null && { ChannelModeratorArn: input.ChannelModeratorArn }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DeleteChannelCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1DeleteChannelBanCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans/{MemberArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DeleteChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows/{ChannelFlowArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DeleteChannelMembershipCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/memberships/{MemberArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
const query = map({
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1DeleteChannelMessageCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/messages/{MessageId}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
const query = map({
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1DeleteChannelModeratorCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/moderators/{ChannelModeratorArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelModeratorArn", () => input.ChannelModeratorArn, "{ChannelModeratorArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DeleteMessagingStreamingConfigurationsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/app-instances/{AppInstanceArn}/streaming-configurations";
resolvedPath = __resolvedPath(resolvedPath, input, "AppInstanceArn", () => input.AppInstanceArn, "{AppInstanceArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DescribeChannelCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DescribeChannelBanCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans/{MemberArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DescribeChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows/{ChannelFlowArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DescribeChannelMembershipCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/memberships/{MemberArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
const query = map({
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
scope: [, "app-instance-user-membership"],
"app-instance-user-arn": [, __expectNonNull(input.AppInstanceUserArn, `AppInstanceUserArn`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
scope: [, "app-instance-user-moderated-channel"],
"app-instance-user-arn": [, __expectNonNull(input.AppInstanceUserArn, `AppInstanceUserArn`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1DescribeChannelModeratorCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/moderators/{ChannelModeratorArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelModeratorArn", () => input.ChannelModeratorArn, "{ChannelModeratorArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1DisassociateChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "DELETE",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1GetChannelMembershipPreferencesCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/memberships/{MemberArn}/preferences";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1GetChannelMessageCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/messages/{MessageId}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
const query = map({
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1GetChannelMessageStatusCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/messages/{MessageId}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
const query = map({
scope: [, "message-status"],
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1GetMessagingSessionEndpointCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/messaging-session";
let body;
body = "";
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1GetMessagingStreamingConfigurationsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/app-instances/{AppInstanceArn}/streaming-configurations";
resolvedPath = __resolvedPath(resolvedPath, input, "AppInstanceArn", () => input.AppInstanceArn, "{AppInstanceArn}", false);
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1ListChannelBansCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelFlowsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows";
const query = map({
"app-instance-arn": [, __expectNonNull(input.AppInstanceArn, `AppInstanceArn`)],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelMembershipsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
type: [, input.Type],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelMembershipsForAppInstanceUserCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
const query = map({
scope: [, "app-instance-user-memberships"],
"app-instance-user-arn": [, input.AppInstanceUserArn],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelMessagesCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/messages";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
"sort-order": [, input.SortOrder],
"not-before": [
() => input.NotBefore !== void 0,
() => (input.NotBefore.toISOString().split(".")[0] + "Z").toString(),
],
"not-after": [
() => input.NotAfter !== void 0,
() => (input.NotAfter.toISOString().split(".")[0] + "Z").toString(),
],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
"sub-channel-id": [, input.SubChannelId],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelModeratorsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/moderators";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
const query = map({
"app-instance-arn": [, __expectNonNull(input.AppInstanceArn, `AppInstanceArn`)],
privacy: [, input.Privacy],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelsAssociatedWithChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
const query = map({
scope: [, "channel-flow-associations"],
"channel-flow-arn": [, __expectNonNull(input.ChannelFlowArn, `ChannelFlowArn`)],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
const query = map({
scope: [, "app-instance-user-moderated-channels"],
"app-instance-user-arn": [, input.AppInstanceUserArn],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListSubChannelsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/subchannels";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
const query = map({
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags";
const query = map({
arn: [, __expectNonNull(input.ResourceARN, `ResourceARN`)],
});
let body;
return new __HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1PutChannelExpirationSettingsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/expiration-settings";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.ExpirationSettings != null && {
ExpirationSettings: serializeAws_restJson1ExpirationSettings(input.ExpirationSettings, context),
}),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1PutChannelMembershipPreferencesCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/memberships/{MemberArn}/preferences";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MemberArn", () => input.MemberArn, "{MemberArn}", false);
let body;
body = JSON.stringify({
...(input.Preferences != null && {
Preferences: serializeAws_restJson1ChannelMembershipPreferences(input.Preferences, context),
}),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1PutMessagingStreamingConfigurationsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/app-instances/{AppInstanceArn}/streaming-configurations";
resolvedPath = __resolvedPath(resolvedPath, input, "AppInstanceArn", () => input.AppInstanceArn, "{AppInstanceArn}", false);
let body;
body = JSON.stringify({
...(input.StreamingConfigurations != null && {
StreamingConfigurations: serializeAws_restJson1StreamingConfigurationList(input.StreamingConfigurations, context),
}),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1RedactChannelMessageCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/messages/{MessageId}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
const query = map({
operation: [, "redact"],
});
let body;
body = JSON.stringify({
...(input.SubChannelId != null && { SubChannelId: input.SubChannelId }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1SearchChannelsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels";
const query = map({
operation: [, "search"],
"max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
"next-token": [, input.NextToken],
});
let body;
body = JSON.stringify({
...(input.Fields != null && { Fields: serializeAws_restJson1SearchFields(input.Fields, context) }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1SendChannelMessageCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/messages";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(),
...(input.Content != null && { Content: input.Content }),
...(input.ContentType != null && { ContentType: input.ContentType }),
...(input.MessageAttributes != null && {
MessageAttributes: serializeAws_restJson1MessageAttributeMap(input.MessageAttributes, context),
}),
...(input.Metadata != null && { Metadata: input.Metadata }),
...(input.Persistence != null && { Persistence: input.Persistence }),
...(input.PushNotification != null && {
PushNotification: serializeAws_restJson1PushNotificationConfiguration(input.PushNotification, context),
}),
...(input.SubChannelId != null && { SubChannelId: input.SubChannelId }),
...(input.Type != null && { Type: input.Type }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1TagResourceCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags";
const query = map({
operation: [, "tag-resource"],
});
let body;
body = JSON.stringify({
...(input.ResourceARN != null && { ResourceARN: input.ResourceARN }),
...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags";
const query = map({
operation: [, "untag-resource"],
});
let body;
body = JSON.stringify({
...(input.ResourceARN != null && { ResourceARN: input.ResourceARN }),
...(input.TagKeys != null && { TagKeys: serializeAws_restJson1TagKeyList(input.TagKeys, context) }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
query,
body,
});
};
export const serializeAws_restJson1UpdateChannelCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.Metadata != null && { Metadata: input.Metadata }),
...(input.Mode != null && { Mode: input.Mode }),
...(input.Name != null && { Name: input.Name }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1UpdateChannelFlowCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
"content-type": "application/json",
};
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel-flows/{ChannelFlowArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelFlowArn", () => input.ChannelFlowArn, "{ChannelFlowArn}", false);
let body;
body = JSON.stringify({
...(input.Name != null && { Name: input.Name }),
...(input.Processors != null && { Processors: serializeAws_restJson1ProcessorList(input.Processors, context) }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1UpdateChannelMessageCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
"/channels/{ChannelArn}/messages/{MessageId}";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "MessageId", () => input.MessageId, "{MessageId}", false);
let body;
body = JSON.stringify({
...(input.Content != null && { Content: input.Content }),
...(input.ContentType != null && { ContentType: input.ContentType }),
...(input.Metadata != null && { Metadata: input.Metadata }),
...(input.SubChannelId != null && { SubChannelId: input.SubChannelId }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const serializeAws_restJson1UpdateChannelReadMarkerCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = map({}, isSerializableHeaderValue, {
"content-type": "application/json",
"x-amz-chime-bearer": input.ChimeBearer,
});
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/readMarker";
resolvedPath = __resolvedPath(resolvedPath, input, "ChannelArn", () => input.ChannelArn, "{ChannelArn}", false);
let body;
body = JSON.stringify({
...(input.SubChannelId != null && { SubChannelId: input.SubChannelId }),
});
return new __HttpRequest({
protocol,
hostname,
port,
method: "PUT",
headers,
path: resolvedPath,
body,
});
};
export const deserializeAws_restJson1AssociateChannelFlowCommand = async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return deserializeAws_restJson1AssociateChannelFlowCommandError(output, context);
}
const contents = map({
$metadata: deserializeMetadata(output),
});