import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { BatchCreateAttendeeCommandInput , BatchCreateAttendeeCommandOutput , } from "../commands/BatchCreateAttendeeCommand" ; import { CreateAttendeeCommandInput , CreateAttendeeCommandOutput } from "../commands/CreateAttendeeCommand" ; import { CreateMeetingCommandInput , CreateMeetingCommandOutput } from "../commands/CreateMeetingCommand" ; import { CreateMeetingWithAttendeesCommandInput , CreateMeetingWithAttendeesCommandOutput , } from "../commands/CreateMeetingWithAttendeesCommand" ; import { DeleteAttendeeCommandInput , DeleteAttendeeCommandOutput } from "../commands/DeleteAttendeeCommand" ; import { DeleteMeetingCommandInput , DeleteMeetingCommandOutput } from "../commands/DeleteMeetingCommand" ; import { GetAttendeeCommandInput , GetAttendeeCommandOutput } from "../commands/GetAttendeeCommand" ; import { GetMeetingCommandInput , GetMeetingCommandOutput } from "../commands/GetMeetingCommand" ; import { ListAttendeesCommandInput , ListAttendeesCommandOutput } from "../commands/ListAttendeesCommand" ; import { StartMeetingTranscriptionCommandInput , StartMeetingTranscriptionCommandOutput , } from "../commands/StartMeetingTranscriptionCommand" ; import { StopMeetingTranscriptionCommandInput , StopMeetingTranscriptionCommandOutput , } from "../commands/StopMeetingTranscriptionCommand" ; import { Attendee , AudioFeatures , BadRequestException , CreateAttendeeError , CreateAttendeeRequestItem , EngineTranscribeMedicalSettings , EngineTranscribeSettings , ForbiddenException , LimitExceededException , MediaPlacement , Meeting , MeetingFeaturesConfiguration , NotFoundException , NotificationsConfiguration , ServiceUnavailableException , TranscriptionConfiguration , UnauthorizedException , UnprocessableEntityException , } from "../models/models_0" ; export const serializeAws_restJson1BatchCreateAttendeeCommand = async ( input , context ) : Promise < __HttpRequest > => { 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 || "" }` + "/meetings/{MeetingId}/attendees" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } const query = { operation : "batch-create" , } ; let body ; body = JSON . stringify ( { ... ( input . Attendees !== undefined && input . Attendees !== null && { Attendees : serializeAws_restJson1CreateAttendeeRequestItemList ( input . Attendees , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1CreateAttendeeCommand = async ( input , context ) : Promise < __HttpRequest > => { 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 || "" }` + "/meetings/{MeetingId}/attendees" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } let body ; body = JSON . stringify ( { ... ( input . ExternalUserId !== undefined && input . ExternalUserId !== null && { ExternalUserId : input . ExternalUserId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateMeetingCommand = async ( input , context ) : Promise < __HttpRequest > => { 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 || "" }` + "/meetings" ; let body ; body = JSON . stringify ( { ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . ExternalMeetingId !== undefined && input . ExternalMeetingId !== null && { ExternalMeetingId : input . ExternalMeetingId } ) , ... ( input . MediaRegion !== undefined && input . MediaRegion !== null && { MediaRegion : input . MediaRegion } ) , ... ( input . MeetingFeatures !== undefined && input . MeetingFeatures !== null && { MeetingFeatures : serializeAws_restJson1MeetingFeaturesConfiguration ( input . MeetingFeatures , context ) , } ) , ... ( input . MeetingHostId !== undefined && input . MeetingHostId !== null && { MeetingHostId : input . MeetingHostId } ) , ... ( input . NotificationsConfiguration !== undefined && input . NotificationsConfiguration !== null && { NotificationsConfiguration : serializeAws_restJson1NotificationsConfiguration ( input . NotificationsConfiguration , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateMeetingWithAttendeesCommand = async ( input , context ) : Promise < __HttpRequest > => { 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 || "" }` + "/meetings" ; const query = { operation : "create-attendees" , } ; let body ; body = JSON . stringify ( { ... ( input . Attendees !== undefined && input . Attendees !== null && { Attendees : serializeAws_restJson1CreateMeetingWithAttendeesRequestItemList ( input . Attendees , context ) , } ) , ClientRequestToken : input . ClientRequestToken ?? generateIdempotencyToken ( ) , ... ( input . ExternalMeetingId !== undefined && input . ExternalMeetingId !== null && { ExternalMeetingId : input . ExternalMeetingId } ) , ... ( input . MediaRegion !== undefined && input . MediaRegion !== null && { MediaRegion : input . MediaRegion } ) , ... ( input . MeetingFeatures !== undefined && input . MeetingFeatures !== null && { MeetingFeatures : serializeAws_restJson1MeetingFeaturesConfiguration ( input . MeetingFeatures , context ) , } ) , ... ( input . MeetingHostId !== undefined && input . MeetingHostId !== null && { MeetingHostId : input . MeetingHostId } ) , ... ( input . NotificationsConfiguration !== undefined && input . NotificationsConfiguration !== null && { NotificationsConfiguration : serializeAws_restJson1NotificationsConfiguration ( input . NotificationsConfiguration , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteAttendeeCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/meetings/{MeetingId}/attendees/{AttendeeId}" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } if ( input . AttendeeId !== undefined ) { const labelValue = input . AttendeeId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttendeeId." ) ; } resolvedPath = resolvedPath . replace ( "{AttendeeId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttendeeId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteMeetingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/meetings/{MeetingId}" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAttendeeCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/meetings/{MeetingId}/attendees/{AttendeeId}" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } if ( input . AttendeeId !== undefined ) { const labelValue = input . AttendeeId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttendeeId." ) ; } resolvedPath = resolvedPath . replace ( "{AttendeeId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttendeeId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMeetingCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/meetings/{MeetingId}" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListAttendeesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/meetings/{MeetingId}/attendees" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } const query = { ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . MaxResults !== undefined && { "max-results" : input . MaxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1StartMeetingTranscriptionCommand = async ( input , context ) : Promise < __HttpRequest > => { 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 || "" }` + "/meetings/{MeetingId}/transcription" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } const query = { operation : "start" , } ; let body ; body = JSON . stringify ( { ... ( input . TranscriptionConfiguration !== undefined && input . TranscriptionConfiguration !== null && { TranscriptionConfiguration : serializeAws_restJson1TranscriptionConfiguration ( input . TranscriptionConfiguration , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1StopMeetingTranscriptionCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/meetings/{MeetingId}/transcription" ; if ( input . MeetingId !== undefined ) { const labelValue = input . MeetingId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MeetingId." ) ; } resolvedPath = resolvedPath . replace ( "{MeetingId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MeetingId." ) ; } const query = { operation : "stop" , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , query , body , } ) ; } ; export const deserializeAws_restJson1BatchCreateAttendeeCommand = async ( output , context ) : Promise < BatchCreateAttendeeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchCreateAttendeeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attendees : undefined , Errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attendees !== undefined && data . Attendees !== null ) { contents . Attendees = deserializeAws_restJson1AttendeeList ( data . Attendees , context ) ; } if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchCreateAttendeeErrorList ( data . Errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchCreateAttendeeCommandError = async ( output , context ) : Promise < BatchCreateAttendeeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.chimesdkmeetings#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.chimesdkmeetings#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.chimesdkmeetings#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateAttendeeCommand = async ( output , context ) : Promise < CreateAttendeeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAttendeeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attendee : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attendee !== undefined && data . Attendee !== null ) { contents . Attendee = deserializeAws_restJson1Attendee ( data . Attendee , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAttendeeCommandError = async ( output , context ) : Promise < CreateAttendeeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.chimesdkmeetings#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.chimesdkmeetings#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.chimesdkmeetings#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.chimesdkmeetings#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateMeetingCommand = async ( output , context ) : Promise < CreateMeetingCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateMeetingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Meeting : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Meeting !== undefined && data . Meeting !== null ) { contents . Meeting = deserializeAws_restJson1Meeting ( data . Meeting , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateMeetingCommandError = async ( output , context ) : Promise < CreateMeetingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.chimesdkmeetings#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.chimesdkmeetings#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.chimesdkmeetings#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateMeetingWithAttendeesCommand = async ( output , context ) : Promise < CreateMeetingWithAttendeesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateMeetingWithAttendeesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attendees : undefined , Errors : undefined , Meeting : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attendees !== undefined && data . Attendees !== null ) { contents . Attendees = deserializeAws_restJson1AttendeeList ( data . Attendees , context ) ; } if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchCreateAttendeeErrorList ( data . Errors , context ) ; } if ( data . Meeting !== undefined && data . Meeting !== null ) { contents . Meeting = deserializeAws_restJson1Meeting ( data . Meeting , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateMeetingWithAttendeesCommandError = async ( output , context ) : Promise < CreateMeetingWithAttendeesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.chimesdkmeetings#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.chimesdkmeetings#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.chimesdkmeetings#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteAttendeeCommand = async ( output , context ) : Promise < DeleteAttendeeCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAttendeeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAttendeeCommandError = async ( output , context ) : Promise < DeleteAttendeeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteMeetingCommand = async ( output , context ) : Promise < DeleteMeetingCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteMeetingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteMeetingCommandError = async ( output , context ) : Promise < DeleteMeetingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetAttendeeCommand = async ( output , context ) : Promise < GetAttendeeCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAttendeeCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attendee : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attendee !== undefined && data . Attendee !== null ) { contents . Attendee = deserializeAws_restJson1Attendee ( data . Attendee , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAttendeeCommandError = async ( output , context ) : Promise < GetAttendeeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetMeetingCommand = async ( output , context ) : Promise < GetMeetingCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMeetingCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Meeting : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Meeting !== undefined && data . Meeting !== null ) { contents . Meeting = deserializeAws_restJson1Meeting ( data . Meeting , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMeetingCommandError = async ( output , context ) : Promise < GetMeetingCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListAttendeesCommand = async ( output , context ) : Promise < ListAttendeesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListAttendeesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Attendees : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Attendees !== undefined && data . Attendees !== null ) { contents . Attendees = deserializeAws_restJson1AttendeeList ( data . Attendees , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListAttendeesCommandError = async ( output , context ) : Promise < ListAttendeesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StartMeetingTranscriptionCommand = async ( output , context ) : Promise < StartMeetingTranscriptionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StartMeetingTranscriptionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StartMeetingTranscriptionCommandError = async ( output , context ) : Promise < StartMeetingTranscriptionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.chimesdkmeetings#LimitExceededException" : response = { ... ( await deserializeAws_restJson1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.chimesdkmeetings#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.chimesdkmeetings#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.chimesdkmeetings#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1StopMeetingTranscriptionCommand = async ( output , context ) : Promise < StopMeetingTranscriptionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1StopMeetingTranscriptionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1StopMeetingTranscriptionCommandError = async ( output , context ) : Promise < StopMeetingTranscriptionCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.chimesdkmeetings#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.chimesdkmeetings#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.chimesdkmeetings#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.chimesdkmeetings#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnauthorizedException" : case "com.amazonaws.chimesdkmeetings#UnauthorizedException" : response = { ... ( await deserializeAws_restJson1UnauthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.chimesdkmeetings#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1BadRequestExceptionResponse = async ( parsedOutput , context ) : Promise < BadRequestException > => { const contents = { name : "BadRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const deserializeAws_restJson1ForbiddenExceptionResponse = async ( parsedOutput , context ) : Promise < ForbiddenException > => { const contents = { name : "ForbiddenException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const deserializeAws_restJson1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const deserializeAws_restJson1NotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < NotFoundException > => { const contents = { name : "NotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceUnavailableException > => { const contents = { name : "ServiceUnavailableException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , RetryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . RetryAfterSeconds = parsedOutput . headers [ "retry-after" ] ; } const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const deserializeAws_restJson1UnauthorizedExceptionResponse = async ( parsedOutput , context ) : Promise < UnauthorizedException > => { const contents = { name : "UnauthorizedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const deserializeAws_restJson1UnprocessableEntityExceptionResponse = async ( parsedOutput , context ) : Promise < UnprocessableEntityException > => { const contents = { name : "UnprocessableEntityException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Code : undefined , Message : undefined , RequestId : undefined , } ; const data = parsedOutput . body ; if ( data . Code !== undefined && data . Code !== null ) { contents . Code = __expectString ( data . Code ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } if ( data . RequestId !== undefined && data . RequestId !== null ) { contents . RequestId = __expectString ( data . RequestId ) ; } return contents ; } ; const serializeAws_restJson1AudioFeatures = ( input , context ) : any => { return { ... ( input . EchoReduction !== undefined && input . EchoReduction !== null && { EchoReduction : input . EchoReduction } ) , } ; } ; const serializeAws_restJson1CreateAttendeeRequestItem = ( input , context ) : any => { return { ... ( input . ExternalUserId !== undefined && input . ExternalUserId !== null && { ExternalUserId : input . ExternalUserId } ) , } ; } ; const serializeAws_restJson1CreateAttendeeRequestItemList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CreateAttendeeRequestItem ( entry , context ) ; } ) ; } ; const serializeAws_restJson1CreateMeetingWithAttendeesRequestItemList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1CreateAttendeeRequestItem ( entry , context ) ; } ) ; } ; const serializeAws_restJson1EngineTranscribeMedicalSettings = ( input , context ) : any => { return { ... ( input . ContentIdentificationType !== undefined && input . ContentIdentificationType !== null && { ContentIdentificationType : input . ContentIdentificationType } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . Region !== undefined && input . Region !== null && { Region : input . Region } ) , ... ( input . Specialty !== undefined && input . Specialty !== null && { Specialty : input . Specialty } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , ... ( input . VocabularyName !== undefined && input . VocabularyName !== null && { VocabularyName : input . VocabularyName } ) , } ; } ; const serializeAws_restJson1EngineTranscribeSettings = ( input , context ) : any => { return { ... ( input . ContentIdentificationType !== undefined && input . ContentIdentificationType !== null && { ContentIdentificationType : input . ContentIdentificationType } ) , ... ( input . ContentRedactionType !== undefined && input . ContentRedactionType !== null && { ContentRedactionType : input . ContentRedactionType } ) , ... ( input . EnablePartialResultsStabilization !== undefined && input . EnablePartialResultsStabilization !== null && { EnablePartialResultsStabilization : input . EnablePartialResultsStabilization , } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . LanguageModelName !== undefined && input . LanguageModelName !== null && { LanguageModelName : input . LanguageModelName } ) , ... ( input . PartialResultsStability !== undefined && input . PartialResultsStability !== null && { PartialResultsStability : input . PartialResultsStability } ) , ... ( input . PiiEntityTypes !== undefined && input . PiiEntityTypes !== null && { PiiEntityTypes : input . PiiEntityTypes } ) , ... ( input . Region !== undefined && input . Region !== null && { Region : input . Region } ) , ... ( input . VocabularyFilterMethod !== undefined && input . VocabularyFilterMethod !== null && { VocabularyFilterMethod : input . VocabularyFilterMethod } ) , ... ( input . VocabularyFilterName !== undefined && input . VocabularyFilterName !== null && { VocabularyFilterName : input . VocabularyFilterName } ) , ... ( input . VocabularyName !== undefined && input . VocabularyName !== null && { VocabularyName : input . VocabularyName } ) , } ; } ; const serializeAws_restJson1MeetingFeaturesConfiguration = ( input , context ) : any => { return { ... ( input . Audio !== undefined && input . Audio !== null && { Audio : serializeAws_restJson1AudioFeatures ( input . Audio , context ) } ) , } ; } ; const serializeAws_restJson1NotificationsConfiguration = ( input , context ) : any => { return { ... ( input . LambdaFunctionArn !== undefined && input . LambdaFunctionArn !== null && { LambdaFunctionArn : input . LambdaFunctionArn } ) , ... ( input . SnsTopicArn !== undefined && input . SnsTopicArn !== null && { SnsTopicArn : input . SnsTopicArn } ) , ... ( input . SqsQueueArn !== undefined && input . SqsQueueArn !== null && { SqsQueueArn : input . SqsQueueArn } ) , } ; } ; const serializeAws_restJson1TranscriptionConfiguration = ( input , context ) : any => { return { ... ( input . EngineTranscribeMedicalSettings !== undefined && input . EngineTranscribeMedicalSettings !== null && { EngineTranscribeMedicalSettings : serializeAws_restJson1EngineTranscribeMedicalSettings ( input . EngineTranscribeMedicalSettings , context ) , } ) , ... ( input . EngineTranscribeSettings !== undefined && input . EngineTranscribeSettings !== null && { EngineTranscribeSettings : serializeAws_restJson1EngineTranscribeSettings ( input . EngineTranscribeSettings , context ) , } ) , } ; } ; const deserializeAws_restJson1Attendee = ( output , context ) : Attendee => { return { AttendeeId : __expectString ( output . AttendeeId ) , ExternalUserId : __expectString ( output . ExternalUserId ) , JoinToken : __expectString ( output . JoinToken ) , } as any ; } ; const deserializeAws_restJson1AttendeeList = ( output , context ) : Attendee [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Attendee ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AudioFeatures = ( output , context ) : AudioFeatures => { return { EchoReduction : __expectString ( output . EchoReduction ) , } as any ; } ; const deserializeAws_restJson1BatchCreateAttendeeErrorList = ( output , context ) : CreateAttendeeError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CreateAttendeeError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CreateAttendeeError = ( output , context ) : CreateAttendeeError => { return { ErrorCode : __expectString ( output . ErrorCode ) , ErrorMessage : __expectString ( output . ErrorMessage ) , ExternalUserId : __expectString ( output . ExternalUserId ) , } as any ; } ; const deserializeAws_restJson1MediaPlacement = ( output , context ) : MediaPlacement => { return { AudioFallbackUrl : __expectString ( output . AudioFallbackUrl ) , AudioHostUrl : __expectString ( output . AudioHostUrl ) , EventIngestionUrl : __expectString ( output . EventIngestionUrl ) , ScreenDataUrl : __expectString ( output . ScreenDataUrl ) , ScreenSharingUrl : __expectString ( output . ScreenSharingUrl ) , ScreenViewingUrl : __expectString ( output . ScreenViewingUrl ) , SignalingUrl : __expectString ( output . SignalingUrl ) , TurnControlUrl : __expectString ( output . TurnControlUrl ) , } as any ; } ; const deserializeAws_restJson1Meeting = ( output , context ) : Meeting => { return { ExternalMeetingId : __expectString ( output . ExternalMeetingId ) , MediaPlacement : output . MediaPlacement !== undefined && output . MediaPlacement !== null ? deserializeAws_restJson1MediaPlacement ( output . MediaPlacement , context ) : undefined , MediaRegion : __expectString ( output . MediaRegion ) , MeetingFeatures : output . MeetingFeatures !== undefined && output . MeetingFeatures !== null ? deserializeAws_restJson1MeetingFeaturesConfiguration ( output . MeetingFeatures , context ) : undefined , MeetingHostId : __expectString ( output . MeetingHostId ) , MeetingId : __expectString ( output . MeetingId ) , } as any ; } ; const deserializeAws_restJson1MeetingFeaturesConfiguration = ( output , context ) : MeetingFeaturesConfiguration => { return { Audio : output . Audio !== undefined && output . Audio !== null ? deserializeAws_restJson1AudioFeatures ( output . Audio , context ) : undefined , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const isSerializableHeaderValue = ( value ) : boolean => value !== undefined && value !== null && value !== "" && ( ! Object . getOwnPropertyNames ( value ) . includes ( "length" ) || value . length != 0 ) && ( ! Object . getOwnPropertyNames ( value ) . includes ( "size" ) || value . size != 0 ) ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;