import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseRfc3339DateTime as __parseRfc3339DateTime , serializeFloat as __serializeFloat , } 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 { CreateAppCommandInput , CreateAppCommandOutput } from "../commands/CreateAppCommand" ; import { CreateCampaignCommandInput , CreateCampaignCommandOutput } from "../commands/CreateCampaignCommand" ; import { CreateEmailTemplateCommandInput , CreateEmailTemplateCommandOutput , } from "../commands/CreateEmailTemplateCommand" ; import { CreateExportJobCommandInput , CreateExportJobCommandOutput } from "../commands/CreateExportJobCommand" ; import { CreateImportJobCommandInput , CreateImportJobCommandOutput } from "../commands/CreateImportJobCommand" ; import { CreateInAppTemplateCommandInput , CreateInAppTemplateCommandOutput , } from "../commands/CreateInAppTemplateCommand" ; import { CreateJourneyCommandInput , CreateJourneyCommandOutput } from "../commands/CreateJourneyCommand" ; import { CreatePushTemplateCommandInput , CreatePushTemplateCommandOutput } from "../commands/CreatePushTemplateCommand" ; import { CreateRecommenderConfigurationCommandInput , CreateRecommenderConfigurationCommandOutput , } from "../commands/CreateRecommenderConfigurationCommand" ; import { CreateSegmentCommandInput , CreateSegmentCommandOutput } from "../commands/CreateSegmentCommand" ; import { CreateSmsTemplateCommandInput , CreateSmsTemplateCommandOutput } from "../commands/CreateSmsTemplateCommand" ; import { CreateVoiceTemplateCommandInput , CreateVoiceTemplateCommandOutput , } from "../commands/CreateVoiceTemplateCommand" ; import { DeleteAdmChannelCommandInput , DeleteAdmChannelCommandOutput } from "../commands/DeleteAdmChannelCommand" ; import { DeleteApnsChannelCommandInput , DeleteApnsChannelCommandOutput } from "../commands/DeleteApnsChannelCommand" ; import { DeleteApnsSandboxChannelCommandInput , DeleteApnsSandboxChannelCommandOutput , } from "../commands/DeleteApnsSandboxChannelCommand" ; import { DeleteApnsVoipChannelCommandInput , DeleteApnsVoipChannelCommandOutput , } from "../commands/DeleteApnsVoipChannelCommand" ; import { DeleteApnsVoipSandboxChannelCommandInput , DeleteApnsVoipSandboxChannelCommandOutput , } from "../commands/DeleteApnsVoipSandboxChannelCommand" ; import { DeleteAppCommandInput , DeleteAppCommandOutput } from "../commands/DeleteAppCommand" ; import { DeleteBaiduChannelCommandInput , DeleteBaiduChannelCommandOutput } from "../commands/DeleteBaiduChannelCommand" ; import { DeleteCampaignCommandInput , DeleteCampaignCommandOutput } from "../commands/DeleteCampaignCommand" ; import { DeleteEmailChannelCommandInput , DeleteEmailChannelCommandOutput } from "../commands/DeleteEmailChannelCommand" ; import { DeleteEmailTemplateCommandInput , DeleteEmailTemplateCommandOutput , } from "../commands/DeleteEmailTemplateCommand" ; import { DeleteEndpointCommandInput , DeleteEndpointCommandOutput } from "../commands/DeleteEndpointCommand" ; import { DeleteEventStreamCommandInput , DeleteEventStreamCommandOutput } from "../commands/DeleteEventStreamCommand" ; import { DeleteGcmChannelCommandInput , DeleteGcmChannelCommandOutput } from "../commands/DeleteGcmChannelCommand" ; import { DeleteInAppTemplateCommandInput , DeleteInAppTemplateCommandOutput , } from "../commands/DeleteInAppTemplateCommand" ; import { DeleteJourneyCommandInput , DeleteJourneyCommandOutput } from "../commands/DeleteJourneyCommand" ; import { DeletePushTemplateCommandInput , DeletePushTemplateCommandOutput } from "../commands/DeletePushTemplateCommand" ; import { DeleteRecommenderConfigurationCommandInput , DeleteRecommenderConfigurationCommandOutput , } from "../commands/DeleteRecommenderConfigurationCommand" ; import { DeleteSegmentCommandInput , DeleteSegmentCommandOutput } from "../commands/DeleteSegmentCommand" ; import { DeleteSmsChannelCommandInput , DeleteSmsChannelCommandOutput } from "../commands/DeleteSmsChannelCommand" ; import { DeleteSmsTemplateCommandInput , DeleteSmsTemplateCommandOutput } from "../commands/DeleteSmsTemplateCommand" ; import { DeleteUserEndpointsCommandInput , DeleteUserEndpointsCommandOutput , } from "../commands/DeleteUserEndpointsCommand" ; import { DeleteVoiceChannelCommandInput , DeleteVoiceChannelCommandOutput } from "../commands/DeleteVoiceChannelCommand" ; import { DeleteVoiceTemplateCommandInput , DeleteVoiceTemplateCommandOutput , } from "../commands/DeleteVoiceTemplateCommand" ; import { GetAdmChannelCommandInput , GetAdmChannelCommandOutput } from "../commands/GetAdmChannelCommand" ; import { GetApnsChannelCommandInput , GetApnsChannelCommandOutput } from "../commands/GetApnsChannelCommand" ; import { GetApnsSandboxChannelCommandInput , GetApnsSandboxChannelCommandOutput , } from "../commands/GetApnsSandboxChannelCommand" ; import { GetApnsVoipChannelCommandInput , GetApnsVoipChannelCommandOutput } from "../commands/GetApnsVoipChannelCommand" ; import { GetApnsVoipSandboxChannelCommandInput , GetApnsVoipSandboxChannelCommandOutput , } from "../commands/GetApnsVoipSandboxChannelCommand" ; import { GetAppCommandInput , GetAppCommandOutput } from "../commands/GetAppCommand" ; import { GetApplicationDateRangeKpiCommandInput , GetApplicationDateRangeKpiCommandOutput , } from "../commands/GetApplicationDateRangeKpiCommand" ; import { GetApplicationSettingsCommandInput , GetApplicationSettingsCommandOutput , } from "../commands/GetApplicationSettingsCommand" ; import { GetAppsCommandInput , GetAppsCommandOutput } from "../commands/GetAppsCommand" ; import { GetBaiduChannelCommandInput , GetBaiduChannelCommandOutput } from "../commands/GetBaiduChannelCommand" ; import { GetCampaignActivitiesCommandInput , GetCampaignActivitiesCommandOutput , } from "../commands/GetCampaignActivitiesCommand" ; import { GetCampaignCommandInput , GetCampaignCommandOutput } from "../commands/GetCampaignCommand" ; import { GetCampaignDateRangeKpiCommandInput , GetCampaignDateRangeKpiCommandOutput , } from "../commands/GetCampaignDateRangeKpiCommand" ; import { GetCampaignsCommandInput , GetCampaignsCommandOutput } from "../commands/GetCampaignsCommand" ; import { GetCampaignVersionCommandInput , GetCampaignVersionCommandOutput } from "../commands/GetCampaignVersionCommand" ; import { GetCampaignVersionsCommandInput , GetCampaignVersionsCommandOutput , } from "../commands/GetCampaignVersionsCommand" ; import { GetChannelsCommandInput , GetChannelsCommandOutput } from "../commands/GetChannelsCommand" ; import { GetEmailChannelCommandInput , GetEmailChannelCommandOutput } from "../commands/GetEmailChannelCommand" ; import { GetEmailTemplateCommandInput , GetEmailTemplateCommandOutput } from "../commands/GetEmailTemplateCommand" ; import { GetEndpointCommandInput , GetEndpointCommandOutput } from "../commands/GetEndpointCommand" ; import { GetEventStreamCommandInput , GetEventStreamCommandOutput } from "../commands/GetEventStreamCommand" ; import { GetExportJobCommandInput , GetExportJobCommandOutput } from "../commands/GetExportJobCommand" ; import { GetExportJobsCommandInput , GetExportJobsCommandOutput } from "../commands/GetExportJobsCommand" ; import { GetGcmChannelCommandInput , GetGcmChannelCommandOutput } from "../commands/GetGcmChannelCommand" ; import { GetImportJobCommandInput , GetImportJobCommandOutput } from "../commands/GetImportJobCommand" ; import { GetImportJobsCommandInput , GetImportJobsCommandOutput } from "../commands/GetImportJobsCommand" ; import { GetInAppMessagesCommandInput , GetInAppMessagesCommandOutput } from "../commands/GetInAppMessagesCommand" ; import { GetInAppTemplateCommandInput , GetInAppTemplateCommandOutput } from "../commands/GetInAppTemplateCommand" ; import { GetJourneyCommandInput , GetJourneyCommandOutput } from "../commands/GetJourneyCommand" ; import { GetJourneyDateRangeKpiCommandInput , GetJourneyDateRangeKpiCommandOutput , } from "../commands/GetJourneyDateRangeKpiCommand" ; import { GetJourneyExecutionActivityMetricsCommandInput , GetJourneyExecutionActivityMetricsCommandOutput , } from "../commands/GetJourneyExecutionActivityMetricsCommand" ; import { GetJourneyExecutionMetricsCommandInput , GetJourneyExecutionMetricsCommandOutput , } from "../commands/GetJourneyExecutionMetricsCommand" ; import { GetPushTemplateCommandInput , GetPushTemplateCommandOutput } from "../commands/GetPushTemplateCommand" ; import { GetRecommenderConfigurationCommandInput , GetRecommenderConfigurationCommandOutput , } from "../commands/GetRecommenderConfigurationCommand" ; import { GetRecommenderConfigurationsCommandInput , GetRecommenderConfigurationsCommandOutput , } from "../commands/GetRecommenderConfigurationsCommand" ; import { GetSegmentCommandInput , GetSegmentCommandOutput } from "../commands/GetSegmentCommand" ; import { GetSegmentExportJobsCommandInput , GetSegmentExportJobsCommandOutput , } from "../commands/GetSegmentExportJobsCommand" ; import { GetSegmentImportJobsCommandInput , GetSegmentImportJobsCommandOutput , } from "../commands/GetSegmentImportJobsCommand" ; import { GetSegmentsCommandInput , GetSegmentsCommandOutput } from "../commands/GetSegmentsCommand" ; import { GetSegmentVersionCommandInput , GetSegmentVersionCommandOutput } from "../commands/GetSegmentVersionCommand" ; import { GetSegmentVersionsCommandInput , GetSegmentVersionsCommandOutput } from "../commands/GetSegmentVersionsCommand" ; import { GetSmsChannelCommandInput , GetSmsChannelCommandOutput } from "../commands/GetSmsChannelCommand" ; import { GetSmsTemplateCommandInput , GetSmsTemplateCommandOutput } from "../commands/GetSmsTemplateCommand" ; import { GetUserEndpointsCommandInput , GetUserEndpointsCommandOutput } from "../commands/GetUserEndpointsCommand" ; import { GetVoiceChannelCommandInput , GetVoiceChannelCommandOutput } from "../commands/GetVoiceChannelCommand" ; import { GetVoiceTemplateCommandInput , GetVoiceTemplateCommandOutput } from "../commands/GetVoiceTemplateCommand" ; import { ListJourneysCommandInput , ListJourneysCommandOutput } from "../commands/ListJourneysCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListTemplatesCommandInput , ListTemplatesCommandOutput } from "../commands/ListTemplatesCommand" ; import { ListTemplateVersionsCommandInput , ListTemplateVersionsCommandOutput , } from "../commands/ListTemplateVersionsCommand" ; import { PhoneNumberValidateCommandInput , PhoneNumberValidateCommandOutput , } from "../commands/PhoneNumberValidateCommand" ; import { PutEventsCommandInput , PutEventsCommandOutput } from "../commands/PutEventsCommand" ; import { PutEventStreamCommandInput , PutEventStreamCommandOutput } from "../commands/PutEventStreamCommand" ; import { RemoveAttributesCommandInput , RemoveAttributesCommandOutput } from "../commands/RemoveAttributesCommand" ; import { SendMessagesCommandInput , SendMessagesCommandOutput } from "../commands/SendMessagesCommand" ; import { SendOTPMessageCommandInput , SendOTPMessageCommandOutput } from "../commands/SendOTPMessageCommand" ; import { SendUsersMessagesCommandInput , SendUsersMessagesCommandOutput } from "../commands/SendUsersMessagesCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateAdmChannelCommandInput , UpdateAdmChannelCommandOutput } from "../commands/UpdateAdmChannelCommand" ; import { UpdateApnsChannelCommandInput , UpdateApnsChannelCommandOutput } from "../commands/UpdateApnsChannelCommand" ; import { UpdateApnsSandboxChannelCommandInput , UpdateApnsSandboxChannelCommandOutput , } from "../commands/UpdateApnsSandboxChannelCommand" ; import { UpdateApnsVoipChannelCommandInput , UpdateApnsVoipChannelCommandOutput , } from "../commands/UpdateApnsVoipChannelCommand" ; import { UpdateApnsVoipSandboxChannelCommandInput , UpdateApnsVoipSandboxChannelCommandOutput , } from "../commands/UpdateApnsVoipSandboxChannelCommand" ; import { UpdateApplicationSettingsCommandInput , UpdateApplicationSettingsCommandOutput , } from "../commands/UpdateApplicationSettingsCommand" ; import { UpdateBaiduChannelCommandInput , UpdateBaiduChannelCommandOutput } from "../commands/UpdateBaiduChannelCommand" ; import { UpdateCampaignCommandInput , UpdateCampaignCommandOutput } from "../commands/UpdateCampaignCommand" ; import { UpdateEmailChannelCommandInput , UpdateEmailChannelCommandOutput } from "../commands/UpdateEmailChannelCommand" ; import { UpdateEmailTemplateCommandInput , UpdateEmailTemplateCommandOutput , } from "../commands/UpdateEmailTemplateCommand" ; import { UpdateEndpointCommandInput , UpdateEndpointCommandOutput } from "../commands/UpdateEndpointCommand" ; import { UpdateEndpointsBatchCommandInput , UpdateEndpointsBatchCommandOutput , } from "../commands/UpdateEndpointsBatchCommand" ; import { UpdateGcmChannelCommandInput , UpdateGcmChannelCommandOutput } from "../commands/UpdateGcmChannelCommand" ; import { UpdateInAppTemplateCommandInput , UpdateInAppTemplateCommandOutput , } from "../commands/UpdateInAppTemplateCommand" ; import { UpdateJourneyCommandInput , UpdateJourneyCommandOutput } from "../commands/UpdateJourneyCommand" ; import { UpdateJourneyStateCommandInput , UpdateJourneyStateCommandOutput } from "../commands/UpdateJourneyStateCommand" ; import { UpdatePushTemplateCommandInput , UpdatePushTemplateCommandOutput } from "../commands/UpdatePushTemplateCommand" ; import { UpdateRecommenderConfigurationCommandInput , UpdateRecommenderConfigurationCommandOutput , } from "../commands/UpdateRecommenderConfigurationCommand" ; import { UpdateSegmentCommandInput , UpdateSegmentCommandOutput } from "../commands/UpdateSegmentCommand" ; import { UpdateSmsChannelCommandInput , UpdateSmsChannelCommandOutput } from "../commands/UpdateSmsChannelCommand" ; import { UpdateSmsTemplateCommandInput , UpdateSmsTemplateCommandOutput } from "../commands/UpdateSmsTemplateCommand" ; import { UpdateTemplateActiveVersionCommandInput , UpdateTemplateActiveVersionCommandOutput , } from "../commands/UpdateTemplateActiveVersionCommand" ; import { UpdateVoiceChannelCommandInput , UpdateVoiceChannelCommandOutput } from "../commands/UpdateVoiceChannelCommand" ; import { UpdateVoiceTemplateCommandInput , UpdateVoiceTemplateCommandOutput , } from "../commands/UpdateVoiceTemplateCommand" ; import { VerifyOTPMessageCommandInput , VerifyOTPMessageCommandOutput } from "../commands/VerifyOTPMessageCommand" ; import { __EndpointTypesElement , ActivitiesResponse , Activity , ActivityResponse , AddressConfiguration , ADMChannelRequest , ADMChannelResponse , ADMMessage , AndroidPushNotificationTemplate , APNSChannelRequest , APNSChannelResponse , APNSMessage , APNSPushNotificationTemplate , APNSSandboxChannelRequest , APNSSandboxChannelResponse , APNSVoipChannelRequest , APNSVoipChannelResponse , APNSVoipSandboxChannelRequest , APNSVoipSandboxChannelResponse , ApplicationDateRangeKpiResponse , ApplicationResponse , ApplicationSettingsResource , ApplicationsResponse , AttributeDimension , AttributesResource , BadRequestException , BaiduChannelRequest , BaiduChannelResponse , BaiduMessage , BaseKpiResult , CampaignCustomMessage , CampaignDateRangeKpiResponse , CampaignEmailMessage , CampaignEventFilter , CampaignHook , CampaignInAppMessage , CampaignLimits , CampaignResponse , CampaignSmsMessage , CampaignsResponse , CampaignState , ChannelResponse , ChannelsResponse , Condition , ConditionalSplitActivity , ConflictException , ContactCenterActivity , CreateApplicationRequest , CreateRecommenderConfigurationShape , CreateTemplateMessageBody , CustomDeliveryConfiguration , CustomMessageActivity , DefaultButtonConfiguration , DefaultMessage , DefaultPushNotificationMessage , DefaultPushNotificationTemplate , DirectMessageConfiguration , EmailChannelRequest , EmailChannelResponse , EmailMessage , EmailMessageActivity , EmailTemplateRequest , EmailTemplateResponse , EndpointBatchItem , EndpointBatchRequest , EndpointDemographic , EndpointItemResponse , EndpointLocation , EndpointMessageResult , EndpointRequest , EndpointResponse , EndpointSendConfiguration , EndpointsResponse , EndpointUser , Event , EventCondition , EventDimensions , EventFilter , EventItemResponse , EventsBatch , EventsRequest , EventsResponse , EventStartCondition , EventStream , ExportJobRequest , ExportJobResource , ExportJobResponse , ExportJobsResponse , ForbiddenException , GCMChannelRequest , GCMChannelResponse , GCMMessage , GPSCoordinates , GPSPointDimension , HoldoutActivity , ImportJobRequest , ImportJobResource , ImportJobResponse , InAppMessageBodyConfig , InAppMessageButton , InAppMessageContent , InAppMessageHeaderConfig , InAppTemplateRequest , InternalServerErrorException , ItemResponse , JourneyChannelSettings , JourneyCustomMessage , JourneyEmailMessage , JourneyLimits , JourneyPushMessage , JourneyResponse , JourneySchedule , JourneySMSMessage , Message , MessageBody , MessageConfiguration , MethodNotAllowedException , MetricDimension , MultiConditionalBranch , MultiConditionalSplitActivity , NotFoundException , OverrideButtonConfiguration , PayloadTooLargeException , PublicEndpoint , PushMessageActivity , PushNotificationTemplateRequest , QuietTime , RandomSplitActivity , RandomSplitEntry , RawEmail , RecencyDimension , RecommenderConfigurationResponse , ResultRow , ResultRowValue , Schedule , SegmentBehaviors , SegmentCondition , SegmentDemographics , SegmentDimensions , SegmentGroup , SegmentGroupList , SegmentImportResource , SegmentLocation , SegmentReference , SegmentResponse , Session , SetDimension , SimpleCondition , SimpleEmail , SimpleEmailPart , SMSChannelResponse , SMSMessage , SMSMessageActivity , SMSTemplateRequest , StartCondition , Template , TemplateConfiguration , TemplateCreateMessageBody , TooManyRequestsException , TreatmentResource , VoiceChannelResponse , VoiceMessage , VoiceTemplateRequest , WaitActivity , WaitTime , WriteCampaignRequest , WriteJourneyRequest , WriteSegmentRequest , WriteTreatmentResource , } from "../models/models_0" ; import { ImportJobsResponse , InAppCampaignSchedule , InAppMessage , InAppMessageCampaign , InAppMessagesResponse , InAppTemplateResponse , JourneyDateRangeKpiResponse , JourneyExecutionActivityMetricsResponse , JourneyExecutionMetricsResponse , JourneysResponse , JourneyStateRequest , ListRecommenderConfigurationsResponse , MessageRequest , MessageResponse , MessageResult , NumberValidateRequest , NumberValidateResponse , PushNotificationTemplateResponse , SegmentsResponse , SendOTPMessageRequestParameters , SendUsersMessageRequest , SendUsersMessageResponse , SMSChannelRequest , SMSTemplateResponse , TagsModel , TemplateActiveVersionRequest , TemplateResponse , TemplatesResponse , TemplateVersionResponse , TemplateVersionsResponse , UpdateAttributesRequest , UpdateRecommenderConfigurationShape , VerificationResponse , VerifyOTPMessageRequestParameters , VoiceChannelRequest , VoiceTemplateResponse , WriteApplicationSettingsRequest , WriteEventStream , } from "../models/models_1" ; export const serializeAws_restJson1CreateAppCommand = 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 || "" }` + "/v1/apps" ; let body ; if ( input . CreateApplicationRequest !== undefined ) { body = serializeAws_restJson1CreateApplicationRequest ( input . CreateApplicationRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateCampaignCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . WriteCampaignRequest !== undefined ) { body = serializeAws_restJson1WriteCampaignRequest ( input . WriteCampaignRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEmailTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/email" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; if ( input . EmailTemplateRequest !== undefined ) { body = serializeAws_restJson1EmailTemplateRequest ( input . EmailTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateExportJobCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/jobs/export" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . ExportJobRequest !== undefined ) { body = serializeAws_restJson1ExportJobRequest ( input . ExportJobRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateImportJobCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/jobs/import" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . ImportJobRequest !== undefined ) { body = serializeAws_restJson1ImportJobRequest ( input . ImportJobRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateInAppTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/inapp" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; if ( input . InAppTemplateRequest !== undefined ) { body = serializeAws_restJson1InAppTemplateRequest ( input . InAppTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateJourneyCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . WriteJourneyRequest !== undefined ) { body = serializeAws_restJson1WriteJourneyRequest ( input . WriteJourneyRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreatePushTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/push" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; if ( input . PushNotificationTemplateRequest !== undefined ) { body = serializeAws_restJson1PushNotificationTemplateRequest ( input . PushNotificationTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateRecommenderConfigurationCommand = 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 || "" }` + "/v1/recommenders" ; let body ; if ( input . CreateRecommenderConfiguration !== undefined ) { body = serializeAws_restJson1CreateRecommenderConfigurationShape ( input . CreateRecommenderConfiguration , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSegmentCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . WriteSegmentRequest !== undefined ) { body = serializeAws_restJson1WriteSegmentRequest ( input . WriteSegmentRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateSmsTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/sms" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; if ( input . SMSTemplateRequest !== undefined ) { body = serializeAws_restJson1SMSTemplateRequest ( input . SMSTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateVoiceTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/voice" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } let body ; if ( input . VoiceTemplateRequest !== undefined ) { body = serializeAws_restJson1VoiceTemplateRequest ( input . VoiceTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAdmChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/adm" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApnsChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApnsSandboxChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_sandbox" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApnsVoipChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_voip" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteApnsVoipSandboxChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAppCommand = 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 || "" }` + "/v1/apps/{ApplicationId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBaiduChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/baidu" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteCampaignCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEmailChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/email" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEmailTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/email" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteEndpointCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . EndpointId !== undefined ) { const labelValue = input . EndpointId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EndpointId." ) ; } resolvedPath = resolvedPath . replace ( "{EndpointId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EndpointId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEventStreamCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/eventstream" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteGcmChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/gcm" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteInAppTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/inapp" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteJourneyCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeletePushTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/push" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteRecommenderConfigurationCommand = 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 || "" }` + "/v1/recommenders/{RecommenderId}" ; if ( input . RecommenderId !== undefined ) { const labelValue = input . RecommenderId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecommenderId." ) ; } resolvedPath = resolvedPath . replace ( "{RecommenderId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecommenderId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSegmentCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSmsChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/sms" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteSmsTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/sms" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DeleteUserEndpointsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/users/{UserId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . UserId !== undefined ) { const labelValue = input . UserId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: UserId." ) ; } resolvedPath = resolvedPath . replace ( "{UserId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: UserId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteVoiceChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/voice" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteVoiceTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/voice" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetAdmChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/adm" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApnsChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApnsSandboxChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_sandbox" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApnsVoipChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_voip" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApnsVoipSandboxChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAppCommand = 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 || "" }` + "/v1/apps/{ApplicationId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetApplicationDateRangeKpiCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/kpis/daterange/{KpiName}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . KpiName !== undefined ) { const labelValue = input . KpiName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: KpiName." ) ; } resolvedPath = resolvedPath . replace ( "{KpiName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: KpiName." ) ; } const query = { ... ( input . EndTime !== undefined && { "end-time" : ( input . EndTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . StartTime !== undefined && { "start-time" : ( input . StartTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetApplicationSettingsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/settings" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetAppsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/apps" ; const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetBaiduChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/baidu" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCampaignCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCampaignActivitiesCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/activities" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCampaignDateRangeKpiCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/kpis/daterange/{KpiName}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } if ( input . KpiName !== undefined ) { const labelValue = input . KpiName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: KpiName." ) ; } resolvedPath = resolvedPath . replace ( "{KpiName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: KpiName." ) ; } const query = { ... ( input . EndTime !== undefined && { "end-time" : ( input . EndTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . StartTime !== undefined && { "start-time" : ( input . StartTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCampaignsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetCampaignVersionCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/versions/{Version}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } if ( input . Version !== undefined ) { const labelValue = input . Version ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Version." ) ; } resolvedPath = resolvedPath . replace ( "{Version}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Version." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCampaignVersionsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/versions" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetChannelsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEmailChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/email" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEmailTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/email" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetEndpointCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . EndpointId !== undefined ) { const labelValue = input . EndpointId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EndpointId." ) ; } resolvedPath = resolvedPath . replace ( "{EndpointId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EndpointId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEventStreamCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/eventstream" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetExportJobCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/jobs/export/{JobId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JobId !== undefined ) { const labelValue = input . JobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobId." ) ; } resolvedPath = resolvedPath . replace ( "{JobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetExportJobsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/jobs/export" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetGcmChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/gcm" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetImportJobCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/jobs/import/{JobId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JobId !== undefined ) { const labelValue = input . JobId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JobId." ) ; } resolvedPath = resolvedPath . replace ( "{JobId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JobId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetImportJobsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/jobs/import" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetInAppMessagesCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}/inappmessages" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . EndpointId !== undefined ) { const labelValue = input . EndpointId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EndpointId." ) ; } resolvedPath = resolvedPath . replace ( "{EndpointId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EndpointId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetInAppTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/inapp" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetJourneyCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetJourneyDateRangeKpiCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/kpis/daterange/{KpiName}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } if ( input . KpiName !== undefined ) { const labelValue = input . KpiName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: KpiName." ) ; } resolvedPath = resolvedPath . replace ( "{KpiName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: KpiName." ) ; } const query = { ... ( input . EndTime !== undefined && { "end-time" : ( input . EndTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) } ) , ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . StartTime !== undefined && { "start-time" : ( input . StartTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" ) . toString ( ) , } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetJourneyExecutionActivityMetricsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/activities/{JourneyActivityId}/execution-metrics" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyActivityId !== undefined ) { const labelValue = input . JourneyActivityId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyActivityId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyActivityId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyActivityId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } const query = { ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetJourneyExecutionMetricsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/execution-metrics" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } const query = { ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetPushTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/push" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetRecommenderConfigurationCommand = 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 || "" }` + "/v1/recommenders/{RecommenderId}" ; if ( input . RecommenderId !== undefined ) { const labelValue = input . RecommenderId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecommenderId." ) ; } resolvedPath = resolvedPath . replace ( "{RecommenderId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecommenderId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetRecommenderConfigurationsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/recommenders" ; const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSegmentCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSegmentExportJobsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}/jobs/export" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSegmentImportJobsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}/jobs/import" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSegmentsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSegmentVersionCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}/versions/{Version}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } if ( input . Version !== undefined ) { const labelValue = input . Version ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Version." ) ; } resolvedPath = resolvedPath . replace ( "{Version}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Version." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSegmentVersionsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}/versions" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetSmsChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/sms" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetSmsTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/sms" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetUserEndpointsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/users/{UserId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . UserId !== undefined ) { const labelValue = input . UserId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: UserId." ) ; } resolvedPath = resolvedPath . replace ( "{UserId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: UserId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetVoiceChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/voice" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetVoiceTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/voice" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListJourneysCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } const query = { ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Token !== undefined && { token : input . Token } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = 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 || "" }` + "/v1/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTemplatesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/v1/templates" ; const query = { ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , ... ( input . Prefix !== undefined && { prefix : input . Prefix } ) , ... ( input . TemplateType !== undefined && { "template-type" : input . TemplateType } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTemplateVersionsCommand = 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 || "" }` + "/v1/templates/{TemplateName}/{TemplateType}/versions" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } if ( input . TemplateType !== undefined ) { const labelValue = input . TemplateType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateType." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateType." ) ; } const query = { ... ( input . NextToken !== undefined && { "next-token" : input . NextToken } ) , ... ( input . PageSize !== undefined && { "page-size" : input . PageSize } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1PhoneNumberValidateCommand = 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 || "" }` + "/v1/phone/number/validate" ; let body ; if ( input . NumberValidateRequest !== undefined ) { body = serializeAws_restJson1NumberValidateRequest ( input . NumberValidateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEventsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/events" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . EventsRequest !== undefined ) { body = serializeAws_restJson1EventsRequest ( input . EventsRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutEventStreamCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/eventstream" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . WriteEventStream !== undefined ) { body = serializeAws_restJson1WriteEventStream ( input . WriteEventStream , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RemoveAttributesCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/attributes/{AttributeType}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . AttributeType !== undefined ) { const labelValue = input . AttributeType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AttributeType." ) ; } resolvedPath = resolvedPath . replace ( "{AttributeType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AttributeType." ) ; } let body ; if ( input . UpdateAttributesRequest !== undefined ) { body = serializeAws_restJson1UpdateAttributesRequest ( input . UpdateAttributesRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SendMessagesCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/messages" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . MessageRequest !== undefined ) { body = serializeAws_restJson1MessageRequest ( input . MessageRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SendOTPMessageCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/otp" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . SendOTPMessageRequestParameters !== undefined ) { body = serializeAws_restJson1SendOTPMessageRequestParameters ( input . SendOTPMessageRequestParameters , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SendUsersMessagesCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/users-messages" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . SendUsersMessageRequest !== undefined ) { body = serializeAws_restJson1SendUsersMessageRequest ( input . SendUsersMessageRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = 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 || "" }` + "/v1/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; if ( input . TagsModel !== undefined ) { body = serializeAws_restJson1TagsModel ( input . TagsModel , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = 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 || "" }` + "/v1/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } const query = { ... ( input . TagKeys !== undefined && { tagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateAdmChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/adm" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . ADMChannelRequest !== undefined ) { body = serializeAws_restJson1ADMChannelRequest ( input . ADMChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateApnsChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . APNSChannelRequest !== undefined ) { body = serializeAws_restJson1APNSChannelRequest ( input . APNSChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateApnsSandboxChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_sandbox" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . APNSSandboxChannelRequest !== undefined ) { body = serializeAws_restJson1APNSSandboxChannelRequest ( input . APNSSandboxChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateApnsVoipChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_voip" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . APNSVoipChannelRequest !== undefined ) { body = serializeAws_restJson1APNSVoipChannelRequest ( input . APNSVoipChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateApnsVoipSandboxChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . APNSVoipSandboxChannelRequest !== undefined ) { body = serializeAws_restJson1APNSVoipSandboxChannelRequest ( input . APNSVoipSandboxChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateApplicationSettingsCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/settings" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . WriteApplicationSettingsRequest !== undefined ) { body = serializeAws_restJson1WriteApplicationSettingsRequest ( input . WriteApplicationSettingsRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateBaiduChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/baidu" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . BaiduChannelRequest !== undefined ) { body = serializeAws_restJson1BaiduChannelRequest ( input . BaiduChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateCampaignCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . CampaignId !== undefined ) { const labelValue = input . CampaignId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CampaignId." ) ; } resolvedPath = resolvedPath . replace ( "{CampaignId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CampaignId." ) ; } let body ; if ( input . WriteCampaignRequest !== undefined ) { body = serializeAws_restJson1WriteCampaignRequest ( input . WriteCampaignRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEmailChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/email" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . EmailChannelRequest !== undefined ) { body = serializeAws_restJson1EmailChannelRequest ( input . EmailChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEmailTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/email" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . CreateNewVersion !== undefined && { "create-new-version" : input . CreateNewVersion . toString ( ) } ) , ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; if ( input . EmailTemplateRequest !== undefined ) { body = serializeAws_restJson1EmailTemplateRequest ( input . EmailTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateEndpointCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . EndpointId !== undefined ) { const labelValue = input . EndpointId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EndpointId." ) ; } resolvedPath = resolvedPath . replace ( "{EndpointId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EndpointId." ) ; } let body ; if ( input . EndpointRequest !== undefined ) { body = serializeAws_restJson1EndpointRequest ( input . EndpointRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateEndpointsBatchCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/endpoints" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . EndpointBatchRequest !== undefined ) { body = serializeAws_restJson1EndpointBatchRequest ( input . EndpointBatchRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateGcmChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/gcm" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . GCMChannelRequest !== undefined ) { body = serializeAws_restJson1GCMChannelRequest ( input . GCMChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateInAppTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/inapp" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . CreateNewVersion !== undefined && { "create-new-version" : input . CreateNewVersion . toString ( ) } ) , ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; if ( input . InAppTemplateRequest !== undefined ) { body = serializeAws_restJson1InAppTemplateRequest ( input . InAppTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateJourneyCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } let body ; if ( input . WriteJourneyRequest !== undefined ) { body = serializeAws_restJson1WriteJourneyRequest ( input . WriteJourneyRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateJourneyStateCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/state" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . JourneyId !== undefined ) { const labelValue = input . JourneyId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: JourneyId." ) ; } resolvedPath = resolvedPath . replace ( "{JourneyId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: JourneyId." ) ; } let body ; if ( input . JourneyStateRequest !== undefined ) { body = serializeAws_restJson1JourneyStateRequest ( input . JourneyStateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdatePushTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/push" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . CreateNewVersion !== undefined && { "create-new-version" : input . CreateNewVersion . toString ( ) } ) , ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; if ( input . PushNotificationTemplateRequest !== undefined ) { body = serializeAws_restJson1PushNotificationTemplateRequest ( input . PushNotificationTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateRecommenderConfigurationCommand = 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 || "" }` + "/v1/recommenders/{RecommenderId}" ; if ( input . RecommenderId !== undefined ) { const labelValue = input . RecommenderId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: RecommenderId." ) ; } resolvedPath = resolvedPath . replace ( "{RecommenderId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: RecommenderId." ) ; } let body ; if ( input . UpdateRecommenderConfiguration !== undefined ) { body = serializeAws_restJson1UpdateRecommenderConfigurationShape ( input . UpdateRecommenderConfiguration , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSegmentCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/segments/{SegmentId}" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } if ( input . SegmentId !== undefined ) { const labelValue = input . SegmentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: SegmentId." ) ; } resolvedPath = resolvedPath . replace ( "{SegmentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: SegmentId." ) ; } let body ; if ( input . WriteSegmentRequest !== undefined ) { body = serializeAws_restJson1WriteSegmentRequest ( input . WriteSegmentRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSmsChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/sms" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . SMSChannelRequest !== undefined ) { body = serializeAws_restJson1SMSChannelRequest ( input . SMSChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateSmsTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/sms" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . CreateNewVersion !== undefined && { "create-new-version" : input . CreateNewVersion . toString ( ) } ) , ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; if ( input . SMSTemplateRequest !== undefined ) { body = serializeAws_restJson1SMSTemplateRequest ( input . SMSTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateTemplateActiveVersionCommand = 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 || "" }` + "/v1/templates/{TemplateName}/{TemplateType}/active-version" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } if ( input . TemplateType !== undefined ) { const labelValue = input . TemplateType ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateType." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateType}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateType." ) ; } let body ; if ( input . TemplateActiveVersionRequest !== undefined ) { body = serializeAws_restJson1TemplateActiveVersionRequest ( input . TemplateActiveVersionRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateVoiceChannelCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/channels/voice" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . VoiceChannelRequest !== undefined ) { body = serializeAws_restJson1VoiceChannelRequest ( input . VoiceChannelRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateVoiceTemplateCommand = 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 || "" }` + "/v1/templates/{TemplateName}/voice" ; if ( input . TemplateName !== undefined ) { const labelValue = input . TemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{TemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TemplateName." ) ; } const query = { ... ( input . CreateNewVersion !== undefined && { "create-new-version" : input . CreateNewVersion . toString ( ) } ) , ... ( input . Version !== undefined && { version : input . Version } ) , } ; let body ; if ( input . VoiceTemplateRequest !== undefined ) { body = serializeAws_restJson1VoiceTemplateRequest ( input . VoiceTemplateRequest , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1VerifyOTPMessageCommand = 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 || "" }` + "/v1/apps/{ApplicationId}/verify-otp" ; if ( input . ApplicationId !== undefined ) { const labelValue = input . ApplicationId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ApplicationId." ) ; } resolvedPath = resolvedPath . replace ( "{ApplicationId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ApplicationId." ) ; } let body ; if ( input . VerifyOTPMessageRequestParameters !== undefined ) { body = serializeAws_restJson1VerifyOTPMessageRequestParameters ( input . VerifyOTPMessageRequestParameters , context ) ; } if ( body === undefined ) { body = { } ; } body = JSON . stringify ( body ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateAppCommand = async ( output , context ) : Promise < CreateAppCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAppCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationResponse = deserializeAws_restJson1ApplicationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAppCommandError = async ( output , context ) : Promise < CreateAppCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateCampaignCommand = async ( output , context ) : Promise < CreateCampaignCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateCampaignCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignResponse = deserializeAws_restJson1CampaignResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateCampaignCommandError = async ( output , context ) : Promise < CreateCampaignCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateEmailTemplateCommand = async ( output , context ) : Promise < CreateEmailTemplateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTemplateMessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CreateTemplateMessageBody = deserializeAws_restJson1CreateTemplateMessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEmailTemplateCommandError = async ( output , context ) : Promise < CreateEmailTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateExportJobCommand = async ( output , context ) : Promise < CreateExportJobCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateExportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ExportJobResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ExportJobResponse = deserializeAws_restJson1ExportJobResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateExportJobCommandError = async ( output , context ) : Promise < CreateExportJobCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateImportJobCommand = async ( output , context ) : Promise < CreateImportJobCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateImportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ImportJobResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ImportJobResponse = deserializeAws_restJson1ImportJobResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateImportJobCommandError = async ( output , context ) : Promise < CreateImportJobCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateInAppTemplateCommand = async ( output , context ) : Promise < CreateInAppTemplateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateInAppTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TemplateCreateMessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . TemplateCreateMessageBody = deserializeAws_restJson1TemplateCreateMessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateInAppTemplateCommandError = async ( output , context ) : Promise < CreateInAppTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateJourneyCommand = async ( output , context ) : Promise < CreateJourneyCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateJourneyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyResponse = deserializeAws_restJson1JourneyResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateJourneyCommandError = async ( output , context ) : Promise < CreateJourneyCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreatePushTemplateCommand = async ( output , context ) : Promise < CreatePushTemplateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreatePushTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTemplateMessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CreateTemplateMessageBody = deserializeAws_restJson1CreateTemplateMessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreatePushTemplateCommandError = async ( output , context ) : Promise < CreatePushTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateRecommenderConfigurationCommand = async ( output , context ) : Promise < CreateRecommenderConfigurationCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRecommenderConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RecommenderConfigurationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . RecommenderConfigurationResponse = deserializeAws_restJson1RecommenderConfigurationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRecommenderConfigurationCommandError = async ( output , context ) : Promise < CreateRecommenderConfigurationCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateSegmentCommand = async ( output , context ) : Promise < CreateSegmentCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSegmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentResponse = deserializeAws_restJson1SegmentResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSegmentCommandError = async ( output , context ) : Promise < CreateSegmentCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateSmsTemplateCommand = async ( output , context ) : Promise < CreateSmsTemplateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateSmsTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTemplateMessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CreateTemplateMessageBody = deserializeAws_restJson1CreateTemplateMessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateSmsTemplateCommandError = async ( output , context ) : Promise < CreateSmsTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1CreateVoiceTemplateCommand = async ( output , context ) : Promise < CreateVoiceTemplateCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateVoiceTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTemplateMessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CreateTemplateMessageBody = deserializeAws_restJson1CreateTemplateMessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateVoiceTemplateCommandError = async ( output , context ) : Promise < CreateVoiceTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteAdmChannelCommand = async ( output , context ) : Promise < DeleteAdmChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAdmChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ADMChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ADMChannelResponse = deserializeAws_restJson1ADMChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAdmChannelCommandError = async ( output , context ) : Promise < DeleteAdmChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteApnsChannelCommand = async ( output , context ) : Promise < DeleteApnsChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApnsChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSChannelResponse = deserializeAws_restJson1APNSChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApnsChannelCommandError = async ( output , context ) : Promise < DeleteApnsChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteApnsSandboxChannelCommand = async ( output , context ) : Promise < DeleteApnsSandboxChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApnsSandboxChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSSandboxChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSSandboxChannelResponse = deserializeAws_restJson1APNSSandboxChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApnsSandboxChannelCommandError = async ( output , context ) : Promise < DeleteApnsSandboxChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteApnsVoipChannelCommand = async ( output , context ) : Promise < DeleteApnsVoipChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApnsVoipChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSVoipChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSVoipChannelResponse = deserializeAws_restJson1APNSVoipChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApnsVoipChannelCommandError = async ( output , context ) : Promise < DeleteApnsVoipChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteApnsVoipSandboxChannelCommand = async ( output , context ) : Promise < DeleteApnsVoipSandboxChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteApnsVoipSandboxChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSVoipSandboxChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSVoipSandboxChannelResponse = deserializeAws_restJson1APNSVoipSandboxChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteApnsVoipSandboxChannelCommandError = async ( output , context ) : Promise < DeleteApnsVoipSandboxChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteAppCommand = async ( output , context ) : Promise < DeleteAppCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAppCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationResponse = deserializeAws_restJson1ApplicationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAppCommandError = async ( output , context ) : Promise < DeleteAppCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteBaiduChannelCommand = async ( output , context ) : Promise < DeleteBaiduChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBaiduChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BaiduChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . BaiduChannelResponse = deserializeAws_restJson1BaiduChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBaiduChannelCommandError = async ( output , context ) : Promise < DeleteBaiduChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteCampaignCommand = async ( output , context ) : Promise < DeleteCampaignCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCampaignCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignResponse = deserializeAws_restJson1CampaignResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCampaignCommandError = async ( output , context ) : Promise < DeleteCampaignCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEmailChannelCommand = async ( output , context ) : Promise < DeleteEmailChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEmailChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EmailChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EmailChannelResponse = deserializeAws_restJson1EmailChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEmailChannelCommandError = async ( output , context ) : Promise < DeleteEmailChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEmailTemplateCommand = async ( output , context ) : Promise < DeleteEmailTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEmailTemplateCommandError = async ( output , context ) : Promise < DeleteEmailTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEndpointCommand = async ( output , context ) : Promise < DeleteEndpointCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EndpointResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EndpointResponse = deserializeAws_restJson1EndpointResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEndpointCommandError = async ( output , context ) : Promise < DeleteEndpointCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteEventStreamCommand = async ( output , context ) : Promise < DeleteEventStreamCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEventStreamCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EventStream : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EventStream = deserializeAws_restJson1EventStream ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEventStreamCommandError = async ( output , context ) : Promise < DeleteEventStreamCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteGcmChannelCommand = async ( output , context ) : Promise < DeleteGcmChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteGcmChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GCMChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . GCMChannelResponse = deserializeAws_restJson1GCMChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteGcmChannelCommandError = async ( output , context ) : Promise < DeleteGcmChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteInAppTemplateCommand = async ( output , context ) : Promise < DeleteInAppTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteInAppTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteInAppTemplateCommandError = async ( output , context ) : Promise < DeleteInAppTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteJourneyCommand = async ( output , context ) : Promise < DeleteJourneyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteJourneyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyResponse = deserializeAws_restJson1JourneyResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteJourneyCommandError = async ( output , context ) : Promise < DeleteJourneyCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeletePushTemplateCommand = async ( output , context ) : Promise < DeletePushTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeletePushTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeletePushTemplateCommandError = async ( output , context ) : Promise < DeletePushTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteRecommenderConfigurationCommand = async ( output , context ) : Promise < DeleteRecommenderConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRecommenderConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RecommenderConfigurationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . RecommenderConfigurationResponse = deserializeAws_restJson1RecommenderConfigurationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRecommenderConfigurationCommandError = async ( output , context ) : Promise < DeleteRecommenderConfigurationCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteSegmentCommand = async ( output , context ) : Promise < DeleteSegmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSegmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentResponse = deserializeAws_restJson1SegmentResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSegmentCommandError = async ( output , context ) : Promise < DeleteSegmentCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteSmsChannelCommand = async ( output , context ) : Promise < DeleteSmsChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSmsChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SMSChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SMSChannelResponse = deserializeAws_restJson1SMSChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSmsChannelCommandError = async ( output , context ) : Promise < DeleteSmsChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteSmsTemplateCommand = async ( output , context ) : Promise < DeleteSmsTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteSmsTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteSmsTemplateCommandError = async ( output , context ) : Promise < DeleteSmsTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteUserEndpointsCommand = async ( output , context ) : Promise < DeleteUserEndpointsCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteUserEndpointsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EndpointsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EndpointsResponse = deserializeAws_restJson1EndpointsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteUserEndpointsCommandError = async ( output , context ) : Promise < DeleteUserEndpointsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteVoiceChannelCommand = async ( output , context ) : Promise < DeleteVoiceChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteVoiceChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VoiceChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . VoiceChannelResponse = deserializeAws_restJson1VoiceChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteVoiceChannelCommandError = async ( output , context ) : Promise < DeleteVoiceChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DeleteVoiceTemplateCommand = async ( output , context ) : Promise < DeleteVoiceTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteVoiceTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteVoiceTemplateCommandError = async ( output , context ) : Promise < DeleteVoiceTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetAdmChannelCommand = async ( output , context ) : Promise < GetAdmChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAdmChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ADMChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ADMChannelResponse = deserializeAws_restJson1ADMChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAdmChannelCommandError = async ( output , context ) : Promise < GetAdmChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetApnsChannelCommand = async ( output , context ) : Promise < GetApnsChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApnsChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSChannelResponse = deserializeAws_restJson1APNSChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApnsChannelCommandError = async ( output , context ) : Promise < GetApnsChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetApnsSandboxChannelCommand = async ( output , context ) : Promise < GetApnsSandboxChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApnsSandboxChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSSandboxChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSSandboxChannelResponse = deserializeAws_restJson1APNSSandboxChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApnsSandboxChannelCommandError = async ( output , context ) : Promise < GetApnsSandboxChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetApnsVoipChannelCommand = async ( output , context ) : Promise < GetApnsVoipChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApnsVoipChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSVoipChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSVoipChannelResponse = deserializeAws_restJson1APNSVoipChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApnsVoipChannelCommandError = async ( output , context ) : Promise < GetApnsVoipChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetApnsVoipSandboxChannelCommand = async ( output , context ) : Promise < GetApnsVoipSandboxChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApnsVoipSandboxChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSVoipSandboxChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSVoipSandboxChannelResponse = deserializeAws_restJson1APNSVoipSandboxChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApnsVoipSandboxChannelCommandError = async ( output , context ) : Promise < GetApnsVoipSandboxChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetAppCommand = async ( output , context ) : Promise < GetAppCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAppCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationResponse = deserializeAws_restJson1ApplicationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAppCommandError = async ( output , context ) : Promise < GetAppCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetApplicationDateRangeKpiCommand = async ( output , context ) : Promise < GetApplicationDateRangeKpiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApplicationDateRangeKpiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationDateRangeKpiResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationDateRangeKpiResponse = deserializeAws_restJson1ApplicationDateRangeKpiResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApplicationDateRangeKpiCommandError = async ( output , context ) : Promise < GetApplicationDateRangeKpiCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetApplicationSettingsCommand = async ( output , context ) : Promise < GetApplicationSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetApplicationSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationSettingsResource : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationSettingsResource = deserializeAws_restJson1ApplicationSettingsResource ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetApplicationSettingsCommandError = async ( output , context ) : Promise < GetApplicationSettingsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetAppsCommand = async ( output , context ) : Promise < GetAppsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetAppsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationsResponse = deserializeAws_restJson1ApplicationsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetAppsCommandError = async ( output , context ) : Promise < GetAppsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetBaiduChannelCommand = async ( output , context ) : Promise < GetBaiduChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBaiduChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BaiduChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . BaiduChannelResponse = deserializeAws_restJson1BaiduChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBaiduChannelCommandError = async ( output , context ) : Promise < GetBaiduChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCampaignCommand = async ( output , context ) : Promise < GetCampaignCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCampaignCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignResponse = deserializeAws_restJson1CampaignResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCampaignCommandError = async ( output , context ) : Promise < GetCampaignCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCampaignActivitiesCommand = async ( output , context ) : Promise < GetCampaignActivitiesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCampaignActivitiesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ActivitiesResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ActivitiesResponse = deserializeAws_restJson1ActivitiesResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCampaignActivitiesCommandError = async ( output , context ) : Promise < GetCampaignActivitiesCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCampaignDateRangeKpiCommand = async ( output , context ) : Promise < GetCampaignDateRangeKpiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCampaignDateRangeKpiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignDateRangeKpiResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignDateRangeKpiResponse = deserializeAws_restJson1CampaignDateRangeKpiResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCampaignDateRangeKpiCommandError = async ( output , context ) : Promise < GetCampaignDateRangeKpiCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCampaignsCommand = async ( output , context ) : Promise < GetCampaignsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCampaignsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignsResponse = deserializeAws_restJson1CampaignsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCampaignsCommandError = async ( output , context ) : Promise < GetCampaignsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCampaignVersionCommand = async ( output , context ) : Promise < GetCampaignVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCampaignVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignResponse = deserializeAws_restJson1CampaignResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCampaignVersionCommandError = async ( output , context ) : Promise < GetCampaignVersionCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetCampaignVersionsCommand = async ( output , context ) : Promise < GetCampaignVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCampaignVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignsResponse = deserializeAws_restJson1CampaignsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCampaignVersionsCommandError = async ( output , context ) : Promise < GetCampaignVersionsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetChannelsCommand = async ( output , context ) : Promise < GetChannelsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetChannelsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ChannelsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ChannelsResponse = deserializeAws_restJson1ChannelsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetChannelsCommandError = async ( output , context ) : Promise < GetChannelsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEmailChannelCommand = async ( output , context ) : Promise < GetEmailChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEmailChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EmailChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EmailChannelResponse = deserializeAws_restJson1EmailChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEmailChannelCommandError = async ( output , context ) : Promise < GetEmailChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEmailTemplateCommand = async ( output , context ) : Promise < GetEmailTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EmailTemplateResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EmailTemplateResponse = deserializeAws_restJson1EmailTemplateResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEmailTemplateCommandError = async ( output , context ) : Promise < GetEmailTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEndpointCommand = async ( output , context ) : Promise < GetEndpointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EndpointResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EndpointResponse = deserializeAws_restJson1EndpointResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEndpointCommandError = async ( output , context ) : Promise < GetEndpointCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetEventStreamCommand = async ( output , context ) : Promise < GetEventStreamCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEventStreamCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EventStream : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EventStream = deserializeAws_restJson1EventStream ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEventStreamCommandError = async ( output , context ) : Promise < GetEventStreamCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetExportJobCommand = async ( output , context ) : Promise < GetExportJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetExportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ExportJobResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ExportJobResponse = deserializeAws_restJson1ExportJobResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetExportJobCommandError = async ( output , context ) : Promise < GetExportJobCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetExportJobsCommand = async ( output , context ) : Promise < GetExportJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetExportJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ExportJobsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ExportJobsResponse = deserializeAws_restJson1ExportJobsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetExportJobsCommandError = async ( output , context ) : Promise < GetExportJobsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetGcmChannelCommand = async ( output , context ) : Promise < GetGcmChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetGcmChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GCMChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . GCMChannelResponse = deserializeAws_restJson1GCMChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetGcmChannelCommandError = async ( output , context ) : Promise < GetGcmChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetImportJobCommand = async ( output , context ) : Promise < GetImportJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetImportJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ImportJobResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ImportJobResponse = deserializeAws_restJson1ImportJobResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetImportJobCommandError = async ( output , context ) : Promise < GetImportJobCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetImportJobsCommand = async ( output , context ) : Promise < GetImportJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetImportJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ImportJobsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ImportJobsResponse = deserializeAws_restJson1ImportJobsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetImportJobsCommandError = async ( output , context ) : Promise < GetImportJobsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetInAppMessagesCommand = async ( output , context ) : Promise < GetInAppMessagesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetInAppMessagesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , InAppMessagesResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . InAppMessagesResponse = deserializeAws_restJson1InAppMessagesResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetInAppMessagesCommandError = async ( output , context ) : Promise < GetInAppMessagesCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetInAppTemplateCommand = async ( output , context ) : Promise < GetInAppTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetInAppTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , InAppTemplateResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . InAppTemplateResponse = deserializeAws_restJson1InAppTemplateResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetInAppTemplateCommandError = async ( output , context ) : Promise < GetInAppTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetJourneyCommand = async ( output , context ) : Promise < GetJourneyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetJourneyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyResponse = deserializeAws_restJson1JourneyResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetJourneyCommandError = async ( output , context ) : Promise < GetJourneyCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetJourneyDateRangeKpiCommand = async ( output , context ) : Promise < GetJourneyDateRangeKpiCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetJourneyDateRangeKpiCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyDateRangeKpiResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyDateRangeKpiResponse = deserializeAws_restJson1JourneyDateRangeKpiResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetJourneyDateRangeKpiCommandError = async ( output , context ) : Promise < GetJourneyDateRangeKpiCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetJourneyExecutionActivityMetricsCommand = async ( output , context ) : Promise < GetJourneyExecutionActivityMetricsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetJourneyExecutionActivityMetricsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyExecutionActivityMetricsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyExecutionActivityMetricsResponse = deserializeAws_restJson1JourneyExecutionActivityMetricsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetJourneyExecutionActivityMetricsCommandError = async ( output , context ) : Promise < GetJourneyExecutionActivityMetricsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetJourneyExecutionMetricsCommand = async ( output , context ) : Promise < GetJourneyExecutionMetricsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetJourneyExecutionMetricsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyExecutionMetricsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyExecutionMetricsResponse = deserializeAws_restJson1JourneyExecutionMetricsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetJourneyExecutionMetricsCommandError = async ( output , context ) : Promise < GetJourneyExecutionMetricsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetPushTemplateCommand = async ( output , context ) : Promise < GetPushTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetPushTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , PushNotificationTemplateResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . PushNotificationTemplateResponse = deserializeAws_restJson1PushNotificationTemplateResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetPushTemplateCommandError = async ( output , context ) : Promise < GetPushTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetRecommenderConfigurationCommand = async ( output , context ) : Promise < GetRecommenderConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRecommenderConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RecommenderConfigurationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . RecommenderConfigurationResponse = deserializeAws_restJson1RecommenderConfigurationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRecommenderConfigurationCommandError = async ( output , context ) : Promise < GetRecommenderConfigurationCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetRecommenderConfigurationsCommand = async ( output , context ) : Promise < GetRecommenderConfigurationsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetRecommenderConfigurationsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ListRecommenderConfigurationsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ListRecommenderConfigurationsResponse = deserializeAws_restJson1ListRecommenderConfigurationsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetRecommenderConfigurationsCommandError = async ( output , context ) : Promise < GetRecommenderConfigurationsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSegmentCommand = async ( output , context ) : Promise < GetSegmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSegmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentResponse = deserializeAws_restJson1SegmentResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSegmentCommandError = async ( output , context ) : Promise < GetSegmentCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSegmentExportJobsCommand = async ( output , context ) : Promise < GetSegmentExportJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSegmentExportJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ExportJobsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ExportJobsResponse = deserializeAws_restJson1ExportJobsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSegmentExportJobsCommandError = async ( output , context ) : Promise < GetSegmentExportJobsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSegmentImportJobsCommand = async ( output , context ) : Promise < GetSegmentImportJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSegmentImportJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ImportJobsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ImportJobsResponse = deserializeAws_restJson1ImportJobsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSegmentImportJobsCommandError = async ( output , context ) : Promise < GetSegmentImportJobsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSegmentsCommand = async ( output , context ) : Promise < GetSegmentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSegmentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentsResponse = deserializeAws_restJson1SegmentsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSegmentsCommandError = async ( output , context ) : Promise < GetSegmentsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSegmentVersionCommand = async ( output , context ) : Promise < GetSegmentVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSegmentVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentResponse = deserializeAws_restJson1SegmentResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSegmentVersionCommandError = async ( output , context ) : Promise < GetSegmentVersionCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSegmentVersionsCommand = async ( output , context ) : Promise < GetSegmentVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSegmentVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentsResponse = deserializeAws_restJson1SegmentsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSegmentVersionsCommandError = async ( output , context ) : Promise < GetSegmentVersionsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSmsChannelCommand = async ( output , context ) : Promise < GetSmsChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSmsChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SMSChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SMSChannelResponse = deserializeAws_restJson1SMSChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSmsChannelCommandError = async ( output , context ) : Promise < GetSmsChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetSmsTemplateCommand = async ( output , context ) : Promise < GetSmsTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetSmsTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SMSTemplateResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SMSTemplateResponse = deserializeAws_restJson1SMSTemplateResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetSmsTemplateCommandError = async ( output , context ) : Promise < GetSmsTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetUserEndpointsCommand = async ( output , context ) : Promise < GetUserEndpointsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUserEndpointsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EndpointsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EndpointsResponse = deserializeAws_restJson1EndpointsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUserEndpointsCommandError = async ( output , context ) : Promise < GetUserEndpointsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetVoiceChannelCommand = async ( output , context ) : Promise < GetVoiceChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetVoiceChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VoiceChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . VoiceChannelResponse = deserializeAws_restJson1VoiceChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetVoiceChannelCommandError = async ( output , context ) : Promise < GetVoiceChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetVoiceTemplateCommand = async ( output , context ) : Promise < GetVoiceTemplateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetVoiceTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VoiceTemplateResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . VoiceTemplateResponse = deserializeAws_restJson1VoiceTemplateResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetVoiceTemplateCommandError = async ( output , context ) : Promise < GetVoiceTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListJourneysCommand = async ( output , context ) : Promise < ListJourneysCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListJourneysCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneysResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneysResponse = deserializeAws_restJson1JourneysResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListJourneysCommandError = async ( output , context ) : Promise < ListJourneysCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TagsModel : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . TagsModel = deserializeAws_restJson1TagsModel ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { 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_restJson1ListTemplatesCommand = async ( output , context ) : Promise < ListTemplatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTemplatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TemplatesResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . TemplatesResponse = deserializeAws_restJson1TemplatesResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTemplatesCommandError = async ( output , context ) : Promise < ListTemplatesCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1ListTemplateVersionsCommand = async ( output , context ) : Promise < ListTemplateVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTemplateVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TemplateVersionsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . TemplateVersionsResponse = deserializeAws_restJson1TemplateVersionsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTemplateVersionsCommandError = async ( output , context ) : Promise < ListTemplateVersionsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PhoneNumberValidateCommand = async ( output , context ) : Promise < PhoneNumberValidateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PhoneNumberValidateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NumberValidateResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . NumberValidateResponse = deserializeAws_restJson1NumberValidateResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PhoneNumberValidateCommandError = async ( output , context ) : Promise < PhoneNumberValidateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEventsCommand = async ( output , context ) : Promise < PutEventsCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEventsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EventsResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EventsResponse = deserializeAws_restJson1EventsResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEventsCommandError = async ( output , context ) : Promise < PutEventsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1PutEventStreamCommand = async ( output , context ) : Promise < PutEventStreamCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutEventStreamCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EventStream : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EventStream = deserializeAws_restJson1EventStream ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutEventStreamCommandError = async ( output , context ) : Promise < PutEventStreamCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1RemoveAttributesCommand = async ( output , context ) : Promise < RemoveAttributesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RemoveAttributesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AttributesResource : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . AttributesResource = deserializeAws_restJson1AttributesResource ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RemoveAttributesCommandError = async ( output , context ) : Promise < RemoveAttributesCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1SendMessagesCommand = async ( output , context ) : Promise < SendMessagesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendMessagesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageResponse = deserializeAws_restJson1MessageResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendMessagesCommandError = async ( output , context ) : Promise < SendMessagesCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1SendOTPMessageCommand = async ( output , context ) : Promise < SendOTPMessageCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendOTPMessageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageResponse = deserializeAws_restJson1MessageResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendOTPMessageCommandError = async ( output , context ) : Promise < SendOTPMessageCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1SendUsersMessagesCommand = async ( output , context ) : Promise < SendUsersMessagesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SendUsersMessagesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SendUsersMessageResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SendUsersMessageResponse = deserializeAws_restJson1SendUsersMessageResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SendUsersMessagesCommandError = async ( output , context ) : Promise < SendUsersMessagesCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { 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_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { 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_restJson1UpdateAdmChannelCommand = async ( output , context ) : Promise < UpdateAdmChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateAdmChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ADMChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ADMChannelResponse = deserializeAws_restJson1ADMChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateAdmChannelCommandError = async ( output , context ) : Promise < UpdateAdmChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateApnsChannelCommand = async ( output , context ) : Promise < UpdateApnsChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApnsChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSChannelResponse = deserializeAws_restJson1APNSChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApnsChannelCommandError = async ( output , context ) : Promise < UpdateApnsChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateApnsSandboxChannelCommand = async ( output , context ) : Promise < UpdateApnsSandboxChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApnsSandboxChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSSandboxChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSSandboxChannelResponse = deserializeAws_restJson1APNSSandboxChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApnsSandboxChannelCommandError = async ( output , context ) : Promise < UpdateApnsSandboxChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateApnsVoipChannelCommand = async ( output , context ) : Promise < UpdateApnsVoipChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApnsVoipChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSVoipChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSVoipChannelResponse = deserializeAws_restJson1APNSVoipChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApnsVoipChannelCommandError = async ( output , context ) : Promise < UpdateApnsVoipChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateApnsVoipSandboxChannelCommand = async ( output , context ) : Promise < UpdateApnsVoipSandboxChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApnsVoipSandboxChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , APNSVoipSandboxChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . APNSVoipSandboxChannelResponse = deserializeAws_restJson1APNSVoipSandboxChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApnsVoipSandboxChannelCommandError = async ( output , context ) : Promise < UpdateApnsVoipSandboxChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateApplicationSettingsCommand = async ( output , context ) : Promise < UpdateApplicationSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateApplicationSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ApplicationSettingsResource : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . ApplicationSettingsResource = deserializeAws_restJson1ApplicationSettingsResource ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateApplicationSettingsCommandError = async ( output , context ) : Promise < UpdateApplicationSettingsCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateBaiduChannelCommand = async ( output , context ) : Promise < UpdateBaiduChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateBaiduChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BaiduChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . BaiduChannelResponse = deserializeAws_restJson1BaiduChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateBaiduChannelCommandError = async ( output , context ) : Promise < UpdateBaiduChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateCampaignCommand = async ( output , context ) : Promise < UpdateCampaignCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateCampaignCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CampaignResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . CampaignResponse = deserializeAws_restJson1CampaignResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateCampaignCommandError = async ( output , context ) : Promise < UpdateCampaignCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateEmailChannelCommand = async ( output , context ) : Promise < UpdateEmailChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEmailChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , EmailChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . EmailChannelResponse = deserializeAws_restJson1EmailChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEmailChannelCommandError = async ( output , context ) : Promise < UpdateEmailChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateEmailTemplateCommand = async ( output , context ) : Promise < UpdateEmailTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEmailTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEmailTemplateCommandError = async ( output , context ) : Promise < UpdateEmailTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateEndpointCommand = async ( output , context ) : Promise < UpdateEndpointCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEndpointCommandError = async ( output , context ) : Promise < UpdateEndpointCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateEndpointsBatchCommand = async ( output , context ) : Promise < UpdateEndpointsBatchCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEndpointsBatchCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEndpointsBatchCommandError = async ( output , context ) : Promise < UpdateEndpointsBatchCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateGcmChannelCommand = async ( output , context ) : Promise < UpdateGcmChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateGcmChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , GCMChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . GCMChannelResponse = deserializeAws_restJson1GCMChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateGcmChannelCommandError = async ( output , context ) : Promise < UpdateGcmChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateInAppTemplateCommand = async ( output , context ) : Promise < UpdateInAppTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateInAppTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateInAppTemplateCommandError = async ( output , context ) : Promise < UpdateInAppTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateJourneyCommand = async ( output , context ) : Promise < UpdateJourneyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateJourneyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyResponse = deserializeAws_restJson1JourneyResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateJourneyCommandError = async ( output , context ) : Promise < UpdateJourneyCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.pinpoint#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateJourneyStateCommand = async ( output , context ) : Promise < UpdateJourneyStateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateJourneyStateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , JourneyResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . JourneyResponse = deserializeAws_restJson1JourneyResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateJourneyStateCommandError = async ( output , context ) : Promise < UpdateJourneyStateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdatePushTemplateCommand = async ( output , context ) : Promise < UpdatePushTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdatePushTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdatePushTemplateCommandError = async ( output , context ) : Promise < UpdatePushTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateRecommenderConfigurationCommand = async ( output , context ) : Promise < UpdateRecommenderConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRecommenderConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , RecommenderConfigurationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . RecommenderConfigurationResponse = deserializeAws_restJson1RecommenderConfigurationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRecommenderConfigurationCommandError = async ( output , context ) : Promise < UpdateRecommenderConfigurationCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateSegmentCommand = async ( output , context ) : Promise < UpdateSegmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSegmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SegmentResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SegmentResponse = deserializeAws_restJson1SegmentResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSegmentCommandError = async ( output , context ) : Promise < UpdateSegmentCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateSmsChannelCommand = async ( output , context ) : Promise < UpdateSmsChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSmsChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SMSChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . SMSChannelResponse = deserializeAws_restJson1SMSChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSmsChannelCommandError = async ( output , context ) : Promise < UpdateSmsChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateSmsTemplateCommand = async ( output , context ) : Promise < UpdateSmsTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateSmsTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateSmsTemplateCommandError = async ( output , context ) : Promise < UpdateSmsTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateTemplateActiveVersionCommand = async ( output , context ) : Promise < UpdateTemplateActiveVersionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateTemplateActiveVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateTemplateActiveVersionCommandError = async ( output , context ) : Promise < UpdateTemplateActiveVersionCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateVoiceChannelCommand = async ( output , context ) : Promise < UpdateVoiceChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateVoiceChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VoiceChannelResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . VoiceChannelResponse = deserializeAws_restJson1VoiceChannelResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateVoiceChannelCommandError = async ( output , context ) : Promise < UpdateVoiceChannelCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateVoiceTemplateCommand = async ( output , context ) : Promise < UpdateVoiceTemplateCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateVoiceTemplateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MessageBody : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . MessageBody = deserializeAws_restJson1MessageBody ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateVoiceTemplateCommandError = async ( output , context ) : Promise < UpdateVoiceTemplateCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1VerifyOTPMessageCommand = async ( output , context ) : Promise < VerifyOTPMessageCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1VerifyOTPMessageCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , VerificationResponse : undefined , } ; const data = __expectObject ( await parseBody ( output . body , context ) ) ; contents . VerificationResponse = deserializeAws_restJson1VerificationResponse ( data , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1VerifyOTPMessageCommandError = async ( output , context ) : Promise < VerifyOTPMessageCommandOutput > => { 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.pinpoint#BadRequestException" : response = { ... ( await deserializeAws_restJson1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.pinpoint#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.pinpoint#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MethodNotAllowedException" : case "com.amazonaws.pinpoint#MethodNotAllowedException" : response = { ... ( await deserializeAws_restJson1MethodNotAllowedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.pinpoint#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PayloadTooLargeException" : case "com.amazonaws.pinpoint#PayloadTooLargeException" : response = { ... ( await deserializeAws_restJson1PayloadTooLargeExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.pinpoint#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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 ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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 ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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_restJson1InternalServerErrorExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerErrorException > => { const contents = { name : "InternalServerErrorException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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_restJson1MethodNotAllowedExceptionResponse = async ( parsedOutput , context ) : Promise < MethodNotAllowedException > => { const contents = { name : "MethodNotAllowedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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 ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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_restJson1PayloadTooLargeExceptionResponse = async ( parsedOutput , context ) : Promise < PayloadTooLargeException > => { const contents = { name : "PayloadTooLargeException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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_restJson1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , RequestID : undefined , } ; const data = parsedOutput . body ; 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_restJson1Activity = ( input , context ) : any => { return { ... ( input . CUSTOM !== undefined && input . CUSTOM !== null && { CUSTOM : serializeAws_restJson1CustomMessageActivity ( input . CUSTOM , context ) } ) , ... ( input . ConditionalSplit !== undefined && input . ConditionalSplit !== null && { ConditionalSplit : serializeAws_restJson1ConditionalSplitActivity ( input . ConditionalSplit , context ) , } ) , ... ( input . ContactCenter !== undefined && input . ContactCenter !== null && { ContactCenter : serializeAws_restJson1ContactCenterActivity ( input . ContactCenter , context ) , } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . EMAIL !== undefined && input . EMAIL !== null && { EMAIL : serializeAws_restJson1EmailMessageActivity ( input . EMAIL , context ) } ) , ... ( input . Holdout !== undefined && input . Holdout !== null && { Holdout : serializeAws_restJson1HoldoutActivity ( input . Holdout , context ) } ) , ... ( input . MultiCondition !== undefined && input . MultiCondition !== null && { MultiCondition : serializeAws_restJson1MultiConditionalSplitActivity ( input . MultiCondition , context ) , } ) , ... ( input . PUSH !== undefined && input . PUSH !== null && { PUSH : serializeAws_restJson1PushMessageActivity ( input . PUSH , context ) } ) , ... ( input . RandomSplit !== undefined && input . RandomSplit !== null && { RandomSplit : serializeAws_restJson1RandomSplitActivity ( input . RandomSplit , context ) , } ) , ... ( input . SMS !== undefined && input . SMS !== null && { SMS : serializeAws_restJson1SMSMessageActivity ( input . SMS , context ) } ) , ... ( input . Wait !== undefined && input . Wait !== null && { Wait : serializeAws_restJson1WaitActivity ( input . Wait , context ) } ) , } ; } ; const serializeAws_restJson1AddressConfiguration = ( input , context ) : any => { return { ... ( input . BodyOverride !== undefined && input . BodyOverride !== null && { BodyOverride : input . BodyOverride } ) , ... ( input . ChannelType !== undefined && input . ChannelType !== null && { ChannelType : input . ChannelType } ) , ... ( input . Context !== undefined && input . Context !== null && { Context : serializeAws_restJson1MapOf__string ( input . Context , context ) } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . TitleOverride !== undefined && input . TitleOverride !== null && { TitleOverride : input . TitleOverride } ) , } ; } ; const serializeAws_restJson1ADMChannelRequest = ( input , context ) : any => { return { ... ( input . ClientId !== undefined && input . ClientId !== null && { ClientId : input . ClientId } ) , ... ( input . ClientSecret !== undefined && input . ClientSecret !== null && { ClientSecret : input . ClientSecret } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , } ; } ; const serializeAws_restJson1ADMMessage = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . ConsolidationKey !== undefined && input . ConsolidationKey !== null && { ConsolidationKey : input . ConsolidationKey } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : serializeAws_restJson1MapOf__string ( input . Data , context ) } ) , ... ( input . ExpiresAfter !== undefined && input . ExpiresAfter !== null && { ExpiresAfter : input . ExpiresAfter } ) , ... ( input . IconReference !== undefined && input . IconReference !== null && { IconReference : input . IconReference } ) , ... ( input . ImageIconUrl !== undefined && input . ImageIconUrl !== null && { ImageIconUrl : input . ImageIconUrl } ) , ... ( input . ImageUrl !== undefined && input . ImageUrl !== null && { ImageUrl : input . ImageUrl } ) , ... ( input . MD5 !== undefined && input . MD5 !== null && { MD5 : input . MD5 } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . SilentPush !== undefined && input . SilentPush !== null && { SilentPush : input . SilentPush } ) , ... ( input . SmallImageIconUrl !== undefined && input . SmallImageIconUrl !== null && { SmallImageIconUrl : input . SmallImageIconUrl } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1AndroidPushNotificationTemplate = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . ImageIconUrl !== undefined && input . ImageIconUrl !== null && { ImageIconUrl : input . ImageIconUrl } ) , ... ( input . ImageUrl !== undefined && input . ImageUrl !== null && { ImageUrl : input . ImageUrl } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . SmallImageIconUrl !== undefined && input . SmallImageIconUrl !== null && { SmallImageIconUrl : input . SmallImageIconUrl } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1APNSChannelRequest = ( input , context ) : any => { return { ... ( input . BundleId !== undefined && input . BundleId !== null && { BundleId : input . BundleId } ) , ... ( input . Certificate !== undefined && input . Certificate !== null && { Certificate : input . Certificate } ) , ... ( input . DefaultAuthenticationMethod !== undefined && input . DefaultAuthenticationMethod !== null && { DefaultAuthenticationMethod : input . DefaultAuthenticationMethod } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . PrivateKey !== undefined && input . PrivateKey !== null && { PrivateKey : input . PrivateKey } ) , ... ( input . TeamId !== undefined && input . TeamId !== null && { TeamId : input . TeamId } ) , ... ( input . TokenKey !== undefined && input . TokenKey !== null && { TokenKey : input . TokenKey } ) , ... ( input . TokenKeyId !== undefined && input . TokenKeyId !== null && { TokenKeyId : input . TokenKeyId } ) , } ; } ; const serializeAws_restJson1APNSMessage = ( input , context ) : any => { return { ... ( input . APNSPushType !== undefined && input . APNSPushType !== null && { APNSPushType : input . APNSPushType } ) , ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Badge !== undefined && input . Badge !== null && { Badge : input . Badge } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . Category !== undefined && input . Category !== null && { Category : input . Category } ) , ... ( input . CollapseId !== undefined && input . CollapseId !== null && { CollapseId : input . CollapseId } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : serializeAws_restJson1MapOf__string ( input . Data , context ) } ) , ... ( input . MediaUrl !== undefined && input . MediaUrl !== null && { MediaUrl : input . MediaUrl } ) , ... ( input . PreferredAuthenticationMethod !== undefined && input . PreferredAuthenticationMethod !== null && { PreferredAuthenticationMethod : input . PreferredAuthenticationMethod , } ) , ... ( input . Priority !== undefined && input . Priority !== null && { Priority : input . Priority } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . SilentPush !== undefined && input . SilentPush !== null && { SilentPush : input . SilentPush } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . ThreadId !== undefined && input . ThreadId !== null && { ThreadId : input . ThreadId } ) , ... ( input . TimeToLive !== undefined && input . TimeToLive !== null && { TimeToLive : input . TimeToLive } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1APNSPushNotificationTemplate = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . MediaUrl !== undefined && input . MediaUrl !== null && { MediaUrl : input . MediaUrl } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1APNSSandboxChannelRequest = ( input , context ) : any => { return { ... ( input . BundleId !== undefined && input . BundleId !== null && { BundleId : input . BundleId } ) , ... ( input . Certificate !== undefined && input . Certificate !== null && { Certificate : input . Certificate } ) , ... ( input . DefaultAuthenticationMethod !== undefined && input . DefaultAuthenticationMethod !== null && { DefaultAuthenticationMethod : input . DefaultAuthenticationMethod } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . PrivateKey !== undefined && input . PrivateKey !== null && { PrivateKey : input . PrivateKey } ) , ... ( input . TeamId !== undefined && input . TeamId !== null && { TeamId : input . TeamId } ) , ... ( input . TokenKey !== undefined && input . TokenKey !== null && { TokenKey : input . TokenKey } ) , ... ( input . TokenKeyId !== undefined && input . TokenKeyId !== null && { TokenKeyId : input . TokenKeyId } ) , } ; } ; const serializeAws_restJson1APNSVoipChannelRequest = ( input , context ) : any => { return { ... ( input . BundleId !== undefined && input . BundleId !== null && { BundleId : input . BundleId } ) , ... ( input . Certificate !== undefined && input . Certificate !== null && { Certificate : input . Certificate } ) , ... ( input . DefaultAuthenticationMethod !== undefined && input . DefaultAuthenticationMethod !== null && { DefaultAuthenticationMethod : input . DefaultAuthenticationMethod } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . PrivateKey !== undefined && input . PrivateKey !== null && { PrivateKey : input . PrivateKey } ) , ... ( input . TeamId !== undefined && input . TeamId !== null && { TeamId : input . TeamId } ) , ... ( input . TokenKey !== undefined && input . TokenKey !== null && { TokenKey : input . TokenKey } ) , ... ( input . TokenKeyId !== undefined && input . TokenKeyId !== null && { TokenKeyId : input . TokenKeyId } ) , } ; } ; const serializeAws_restJson1APNSVoipSandboxChannelRequest = ( input , context ) : any => { return { ... ( input . BundleId !== undefined && input . BundleId !== null && { BundleId : input . BundleId } ) , ... ( input . Certificate !== undefined && input . Certificate !== null && { Certificate : input . Certificate } ) , ... ( input . DefaultAuthenticationMethod !== undefined && input . DefaultAuthenticationMethod !== null && { DefaultAuthenticationMethod : input . DefaultAuthenticationMethod } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . PrivateKey !== undefined && input . PrivateKey !== null && { PrivateKey : input . PrivateKey } ) , ... ( input . TeamId !== undefined && input . TeamId !== null && { TeamId : input . TeamId } ) , ... ( input . TokenKey !== undefined && input . TokenKey !== null && { TokenKey : input . TokenKey } ) , ... ( input . TokenKeyId !== undefined && input . TokenKeyId !== null && { TokenKeyId : input . TokenKeyId } ) , } ; } ; const serializeAws_restJson1AttributeDimension = ( input , context ) : any => { return { ... ( input . AttributeType !== undefined && input . AttributeType !== null && { AttributeType : input . AttributeType } ) , ... ( input . Values !== undefined && input . Values !== null && { Values : serializeAws_restJson1ListOf__string ( input . Values , context ) } ) , } ; } ; const serializeAws_restJson1BaiduChannelRequest = ( input , context ) : any => { return { ... ( input . ApiKey !== undefined && input . ApiKey !== null && { ApiKey : input . ApiKey } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . SecretKey !== undefined && input . SecretKey !== null && { SecretKey : input . SecretKey } ) , } ; } ; const serializeAws_restJson1BaiduMessage = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : serializeAws_restJson1MapOf__string ( input . Data , context ) } ) , ... ( input . IconReference !== undefined && input . IconReference !== null && { IconReference : input . IconReference } ) , ... ( input . ImageIconUrl !== undefined && input . ImageIconUrl !== null && { ImageIconUrl : input . ImageIconUrl } ) , ... ( input . ImageUrl !== undefined && input . ImageUrl !== null && { ImageUrl : input . ImageUrl } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . SilentPush !== undefined && input . SilentPush !== null && { SilentPush : input . SilentPush } ) , ... ( input . SmallImageIconUrl !== undefined && input . SmallImageIconUrl !== null && { SmallImageIconUrl : input . SmallImageIconUrl } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . TimeToLive !== undefined && input . TimeToLive !== null && { TimeToLive : input . TimeToLive } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1CampaignCustomMessage = ( input , context ) : any => { return { ... ( input . Data !== undefined && input . Data !== null && { Data : input . Data } ) , } ; } ; const serializeAws_restJson1CampaignEmailMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . FromAddress !== undefined && input . FromAddress !== null && { FromAddress : input . FromAddress } ) , ... ( input . HtmlBody !== undefined && input . HtmlBody !== null && { HtmlBody : input . HtmlBody } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , } ; } ; const serializeAws_restJson1CampaignEventFilter = ( input , context ) : any => { return { ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1EventDimensions ( input . Dimensions , context ) } ) , ... ( input . FilterType !== undefined && input . FilterType !== null && { FilterType : input . FilterType } ) , } ; } ; const serializeAws_restJson1CampaignHook = ( input , context ) : any => { return { ... ( input . LambdaFunctionName !== undefined && input . LambdaFunctionName !== null && { LambdaFunctionName : input . LambdaFunctionName } ) , ... ( input . Mode !== undefined && input . Mode !== null && { Mode : input . Mode } ) , ... ( input . WebUrl !== undefined && input . WebUrl !== null && { WebUrl : input . WebUrl } ) , } ; } ; const serializeAws_restJson1CampaignInAppMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . Content !== undefined && input . Content !== null && { Content : serializeAws_restJson1ListOfInAppMessageContent ( input . Content , context ) } ) , ... ( input . CustomConfig !== undefined && input . CustomConfig !== null && { CustomConfig : serializeAws_restJson1MapOf__string ( input . CustomConfig , context ) , } ) , ... ( input . Layout !== undefined && input . Layout !== null && { Layout : input . Layout } ) , } ; } ; const serializeAws_restJson1CampaignLimits = ( input , context ) : any => { return { ... ( input . Daily !== undefined && input . Daily !== null && { Daily : input . Daily } ) , ... ( input . MaximumDuration !== undefined && input . MaximumDuration !== null && { MaximumDuration : input . MaximumDuration } ) , ... ( input . MessagesPerSecond !== undefined && input . MessagesPerSecond !== null && { MessagesPerSecond : input . MessagesPerSecond } ) , ... ( input . Session !== undefined && input . Session !== null && { Session : input . Session } ) , ... ( input . Total !== undefined && input . Total !== null && { Total : input . Total } ) , } ; } ; const serializeAws_restJson1CampaignSmsMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . EntityId !== undefined && input . EntityId !== null && { EntityId : input . EntityId } ) , ... ( input . MessageType !== undefined && input . MessageType !== null && { MessageType : input . MessageType } ) , ... ( input . OriginationNumber !== undefined && input . OriginationNumber !== null && { OriginationNumber : input . OriginationNumber } ) , ... ( input . SenderId !== undefined && input . SenderId !== null && { SenderId : input . SenderId } ) , ... ( input . TemplateId !== undefined && input . TemplateId !== null && { TemplateId : input . TemplateId } ) , } ; } ; const serializeAws_restJson1Condition = ( input , context ) : any => { return { ... ( input . Conditions !== undefined && input . Conditions !== null && { Conditions : serializeAws_restJson1ListOfSimpleCondition ( input . Conditions , context ) , } ) , ... ( input . Operator !== undefined && input . Operator !== null && { Operator : input . Operator } ) , } ; } ; const serializeAws_restJson1ConditionalSplitActivity = ( input , context ) : any => { return { ... ( input . Condition !== undefined && input . Condition !== null && { Condition : serializeAws_restJson1Condition ( input . Condition , context ) } ) , ... ( input . EvaluationWaitTime !== undefined && input . EvaluationWaitTime !== null && { EvaluationWaitTime : serializeAws_restJson1WaitTime ( input . EvaluationWaitTime , context ) , } ) , ... ( input . FalseActivity !== undefined && input . FalseActivity !== null && { FalseActivity : input . FalseActivity } ) , ... ( input . TrueActivity !== undefined && input . TrueActivity !== null && { TrueActivity : input . TrueActivity } ) , } ; } ; const serializeAws_restJson1ContactCenterActivity = ( input , context ) : any => { return { ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , } ; } ; const serializeAws_restJson1CreateApplicationRequest = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1CreateRecommenderConfigurationShape = ( input , context ) : any => { return { ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOf__string ( input . Attributes , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . RecommendationProviderIdType !== undefined && input . RecommendationProviderIdType !== null && { RecommendationProviderIdType : input . RecommendationProviderIdType , } ) , ... ( input . RecommendationProviderRoleArn !== undefined && input . RecommendationProviderRoleArn !== null && { RecommendationProviderRoleArn : input . RecommendationProviderRoleArn , } ) , ... ( input . RecommendationProviderUri !== undefined && input . RecommendationProviderUri !== null && { RecommendationProviderUri : input . RecommendationProviderUri } ) , ... ( input . RecommendationTransformerUri !== undefined && input . RecommendationTransformerUri !== null && { RecommendationTransformerUri : input . RecommendationTransformerUri , } ) , ... ( input . RecommendationsDisplayName !== undefined && input . RecommendationsDisplayName !== null && { RecommendationsDisplayName : input . RecommendationsDisplayName } ) , ... ( input . RecommendationsPerMessage !== undefined && input . RecommendationsPerMessage !== null && { RecommendationsPerMessage : input . RecommendationsPerMessage } ) , } ; } ; const serializeAws_restJson1CustomDeliveryConfiguration = ( input , context ) : any => { return { ... ( input . DeliveryUri !== undefined && input . DeliveryUri !== null && { DeliveryUri : input . DeliveryUri } ) , ... ( input . EndpointTypes !== undefined && input . EndpointTypes !== null && { EndpointTypes : serializeAws_restJson1ListOf__EndpointTypesElement ( input . EndpointTypes , context ) , } ) , } ; } ; const serializeAws_restJson1CustomMessageActivity = ( input , context ) : any => { return { ... ( input . DeliveryUri !== undefined && input . DeliveryUri !== null && { DeliveryUri : input . DeliveryUri } ) , ... ( input . EndpointTypes !== undefined && input . EndpointTypes !== null && { EndpointTypes : serializeAws_restJson1ListOf__EndpointTypesElement ( input . EndpointTypes , context ) , } ) , ... ( input . MessageConfig !== undefined && input . MessageConfig !== null && { MessageConfig : serializeAws_restJson1JourneyCustomMessage ( input . MessageConfig , context ) , } ) , ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , ... ( input . TemplateVersion !== undefined && input . TemplateVersion !== null && { TemplateVersion : input . TemplateVersion } ) , } ; } ; const serializeAws_restJson1DefaultButtonConfiguration = ( input , context ) : any => { return { ... ( input . BackgroundColor !== undefined && input . BackgroundColor !== null && { BackgroundColor : input . BackgroundColor } ) , ... ( input . BorderRadius !== undefined && input . BorderRadius !== null && { BorderRadius : input . BorderRadius } ) , ... ( input . ButtonAction !== undefined && input . ButtonAction !== null && { ButtonAction : input . ButtonAction } ) , ... ( input . Link !== undefined && input . Link !== null && { Link : input . Link } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , ... ( input . TextColor !== undefined && input . TextColor !== null && { TextColor : input . TextColor } ) , } ; } ; const serializeAws_restJson1DefaultMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , } ; } ; const serializeAws_restJson1DefaultPushNotificationMessage = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : serializeAws_restJson1MapOf__string ( input . Data , context ) } ) , ... ( input . SilentPush !== undefined && input . SilentPush !== null && { SilentPush : input . SilentPush } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1DefaultPushNotificationTemplate = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1DirectMessageConfiguration = ( input , context ) : any => { return { ... ( input . ADMMessage !== undefined && input . ADMMessage !== null && { ADMMessage : serializeAws_restJson1ADMMessage ( input . ADMMessage , context ) } ) , ... ( input . APNSMessage !== undefined && input . APNSMessage !== null && { APNSMessage : serializeAws_restJson1APNSMessage ( input . APNSMessage , context ) } ) , ... ( input . BaiduMessage !== undefined && input . BaiduMessage !== null && { BaiduMessage : serializeAws_restJson1BaiduMessage ( input . BaiduMessage , context ) } ) , ... ( input . DefaultMessage !== undefined && input . DefaultMessage !== null && { DefaultMessage : serializeAws_restJson1DefaultMessage ( input . DefaultMessage , context ) , } ) , ... ( input . DefaultPushNotificationMessage !== undefined && input . DefaultPushNotificationMessage !== null && { DefaultPushNotificationMessage : serializeAws_restJson1DefaultPushNotificationMessage ( input . DefaultPushNotificationMessage , context ) , } ) , ... ( input . EmailMessage !== undefined && input . EmailMessage !== null && { EmailMessage : serializeAws_restJson1EmailMessage ( input . EmailMessage , context ) } ) , ... ( input . GCMMessage !== undefined && input . GCMMessage !== null && { GCMMessage : serializeAws_restJson1GCMMessage ( input . GCMMessage , context ) } ) , ... ( input . SMSMessage !== undefined && input . SMSMessage !== null && { SMSMessage : serializeAws_restJson1SMSMessage ( input . SMSMessage , context ) } ) , ... ( input . VoiceMessage !== undefined && input . VoiceMessage !== null && { VoiceMessage : serializeAws_restJson1VoiceMessage ( input . VoiceMessage , context ) } ) , } ; } ; const serializeAws_restJson1EmailChannelRequest = ( input , context ) : any => { return { ... ( input . ConfigurationSet !== undefined && input . ConfigurationSet !== null && { ConfigurationSet : input . ConfigurationSet } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . FromAddress !== undefined && input . FromAddress !== null && { FromAddress : input . FromAddress } ) , ... ( input . Identity !== undefined && input . Identity !== null && { Identity : input . Identity } ) , ... ( input . RoleArn !== undefined && input . RoleArn !== null && { RoleArn : input . RoleArn } ) , } ; } ; const serializeAws_restJson1EmailMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . FeedbackForwardingAddress !== undefined && input . FeedbackForwardingAddress !== null && { FeedbackForwardingAddress : input . FeedbackForwardingAddress } ) , ... ( input . FromAddress !== undefined && input . FromAddress !== null && { FromAddress : input . FromAddress } ) , ... ( input . RawEmail !== undefined && input . RawEmail !== null && { RawEmail : serializeAws_restJson1RawEmail ( input . RawEmail , context ) } ) , ... ( input . ReplyToAddresses !== undefined && input . ReplyToAddresses !== null && { ReplyToAddresses : serializeAws_restJson1ListOf__string ( input . ReplyToAddresses , context ) , } ) , ... ( input . SimpleEmail !== undefined && input . SimpleEmail !== null && { SimpleEmail : serializeAws_restJson1SimpleEmail ( input . SimpleEmail , context ) } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , } ; } ; const serializeAws_restJson1EmailMessageActivity = ( input , context ) : any => { return { ... ( input . MessageConfig !== undefined && input . MessageConfig !== null && { MessageConfig : serializeAws_restJson1JourneyEmailMessage ( input . MessageConfig , context ) , } ) , ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , ... ( input . TemplateVersion !== undefined && input . TemplateVersion !== null && { TemplateVersion : input . TemplateVersion } ) , } ; } ; const serializeAws_restJson1EmailTemplateRequest = ( input , context ) : any => { return { ... ( input . DefaultSubstitutions !== undefined && input . DefaultSubstitutions !== null && { DefaultSubstitutions : input . DefaultSubstitutions } ) , ... ( input . HtmlPart !== undefined && input . HtmlPart !== null && { HtmlPart : input . HtmlPart } ) , ... ( input . RecommenderId !== undefined && input . RecommenderId !== null && { RecommenderId : input . RecommenderId } ) , ... ( input . Subject !== undefined && input . Subject !== null && { Subject : input . Subject } ) , ... ( input . TemplateDescription !== undefined && input . TemplateDescription !== null && { TemplateDescription : input . TemplateDescription } ) , ... ( input . TextPart !== undefined && input . TextPart !== null && { TextPart : input . TextPart } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1EndpointBatchItem = ( input , context ) : any => { return { ... ( input . Address !== undefined && input . Address !== null && { Address : input . Address } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOfListOf__string ( input . Attributes , context ) , } ) , ... ( input . ChannelType !== undefined && input . ChannelType !== null && { ChannelType : input . ChannelType } ) , ... ( input . Demographic !== undefined && input . Demographic !== null && { Demographic : serializeAws_restJson1EndpointDemographic ( input . Demographic , context ) , } ) , ... ( input . EffectiveDate !== undefined && input . EffectiveDate !== null && { EffectiveDate : input . EffectiveDate } ) , ... ( input . EndpointStatus !== undefined && input . EndpointStatus !== null && { EndpointStatus : input . EndpointStatus } ) , ... ( input . Id !== undefined && input . Id !== null && { Id : input . Id } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1EndpointLocation ( input . Location , context ) } ) , ... ( input . Metrics !== undefined && input . Metrics !== null && { Metrics : serializeAws_restJson1MapOf__double ( input . Metrics , context ) } ) , ... ( input . OptOut !== undefined && input . OptOut !== null && { OptOut : input . OptOut } ) , ... ( input . RequestId !== undefined && input . RequestId !== null && { RequestId : input . RequestId } ) , ... ( input . User !== undefined && input . User !== null && { User : serializeAws_restJson1EndpointUser ( input . User , context ) } ) , } ; } ; const serializeAws_restJson1EndpointBatchRequest = ( input , context ) : any => { return { ... ( input . Item !== undefined && input . Item !== null && { Item : serializeAws_restJson1ListOfEndpointBatchItem ( input . Item , context ) } ) , } ; } ; const serializeAws_restJson1EndpointDemographic = ( input , context ) : any => { return { ... ( input . AppVersion !== undefined && input . AppVersion !== null && { AppVersion : input . AppVersion } ) , ... ( input . Locale !== undefined && input . Locale !== null && { Locale : input . Locale } ) , ... ( input . Make !== undefined && input . Make !== null && { Make : input . Make } ) , ... ( input . Model !== undefined && input . Model !== null && { Model : input . Model } ) , ... ( input . ModelVersion !== undefined && input . ModelVersion !== null && { ModelVersion : input . ModelVersion } ) , ... ( input . Platform !== undefined && input . Platform !== null && { Platform : input . Platform } ) , ... ( input . PlatformVersion !== undefined && input . PlatformVersion !== null && { PlatformVersion : input . PlatformVersion } ) , ... ( input . Timezone !== undefined && input . Timezone !== null && { Timezone : input . Timezone } ) , } ; } ; const serializeAws_restJson1EndpointLocation = ( input , context ) : any => { return { ... ( input . City !== undefined && input . City !== null && { City : input . City } ) , ... ( input . Country !== undefined && input . Country !== null && { Country : input . Country } ) , ... ( input . Latitude !== undefined && input . Latitude !== null && { Latitude : __serializeFloat ( input . Latitude ) } ) , ... ( input . Longitude !== undefined && input . Longitude !== null && { Longitude : __serializeFloat ( input . Longitude ) } ) , ... ( input . PostalCode !== undefined && input . PostalCode !== null && { PostalCode : input . PostalCode } ) , ... ( input . Region !== undefined && input . Region !== null && { Region : input . Region } ) , } ; } ; const serializeAws_restJson1EndpointRequest = ( input , context ) : any => { return { ... ( input . Address !== undefined && input . Address !== null && { Address : input . Address } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOfListOf__string ( input . Attributes , context ) , } ) , ... ( input . ChannelType !== undefined && input . ChannelType !== null && { ChannelType : input . ChannelType } ) , ... ( input . Demographic !== undefined && input . Demographic !== null && { Demographic : serializeAws_restJson1EndpointDemographic ( input . Demographic , context ) , } ) , ... ( input . EffectiveDate !== undefined && input . EffectiveDate !== null && { EffectiveDate : input . EffectiveDate } ) , ... ( input . EndpointStatus !== undefined && input . EndpointStatus !== null && { EndpointStatus : input . EndpointStatus } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1EndpointLocation ( input . Location , context ) } ) , ... ( input . Metrics !== undefined && input . Metrics !== null && { Metrics : serializeAws_restJson1MapOf__double ( input . Metrics , context ) } ) , ... ( input . OptOut !== undefined && input . OptOut !== null && { OptOut : input . OptOut } ) , ... ( input . RequestId !== undefined && input . RequestId !== null && { RequestId : input . RequestId } ) , ... ( input . User !== undefined && input . User !== null && { User : serializeAws_restJson1EndpointUser ( input . User , context ) } ) , } ; } ; const serializeAws_restJson1EndpointSendConfiguration = ( input , context ) : any => { return { ... ( input . BodyOverride !== undefined && input . BodyOverride !== null && { BodyOverride : input . BodyOverride } ) , ... ( input . Context !== undefined && input . Context !== null && { Context : serializeAws_restJson1MapOf__string ( input . Context , context ) } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . TitleOverride !== undefined && input . TitleOverride !== null && { TitleOverride : input . TitleOverride } ) , } ; } ; const serializeAws_restJson1EndpointUser = ( input , context ) : any => { return { ... ( input . UserAttributes !== undefined && input . UserAttributes !== null && { UserAttributes : serializeAws_restJson1MapOfListOf__string ( input . UserAttributes , context ) , } ) , ... ( input . UserId !== undefined && input . UserId !== null && { UserId : input . UserId } ) , } ; } ; const serializeAws_restJson1Event = ( input , context ) : any => { return { ... ( input . AppPackageName !== undefined && input . AppPackageName !== null && { AppPackageName : input . AppPackageName } ) , ... ( input . AppTitle !== undefined && input . AppTitle !== null && { AppTitle : input . AppTitle } ) , ... ( input . AppVersionCode !== undefined && input . AppVersionCode !== null && { AppVersionCode : input . AppVersionCode } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOf__string ( input . Attributes , context ) } ) , ... ( input . ClientSdkVersion !== undefined && input . ClientSdkVersion !== null && { ClientSdkVersion : input . ClientSdkVersion } ) , ... ( input . EventType !== undefined && input . EventType !== null && { EventType : input . EventType } ) , ... ( input . Metrics !== undefined && input . Metrics !== null && { Metrics : serializeAws_restJson1MapOf__double ( input . Metrics , context ) } ) , ... ( input . SdkName !== undefined && input . SdkName !== null && { SdkName : input . SdkName } ) , ... ( input . Session !== undefined && input . Session !== null && { Session : serializeAws_restJson1Session ( input . Session , context ) } ) , ... ( input . Timestamp !== undefined && input . Timestamp !== null && { Timestamp : input . Timestamp } ) , } ; } ; const serializeAws_restJson1EventCondition = ( input , context ) : any => { return { ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1EventDimensions ( input . Dimensions , context ) } ) , ... ( input . MessageActivity !== undefined && input . MessageActivity !== null && { MessageActivity : input . MessageActivity } ) , } ; } ; const serializeAws_restJson1EventDimensions = ( input , context ) : any => { return { ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOfAttributeDimension ( input . Attributes , context ) , } ) , ... ( input . EventType !== undefined && input . EventType !== null && { EventType : serializeAws_restJson1SetDimension ( input . EventType , context ) } ) , ... ( input . Metrics !== undefined && input . Metrics !== null && { Metrics : serializeAws_restJson1MapOfMetricDimension ( input . Metrics , context ) } ) , } ; } ; const serializeAws_restJson1EventFilter = ( input , context ) : any => { return { ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1EventDimensions ( input . Dimensions , context ) } ) , ... ( input . FilterType !== undefined && input . FilterType !== null && { FilterType : input . FilterType } ) , } ; } ; const serializeAws_restJson1EventsBatch = ( input , context ) : any => { return { ... ( input . Endpoint !== undefined && input . Endpoint !== null && { Endpoint : serializeAws_restJson1PublicEndpoint ( input . Endpoint , context ) } ) , ... ( input . Events !== undefined && input . Events !== null && { Events : serializeAws_restJson1MapOfEvent ( input . Events , context ) } ) , } ; } ; const serializeAws_restJson1EventsRequest = ( input , context ) : any => { return { ... ( input . BatchItem !== undefined && input . BatchItem !== null && { BatchItem : serializeAws_restJson1MapOfEventsBatch ( input . BatchItem , context ) } ) , } ; } ; const serializeAws_restJson1EventStartCondition = ( input , context ) : any => { return { ... ( input . EventFilter !== undefined && input . EventFilter !== null && { EventFilter : serializeAws_restJson1EventFilter ( input . EventFilter , context ) } ) , ... ( input . SegmentId !== undefined && input . SegmentId !== null && { SegmentId : input . SegmentId } ) , } ; } ; const serializeAws_restJson1ExportJobRequest = ( input , context ) : any => { return { ... ( input . RoleArn !== undefined && input . RoleArn !== null && { RoleArn : input . RoleArn } ) , ... ( input . S3UrlPrefix !== undefined && input . S3UrlPrefix !== null && { S3UrlPrefix : input . S3UrlPrefix } ) , ... ( input . SegmentId !== undefined && input . SegmentId !== null && { SegmentId : input . SegmentId } ) , ... ( input . SegmentVersion !== undefined && input . SegmentVersion !== null && { SegmentVersion : input . SegmentVersion } ) , } ; } ; const serializeAws_restJson1GCMChannelRequest = ( input , context ) : any => { return { ... ( input . ApiKey !== undefined && input . ApiKey !== null && { ApiKey : input . ApiKey } ) , ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , } ; } ; const serializeAws_restJson1GCMMessage = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . CollapseKey !== undefined && input . CollapseKey !== null && { CollapseKey : input . CollapseKey } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : serializeAws_restJson1MapOf__string ( input . Data , context ) } ) , ... ( input . IconReference !== undefined && input . IconReference !== null && { IconReference : input . IconReference } ) , ... ( input . ImageIconUrl !== undefined && input . ImageIconUrl !== null && { ImageIconUrl : input . ImageIconUrl } ) , ... ( input . ImageUrl !== undefined && input . ImageUrl !== null && { ImageUrl : input . ImageUrl } ) , ... ( input . Priority !== undefined && input . Priority !== null && { Priority : input . Priority } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . RestrictedPackageName !== undefined && input . RestrictedPackageName !== null && { RestrictedPackageName : input . RestrictedPackageName } ) , ... ( input . SilentPush !== undefined && input . SilentPush !== null && { SilentPush : input . SilentPush } ) , ... ( input . SmallImageIconUrl !== undefined && input . SmallImageIconUrl !== null && { SmallImageIconUrl : input . SmallImageIconUrl } ) , ... ( input . Sound !== undefined && input . Sound !== null && { Sound : input . Sound } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . TimeToLive !== undefined && input . TimeToLive !== null && { TimeToLive : input . TimeToLive } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1GPSCoordinates = ( input , context ) : any => { return { ... ( input . Latitude !== undefined && input . Latitude !== null && { Latitude : __serializeFloat ( input . Latitude ) } ) , ... ( input . Longitude !== undefined && input . Longitude !== null && { Longitude : __serializeFloat ( input . Longitude ) } ) , } ; } ; const serializeAws_restJson1GPSPointDimension = ( input , context ) : any => { return { ... ( input . Coordinates !== undefined && input . Coordinates !== null && { Coordinates : serializeAws_restJson1GPSCoordinates ( input . Coordinates , context ) } ) , ... ( input . RangeInKilometers !== undefined && input . RangeInKilometers !== null && { RangeInKilometers : __serializeFloat ( input . RangeInKilometers ) } ) , } ; } ; const serializeAws_restJson1HoldoutActivity = ( input , context ) : any => { return { ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . Percentage !== undefined && input . Percentage !== null && { Percentage : input . Percentage } ) , } ; } ; const serializeAws_restJson1ImportJobRequest = ( input , context ) : any => { return { ... ( input . DefineSegment !== undefined && input . DefineSegment !== null && { DefineSegment : input . DefineSegment } ) , ... ( input . ExternalId !== undefined && input . ExternalId !== null && { ExternalId : input . ExternalId } ) , ... ( input . Format !== undefined && input . Format !== null && { Format : input . Format } ) , ... ( input . RegisterEndpoints !== undefined && input . RegisterEndpoints !== null && { RegisterEndpoints : input . RegisterEndpoints } ) , ... ( input . RoleArn !== undefined && input . RoleArn !== null && { RoleArn : input . RoleArn } ) , ... ( input . S3Url !== undefined && input . S3Url !== null && { S3Url : input . S3Url } ) , ... ( input . SegmentId !== undefined && input . SegmentId !== null && { SegmentId : input . SegmentId } ) , ... ( input . SegmentName !== undefined && input . SegmentName !== null && { SegmentName : input . SegmentName } ) , } ; } ; const serializeAws_restJson1InAppMessageBodyConfig = ( input , context ) : any => { return { ... ( input . Alignment !== undefined && input . Alignment !== null && { Alignment : input . Alignment } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . TextColor !== undefined && input . TextColor !== null && { TextColor : input . TextColor } ) , } ; } ; const serializeAws_restJson1InAppMessageButton = ( input , context ) : any => { return { ... ( input . Android !== undefined && input . Android !== null && { Android : serializeAws_restJson1OverrideButtonConfiguration ( input . Android , context ) } ) , ... ( input . DefaultConfig !== undefined && input . DefaultConfig !== null && { DefaultConfig : serializeAws_restJson1DefaultButtonConfiguration ( input . DefaultConfig , context ) , } ) , ... ( input . IOS !== undefined && input . IOS !== null && { IOS : serializeAws_restJson1OverrideButtonConfiguration ( input . IOS , context ) } ) , ... ( input . Web !== undefined && input . Web !== null && { Web : serializeAws_restJson1OverrideButtonConfiguration ( input . Web , context ) } ) , } ; } ; const serializeAws_restJson1InAppMessageContent = ( input , context ) : any => { return { ... ( input . BackgroundColor !== undefined && input . BackgroundColor !== null && { BackgroundColor : input . BackgroundColor } ) , ... ( input . BodyConfig !== undefined && input . BodyConfig !== null && { BodyConfig : serializeAws_restJson1InAppMessageBodyConfig ( input . BodyConfig , context ) , } ) , ... ( input . HeaderConfig !== undefined && input . HeaderConfig !== null && { HeaderConfig : serializeAws_restJson1InAppMessageHeaderConfig ( input . HeaderConfig , context ) , } ) , ... ( input . ImageUrl !== undefined && input . ImageUrl !== null && { ImageUrl : input . ImageUrl } ) , ... ( input . PrimaryBtn !== undefined && input . PrimaryBtn !== null && { PrimaryBtn : serializeAws_restJson1InAppMessageButton ( input . PrimaryBtn , context ) } ) , ... ( input . SecondaryBtn !== undefined && input . SecondaryBtn !== null && { SecondaryBtn : serializeAws_restJson1InAppMessageButton ( input . SecondaryBtn , context ) , } ) , } ; } ; const serializeAws_restJson1InAppMessageHeaderConfig = ( input , context ) : any => { return { ... ( input . Alignment !== undefined && input . Alignment !== null && { Alignment : input . Alignment } ) , ... ( input . Header !== undefined && input . Header !== null && { Header : input . Header } ) , ... ( input . TextColor !== undefined && input . TextColor !== null && { TextColor : input . TextColor } ) , } ; } ; const serializeAws_restJson1InAppTemplateRequest = ( input , context ) : any => { return { ... ( input . Content !== undefined && input . Content !== null && { Content : serializeAws_restJson1ListOfInAppMessageContent ( input . Content , context ) } ) , ... ( input . CustomConfig !== undefined && input . CustomConfig !== null && { CustomConfig : serializeAws_restJson1MapOf__string ( input . CustomConfig , context ) , } ) , ... ( input . Layout !== undefined && input . Layout !== null && { Layout : input . Layout } ) , ... ( input . TemplateDescription !== undefined && input . TemplateDescription !== null && { TemplateDescription : input . TemplateDescription } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1JourneyCustomMessage = ( input , context ) : any => { return { ... ( input . Data !== undefined && input . Data !== null && { Data : input . Data } ) , } ; } ; const serializeAws_restJson1JourneyEmailMessage = ( input , context ) : any => { return { ... ( input . FromAddress !== undefined && input . FromAddress !== null && { FromAddress : input . FromAddress } ) , } ; } ; const serializeAws_restJson1JourneyLimits = ( input , context ) : any => { return { ... ( input . DailyCap !== undefined && input . DailyCap !== null && { DailyCap : input . DailyCap } ) , ... ( input . EndpointReentryCap !== undefined && input . EndpointReentryCap !== null && { EndpointReentryCap : input . EndpointReentryCap } ) , ... ( input . EndpointReentryInterval !== undefined && input . EndpointReentryInterval !== null && { EndpointReentryInterval : input . EndpointReentryInterval } ) , ... ( input . MessagesPerSecond !== undefined && input . MessagesPerSecond !== null && { MessagesPerSecond : input . MessagesPerSecond } ) , } ; } ; const serializeAws_restJson1JourneyPushMessage = ( input , context ) : any => { return { ... ( input . TimeToLive !== undefined && input . TimeToLive !== null && { TimeToLive : input . TimeToLive } ) , } ; } ; const serializeAws_restJson1JourneySchedule = ( input , context ) : any => { return { ... ( input . EndTime !== undefined && input . EndTime !== null && { EndTime : input . EndTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" } ) , ... ( input . StartTime !== undefined && input . StartTime !== null && { StartTime : input . StartTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" } ) , ... ( input . Timezone !== undefined && input . Timezone !== null && { Timezone : input . Timezone } ) , } ; } ; const serializeAws_restJson1JourneySMSMessage = ( input , context ) : any => { return { ... ( input . EntityId !== undefined && input . EntityId !== null && { EntityId : input . EntityId } ) , ... ( input . MessageType !== undefined && input . MessageType !== null && { MessageType : input . MessageType } ) , ... ( input . OriginationNumber !== undefined && input . OriginationNumber !== null && { OriginationNumber : input . OriginationNumber } ) , ... ( input . SenderId !== undefined && input . SenderId !== null && { SenderId : input . SenderId } ) , ... ( input . TemplateId !== undefined && input . TemplateId !== null && { TemplateId : input . TemplateId } ) , } ; } ; const serializeAws_restJson1JourneyStateRequest = ( input , context ) : any => { return { ... ( input . State !== undefined && input . State !== null && { State : input . State } ) , } ; } ; const serializeAws_restJson1ListOf__EndpointTypesElement = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ListOf__string = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ListOfEndpointBatchItem = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1EndpointBatchItem ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfInAppMessageContent = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1InAppMessageContent ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfMultiConditionalBranch = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1MultiConditionalBranch ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfRandomSplitEntry = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1RandomSplitEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfSegmentDimensions = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1SegmentDimensions ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfSegmentGroup = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1SegmentGroup ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfSegmentReference = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1SegmentReference ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfSimpleCondition = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1SimpleCondition ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ListOfWriteTreatmentResource = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1WriteTreatmentResource ( entry , context ) ; } ) ; } ; const serializeAws_restJson1MapOf__double = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __serializeFloat ( value ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOf__string = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfActivity = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1Activity ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfAddressConfiguration = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1AddressConfiguration ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfAttributeDimension = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1AttributeDimension ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfEndpointSendConfiguration = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1EndpointSendConfiguration ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfEvent = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1Event ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfEventsBatch = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1EventsBatch ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfListOf__string = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ListOf__string ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1MapOfMetricDimension = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1MetricDimension ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1Message = ( input , context ) : any => { return { ... ( input . Action !== undefined && input . Action !== null && { Action : input . Action } ) , ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . ImageIconUrl !== undefined && input . ImageIconUrl !== null && { ImageIconUrl : input . ImageIconUrl } ) , ... ( input . ImageSmallIconUrl !== undefined && input . ImageSmallIconUrl !== null && { ImageSmallIconUrl : input . ImageSmallIconUrl } ) , ... ( input . ImageUrl !== undefined && input . ImageUrl !== null && { ImageUrl : input . ImageUrl } ) , ... ( input . JsonBody !== undefined && input . JsonBody !== null && { JsonBody : input . JsonBody } ) , ... ( input . MediaUrl !== undefined && input . MediaUrl !== null && { MediaUrl : input . MediaUrl } ) , ... ( input . RawContent !== undefined && input . RawContent !== null && { RawContent : input . RawContent } ) , ... ( input . SilentPush !== undefined && input . SilentPush !== null && { SilentPush : input . SilentPush } ) , ... ( input . TimeToLive !== undefined && input . TimeToLive !== null && { TimeToLive : input . TimeToLive } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . Url !== undefined && input . Url !== null && { Url : input . Url } ) , } ; } ; const serializeAws_restJson1MessageConfiguration = ( input , context ) : any => { return { ... ( input . ADMMessage !== undefined && input . ADMMessage !== null && { ADMMessage : serializeAws_restJson1Message ( input . ADMMessage , context ) } ) , ... ( input . APNSMessage !== undefined && input . APNSMessage !== null && { APNSMessage : serializeAws_restJson1Message ( input . APNSMessage , context ) } ) , ... ( input . BaiduMessage !== undefined && input . BaiduMessage !== null && { BaiduMessage : serializeAws_restJson1Message ( input . BaiduMessage , context ) } ) , ... ( input . CustomMessage !== undefined && input . CustomMessage !== null && { CustomMessage : serializeAws_restJson1CampaignCustomMessage ( input . CustomMessage , context ) , } ) , ... ( input . DefaultMessage !== undefined && input . DefaultMessage !== null && { DefaultMessage : serializeAws_restJson1Message ( input . DefaultMessage , context ) , } ) , ... ( input . EmailMessage !== undefined && input . EmailMessage !== null && { EmailMessage : serializeAws_restJson1CampaignEmailMessage ( input . EmailMessage , context ) , } ) , ... ( input . GCMMessage !== undefined && input . GCMMessage !== null && { GCMMessage : serializeAws_restJson1Message ( input . GCMMessage , context ) } ) , ... ( input . InAppMessage !== undefined && input . InAppMessage !== null && { InAppMessage : serializeAws_restJson1CampaignInAppMessage ( input . InAppMessage , context ) , } ) , ... ( input . SMSMessage !== undefined && input . SMSMessage !== null && { SMSMessage : serializeAws_restJson1CampaignSmsMessage ( input . SMSMessage , context ) } ) , } ; } ; const serializeAws_restJson1MessageRequest = ( input , context ) : any => { return { ... ( input . Addresses !== undefined && input . Addresses !== null && { Addresses : serializeAws_restJson1MapOfAddressConfiguration ( input . Addresses , context ) , } ) , ... ( input . Context !== undefined && input . Context !== null && { Context : serializeAws_restJson1MapOf__string ( input . Context , context ) } ) , ... ( input . Endpoints !== undefined && input . Endpoints !== null && { Endpoints : serializeAws_restJson1MapOfEndpointSendConfiguration ( input . Endpoints , context ) , } ) , ... ( input . MessageConfiguration !== undefined && input . MessageConfiguration !== null && { MessageConfiguration : serializeAws_restJson1DirectMessageConfiguration ( input . MessageConfiguration , context ) , } ) , ... ( input . TemplateConfiguration !== undefined && input . TemplateConfiguration !== null && { TemplateConfiguration : serializeAws_restJson1TemplateConfiguration ( input . TemplateConfiguration , context ) , } ) , ... ( input . TraceId !== undefined && input . TraceId !== null && { TraceId : input . TraceId } ) , } ; } ; const serializeAws_restJson1MetricDimension = ( input , context ) : any => { return { ... ( input . ComparisonOperator !== undefined && input . ComparisonOperator !== null && { ComparisonOperator : input . ComparisonOperator } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : __serializeFloat ( input . Value ) } ) , } ; } ; const serializeAws_restJson1MultiConditionalBranch = ( input , context ) : any => { return { ... ( input . Condition !== undefined && input . Condition !== null && { Condition : serializeAws_restJson1SimpleCondition ( input . Condition , context ) } ) , ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , } ; } ; const serializeAws_restJson1MultiConditionalSplitActivity = ( input , context ) : any => { return { ... ( input . Branches !== undefined && input . Branches !== null && { Branches : serializeAws_restJson1ListOfMultiConditionalBranch ( input . Branches , context ) , } ) , ... ( input . DefaultActivity !== undefined && input . DefaultActivity !== null && { DefaultActivity : input . DefaultActivity } ) , ... ( input . EvaluationWaitTime !== undefined && input . EvaluationWaitTime !== null && { EvaluationWaitTime : serializeAws_restJson1WaitTime ( input . EvaluationWaitTime , context ) , } ) , } ; } ; const serializeAws_restJson1NumberValidateRequest = ( input , context ) : any => { return { ... ( input . IsoCountryCode !== undefined && input . IsoCountryCode !== null && { IsoCountryCode : input . IsoCountryCode } ) , ... ( input . PhoneNumber !== undefined && input . PhoneNumber !== null && { PhoneNumber : input . PhoneNumber } ) , } ; } ; const serializeAws_restJson1OverrideButtonConfiguration = ( input , context ) : any => { return { ... ( input . ButtonAction !== undefined && input . ButtonAction !== null && { ButtonAction : input . ButtonAction } ) , ... ( input . Link !== undefined && input . Link !== null && { Link : input . Link } ) , } ; } ; const serializeAws_restJson1PublicEndpoint = ( input , context ) : any => { return { ... ( input . Address !== undefined && input . Address !== null && { Address : input . Address } ) , ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOfListOf__string ( input . Attributes , context ) , } ) , ... ( input . ChannelType !== undefined && input . ChannelType !== null && { ChannelType : input . ChannelType } ) , ... ( input . Demographic !== undefined && input . Demographic !== null && { Demographic : serializeAws_restJson1EndpointDemographic ( input . Demographic , context ) , } ) , ... ( input . EffectiveDate !== undefined && input . EffectiveDate !== null && { EffectiveDate : input . EffectiveDate } ) , ... ( input . EndpointStatus !== undefined && input . EndpointStatus !== null && { EndpointStatus : input . EndpointStatus } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1EndpointLocation ( input . Location , context ) } ) , ... ( input . Metrics !== undefined && input . Metrics !== null && { Metrics : serializeAws_restJson1MapOf__double ( input . Metrics , context ) } ) , ... ( input . OptOut !== undefined && input . OptOut !== null && { OptOut : input . OptOut } ) , ... ( input . RequestId !== undefined && input . RequestId !== null && { RequestId : input . RequestId } ) , ... ( input . User !== undefined && input . User !== null && { User : serializeAws_restJson1EndpointUser ( input . User , context ) } ) , } ; } ; const serializeAws_restJson1PushMessageActivity = ( input , context ) : any => { return { ... ( input . MessageConfig !== undefined && input . MessageConfig !== null && { MessageConfig : serializeAws_restJson1JourneyPushMessage ( input . MessageConfig , context ) , } ) , ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , ... ( input . TemplateVersion !== undefined && input . TemplateVersion !== null && { TemplateVersion : input . TemplateVersion } ) , } ; } ; const serializeAws_restJson1PushNotificationTemplateRequest = ( input , context ) : any => { return { ... ( input . ADM !== undefined && input . ADM !== null && { ADM : serializeAws_restJson1AndroidPushNotificationTemplate ( input . ADM , context ) } ) , ... ( input . APNS !== undefined && input . APNS !== null && { APNS : serializeAws_restJson1APNSPushNotificationTemplate ( input . APNS , context ) } ) , ... ( input . Baidu !== undefined && input . Baidu !== null && { Baidu : serializeAws_restJson1AndroidPushNotificationTemplate ( input . Baidu , context ) } ) , ... ( input . Default !== undefined && input . Default !== null && { Default : serializeAws_restJson1DefaultPushNotificationTemplate ( input . Default , context ) , } ) , ... ( input . DefaultSubstitutions !== undefined && input . DefaultSubstitutions !== null && { DefaultSubstitutions : input . DefaultSubstitutions } ) , ... ( input . GCM !== undefined && input . GCM !== null && { GCM : serializeAws_restJson1AndroidPushNotificationTemplate ( input . GCM , context ) } ) , ... ( input . RecommenderId !== undefined && input . RecommenderId !== null && { RecommenderId : input . RecommenderId } ) , ... ( input . TemplateDescription !== undefined && input . TemplateDescription !== null && { TemplateDescription : input . TemplateDescription } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1QuietTime = ( input , context ) : any => { return { ... ( input . End !== undefined && input . End !== null && { End : input . End } ) , ... ( input . Start !== undefined && input . Start !== null && { Start : input . Start } ) , } ; } ; const serializeAws_restJson1RandomSplitActivity = ( input , context ) : any => { return { ... ( input . Branches !== undefined && input . Branches !== null && { Branches : serializeAws_restJson1ListOfRandomSplitEntry ( input . Branches , context ) } ) , } ; } ; const serializeAws_restJson1RandomSplitEntry = ( input , context ) : any => { return { ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . Percentage !== undefined && input . Percentage !== null && { Percentage : input . Percentage } ) , } ; } ; const serializeAws_restJson1RawEmail = ( input , context ) : any => { return { ... ( input . Data !== undefined && input . Data !== null && { Data : context . base64Encoder ( input . Data ) } ) , } ; } ; const serializeAws_restJson1RecencyDimension = ( input , context ) : any => { return { ... ( input . Duration !== undefined && input . Duration !== null && { Duration : input . Duration } ) , ... ( input . RecencyType !== undefined && input . RecencyType !== null && { RecencyType : input . RecencyType } ) , } ; } ; const serializeAws_restJson1Schedule = ( input , context ) : any => { return { ... ( input . EndTime !== undefined && input . EndTime !== null && { EndTime : input . EndTime } ) , ... ( input . EventFilter !== undefined && input . EventFilter !== null && { EventFilter : serializeAws_restJson1CampaignEventFilter ( input . EventFilter , context ) , } ) , ... ( input . Frequency !== undefined && input . Frequency !== null && { Frequency : input . Frequency } ) , ... ( input . IsLocalTime !== undefined && input . IsLocalTime !== null && { IsLocalTime : input . IsLocalTime } ) , ... ( input . QuietTime !== undefined && input . QuietTime !== null && { QuietTime : serializeAws_restJson1QuietTime ( input . QuietTime , context ) } ) , ... ( input . StartTime !== undefined && input . StartTime !== null && { StartTime : input . StartTime } ) , ... ( input . Timezone !== undefined && input . Timezone !== null && { Timezone : input . Timezone } ) , } ; } ; const serializeAws_restJson1SegmentBehaviors = ( input , context ) : any => { return { ... ( input . Recency !== undefined && input . Recency !== null && { Recency : serializeAws_restJson1RecencyDimension ( input . Recency , context ) } ) , } ; } ; const serializeAws_restJson1SegmentCondition = ( input , context ) : any => { return { ... ( input . SegmentId !== undefined && input . SegmentId !== null && { SegmentId : input . SegmentId } ) , } ; } ; const serializeAws_restJson1SegmentDemographics = ( input , context ) : any => { return { ... ( input . AppVersion !== undefined && input . AppVersion !== null && { AppVersion : serializeAws_restJson1SetDimension ( input . AppVersion , context ) } ) , ... ( input . Channel !== undefined && input . Channel !== null && { Channel : serializeAws_restJson1SetDimension ( input . Channel , context ) } ) , ... ( input . DeviceType !== undefined && input . DeviceType !== null && { DeviceType : serializeAws_restJson1SetDimension ( input . DeviceType , context ) } ) , ... ( input . Make !== undefined && input . Make !== null && { Make : serializeAws_restJson1SetDimension ( input . Make , context ) } ) , ... ( input . Model !== undefined && input . Model !== null && { Model : serializeAws_restJson1SetDimension ( input . Model , context ) } ) , ... ( input . Platform !== undefined && input . Platform !== null && { Platform : serializeAws_restJson1SetDimension ( input . Platform , context ) } ) , } ; } ; const serializeAws_restJson1SegmentDimensions = ( input , context ) : any => { return { ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOfAttributeDimension ( input . Attributes , context ) , } ) , ... ( input . Behavior !== undefined && input . Behavior !== null && { Behavior : serializeAws_restJson1SegmentBehaviors ( input . Behavior , context ) } ) , ... ( input . Demographic !== undefined && input . Demographic !== null && { Demographic : serializeAws_restJson1SegmentDemographics ( input . Demographic , context ) , } ) , ... ( input . Location !== undefined && input . Location !== null && { Location : serializeAws_restJson1SegmentLocation ( input . Location , context ) } ) , ... ( input . Metrics !== undefined && input . Metrics !== null && { Metrics : serializeAws_restJson1MapOfMetricDimension ( input . Metrics , context ) } ) , ... ( input . UserAttributes !== undefined && input . UserAttributes !== null && { UserAttributes : serializeAws_restJson1MapOfAttributeDimension ( input . UserAttributes , context ) , } ) , } ; } ; const serializeAws_restJson1SegmentGroup = ( input , context ) : any => { return { ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1ListOfSegmentDimensions ( input . Dimensions , context ) , } ) , ... ( input . SourceSegments !== undefined && input . SourceSegments !== null && { SourceSegments : serializeAws_restJson1ListOfSegmentReference ( input . SourceSegments , context ) , } ) , ... ( input . SourceType !== undefined && input . SourceType !== null && { SourceType : input . SourceType } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_restJson1SegmentGroupList = ( input , context ) : any => { return { ... ( input . Groups !== undefined && input . Groups !== null && { Groups : serializeAws_restJson1ListOfSegmentGroup ( input . Groups , context ) } ) , ... ( input . Include !== undefined && input . Include !== null && { Include : input . Include } ) , } ; } ; const serializeAws_restJson1SegmentLocation = ( input , context ) : any => { return { ... ( input . Country !== undefined && input . Country !== null && { Country : serializeAws_restJson1SetDimension ( input . Country , context ) } ) , ... ( input . GPSPoint !== undefined && input . GPSPoint !== null && { GPSPoint : serializeAws_restJson1GPSPointDimension ( input . GPSPoint , context ) } ) , } ; } ; const serializeAws_restJson1SegmentReference = ( input , context ) : any => { return { ... ( input . Id !== undefined && input . Id !== null && { Id : input . Id } ) , ... ( input . Version !== undefined && input . Version !== null && { Version : input . Version } ) , } ; } ; const serializeAws_restJson1SendOTPMessageRequestParameters = ( input , context ) : any => { return { ... ( input . AllowedAttempts !== undefined && input . AllowedAttempts !== null && { AllowedAttempts : input . AllowedAttempts } ) , ... ( input . BrandName !== undefined && input . BrandName !== null && { BrandName : input . BrandName } ) , ... ( input . Channel !== undefined && input . Channel !== null && { Channel : input . Channel } ) , ... ( input . CodeLength !== undefined && input . CodeLength !== null && { CodeLength : input . CodeLength } ) , ... ( input . DestinationIdentity !== undefined && input . DestinationIdentity !== null && { DestinationIdentity : input . DestinationIdentity } ) , ... ( input . EntityId !== undefined && input . EntityId !== null && { EntityId : input . EntityId } ) , ... ( input . Language !== undefined && input . Language !== null && { Language : input . Language } ) , ... ( input . OriginationIdentity !== undefined && input . OriginationIdentity !== null && { OriginationIdentity : input . OriginationIdentity } ) , ... ( input . ReferenceId !== undefined && input . ReferenceId !== null && { ReferenceId : input . ReferenceId } ) , ... ( input . TemplateId !== undefined && input . TemplateId !== null && { TemplateId : input . TemplateId } ) , ... ( input . ValidityPeriod !== undefined && input . ValidityPeriod !== null && { ValidityPeriod : input . ValidityPeriod } ) , } ; } ; const serializeAws_restJson1SendUsersMessageRequest = ( input , context ) : any => { return { ... ( input . Context !== undefined && input . Context !== null && { Context : serializeAws_restJson1MapOf__string ( input . Context , context ) } ) , ... ( input . MessageConfiguration !== undefined && input . MessageConfiguration !== null && { MessageConfiguration : serializeAws_restJson1DirectMessageConfiguration ( input . MessageConfiguration , context ) , } ) , ... ( input . TemplateConfiguration !== undefined && input . TemplateConfiguration !== null && { TemplateConfiguration : serializeAws_restJson1TemplateConfiguration ( input . TemplateConfiguration , context ) , } ) , ... ( input . TraceId !== undefined && input . TraceId !== null && { TraceId : input . TraceId } ) , ... ( input . Users !== undefined && input . Users !== null && { Users : serializeAws_restJson1MapOfEndpointSendConfiguration ( input . Users , context ) } ) , } ; } ; const serializeAws_restJson1Session = ( input , context ) : any => { return { ... ( input . Duration !== undefined && input . Duration !== null && { Duration : input . Duration } ) , ... ( input . Id !== undefined && input . Id !== null && { Id : input . Id } ) , ... ( input . StartTimestamp !== undefined && input . StartTimestamp !== null && { StartTimestamp : input . StartTimestamp } ) , ... ( input . StopTimestamp !== undefined && input . StopTimestamp !== null && { StopTimestamp : input . StopTimestamp } ) , } ; } ; const serializeAws_restJson1SetDimension = ( input , context ) : any => { return { ... ( input . DimensionType !== undefined && input . DimensionType !== null && { DimensionType : input . DimensionType } ) , ... ( input . Values !== undefined && input . Values !== null && { Values : serializeAws_restJson1ListOf__string ( input . Values , context ) } ) , } ; } ; const serializeAws_restJson1SimpleCondition = ( input , context ) : any => { return { ... ( input . EventCondition !== undefined && input . EventCondition !== null && { EventCondition : serializeAws_restJson1EventCondition ( input . EventCondition , context ) , } ) , ... ( input . SegmentCondition !== undefined && input . SegmentCondition !== null && { SegmentCondition : serializeAws_restJson1SegmentCondition ( input . SegmentCondition , context ) , } ) , ... ( input . SegmentDimensions !== undefined && input . SegmentDimensions !== null && { segmentDimensions : serializeAws_restJson1SegmentDimensions ( input . SegmentDimensions , context ) , } ) , } ; } ; const serializeAws_restJson1SimpleEmail = ( input , context ) : any => { return { ... ( input . HtmlPart !== undefined && input . HtmlPart !== null && { HtmlPart : serializeAws_restJson1SimpleEmailPart ( input . HtmlPart , context ) } ) , ... ( input . Subject !== undefined && input . Subject !== null && { Subject : serializeAws_restJson1SimpleEmailPart ( input . Subject , context ) } ) , ... ( input . TextPart !== undefined && input . TextPart !== null && { TextPart : serializeAws_restJson1SimpleEmailPart ( input . TextPart , context ) } ) , } ; } ; const serializeAws_restJson1SimpleEmailPart = ( input , context ) : any => { return { ... ( input . Charset !== undefined && input . Charset !== null && { Charset : input . Charset } ) , ... ( input . Data !== undefined && input . Data !== null && { Data : input . Data } ) , } ; } ; const serializeAws_restJson1SMSChannelRequest = ( input , context ) : any => { return { ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . SenderId !== undefined && input . SenderId !== null && { SenderId : input . SenderId } ) , ... ( input . ShortCode !== undefined && input . ShortCode !== null && { ShortCode : input . ShortCode } ) , } ; } ; const serializeAws_restJson1SMSMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . EntityId !== undefined && input . EntityId !== null && { EntityId : input . EntityId } ) , ... ( input . Keyword !== undefined && input . Keyword !== null && { Keyword : input . Keyword } ) , ... ( input . MediaUrl !== undefined && input . MediaUrl !== null && { MediaUrl : input . MediaUrl } ) , ... ( input . MessageType !== undefined && input . MessageType !== null && { MessageType : input . MessageType } ) , ... ( input . OriginationNumber !== undefined && input . OriginationNumber !== null && { OriginationNumber : input . OriginationNumber } ) , ... ( input . SenderId !== undefined && input . SenderId !== null && { SenderId : input . SenderId } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . TemplateId !== undefined && input . TemplateId !== null && { TemplateId : input . TemplateId } ) , } ; } ; const serializeAws_restJson1SMSMessageActivity = ( input , context ) : any => { return { ... ( input . MessageConfig !== undefined && input . MessageConfig !== null && { MessageConfig : serializeAws_restJson1JourneySMSMessage ( input . MessageConfig , context ) , } ) , ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . TemplateName !== undefined && input . TemplateName !== null && { TemplateName : input . TemplateName } ) , ... ( input . TemplateVersion !== undefined && input . TemplateVersion !== null && { TemplateVersion : input . TemplateVersion } ) , } ; } ; const serializeAws_restJson1SMSTemplateRequest = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . DefaultSubstitutions !== undefined && input . DefaultSubstitutions !== null && { DefaultSubstitutions : input . DefaultSubstitutions } ) , ... ( input . RecommenderId !== undefined && input . RecommenderId !== null && { RecommenderId : input . RecommenderId } ) , ... ( input . TemplateDescription !== undefined && input . TemplateDescription !== null && { TemplateDescription : input . TemplateDescription } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1StartCondition = ( input , context ) : any => { return { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . EventStartCondition !== undefined && input . EventStartCondition !== null && { EventStartCondition : serializeAws_restJson1EventStartCondition ( input . EventStartCondition , context ) , } ) , ... ( input . SegmentStartCondition !== undefined && input . SegmentStartCondition !== null && { SegmentStartCondition : serializeAws_restJson1SegmentCondition ( input . SegmentStartCondition , context ) , } ) , } ; } ; const serializeAws_restJson1TagsModel = ( input , context ) : any => { return { ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1Template = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Version !== undefined && input . Version !== null && { Version : input . Version } ) , } ; } ; const serializeAws_restJson1TemplateActiveVersionRequest = ( input , context ) : any => { return { ... ( input . Version !== undefined && input . Version !== null && { Version : input . Version } ) , } ; } ; const serializeAws_restJson1TemplateConfiguration = ( input , context ) : any => { return { ... ( input . EmailTemplate !== undefined && input . EmailTemplate !== null && { EmailTemplate : serializeAws_restJson1Template ( input . EmailTemplate , context ) } ) , ... ( input . PushTemplate !== undefined && input . PushTemplate !== null && { PushTemplate : serializeAws_restJson1Template ( input . PushTemplate , context ) } ) , ... ( input . SMSTemplate !== undefined && input . SMSTemplate !== null && { SMSTemplate : serializeAws_restJson1Template ( input . SMSTemplate , context ) } ) , ... ( input . VoiceTemplate !== undefined && input . VoiceTemplate !== null && { VoiceTemplate : serializeAws_restJson1Template ( input . VoiceTemplate , context ) } ) , } ; } ; const serializeAws_restJson1UpdateAttributesRequest = ( input , context ) : any => { return { ... ( input . Blacklist !== undefined && input . Blacklist !== null && { Blacklist : serializeAws_restJson1ListOf__string ( input . Blacklist , context ) } ) , } ; } ; const serializeAws_restJson1UpdateRecommenderConfigurationShape = ( input , context ) : any => { return { ... ( input . Attributes !== undefined && input . Attributes !== null && { Attributes : serializeAws_restJson1MapOf__string ( input . Attributes , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . RecommendationProviderIdType !== undefined && input . RecommendationProviderIdType !== null && { RecommendationProviderIdType : input . RecommendationProviderIdType , } ) , ... ( input . RecommendationProviderRoleArn !== undefined && input . RecommendationProviderRoleArn !== null && { RecommendationProviderRoleArn : input . RecommendationProviderRoleArn , } ) , ... ( input . RecommendationProviderUri !== undefined && input . RecommendationProviderUri !== null && { RecommendationProviderUri : input . RecommendationProviderUri } ) , ... ( input . RecommendationTransformerUri !== undefined && input . RecommendationTransformerUri !== null && { RecommendationTransformerUri : input . RecommendationTransformerUri , } ) , ... ( input . RecommendationsDisplayName !== undefined && input . RecommendationsDisplayName !== null && { RecommendationsDisplayName : input . RecommendationsDisplayName } ) , ... ( input . RecommendationsPerMessage !== undefined && input . RecommendationsPerMessage !== null && { RecommendationsPerMessage : input . RecommendationsPerMessage } ) , } ; } ; const serializeAws_restJson1VerifyOTPMessageRequestParameters = ( input , context ) : any => { return { ... ( input . DestinationIdentity !== undefined && input . DestinationIdentity !== null && { DestinationIdentity : input . DestinationIdentity } ) , ... ( input . Otp !== undefined && input . Otp !== null && { Otp : input . Otp } ) , ... ( input . ReferenceId !== undefined && input . ReferenceId !== null && { ReferenceId : input . ReferenceId } ) , } ; } ; const serializeAws_restJson1VoiceChannelRequest = ( input , context ) : any => { return { ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , } ; } ; const serializeAws_restJson1VoiceMessage = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . OriginationNumber !== undefined && input . OriginationNumber !== null && { OriginationNumber : input . OriginationNumber } ) , ... ( input . Substitutions !== undefined && input . Substitutions !== null && { Substitutions : serializeAws_restJson1MapOfListOf__string ( input . Substitutions , context ) , } ) , ... ( input . VoiceId !== undefined && input . VoiceId !== null && { VoiceId : input . VoiceId } ) , } ; } ; const serializeAws_restJson1VoiceTemplateRequest = ( input , context ) : any => { return { ... ( input . Body !== undefined && input . Body !== null && { Body : input . Body } ) , ... ( input . DefaultSubstitutions !== undefined && input . DefaultSubstitutions !== null && { DefaultSubstitutions : input . DefaultSubstitutions } ) , ... ( input . LanguageCode !== undefined && input . LanguageCode !== null && { LanguageCode : input . LanguageCode } ) , ... ( input . TemplateDescription !== undefined && input . TemplateDescription !== null && { TemplateDescription : input . TemplateDescription } ) , ... ( input . VoiceId !== undefined && input . VoiceId !== null && { VoiceId : input . VoiceId } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1WaitActivity = ( input , context ) : any => { return { ... ( input . NextActivity !== undefined && input . NextActivity !== null && { NextActivity : input . NextActivity } ) , ... ( input . WaitTime !== undefined && input . WaitTime !== null && { WaitTime : serializeAws_restJson1WaitTime ( input . WaitTime , context ) } ) , } ; } ; const serializeAws_restJson1WaitTime = ( input , context ) : any => { return { ... ( input . WaitFor !== undefined && input . WaitFor !== null && { WaitFor : input . WaitFor } ) , ... ( input . WaitUntil !== undefined && input . WaitUntil !== null && { WaitUntil : input . WaitUntil } ) , } ; } ; const serializeAws_restJson1WriteApplicationSettingsRequest = ( input , context ) : any => { return { ... ( input . CampaignHook !== undefined && input . CampaignHook !== null && { CampaignHook : serializeAws_restJson1CampaignHook ( input . CampaignHook , context ) } ) , ... ( input . CloudWatchMetricsEnabled !== undefined && input . CloudWatchMetricsEnabled !== null && { CloudWatchMetricsEnabled : input . CloudWatchMetricsEnabled } ) , ... ( input . EventTaggingEnabled !== undefined && input . EventTaggingEnabled !== null && { EventTaggingEnabled : input . EventTaggingEnabled } ) , ... ( input . Limits !== undefined && input . Limits !== null && { Limits : serializeAws_restJson1CampaignLimits ( input . Limits , context ) } ) , ... ( input . QuietTime !== undefined && input . QuietTime !== null && { QuietTime : serializeAws_restJson1QuietTime ( input . QuietTime , context ) } ) , } ; } ; const serializeAws_restJson1WriteCampaignRequest = ( input , context ) : any => { return { ... ( input . AdditionalTreatments !== undefined && input . AdditionalTreatments !== null && { AdditionalTreatments : serializeAws_restJson1ListOfWriteTreatmentResource ( input . AdditionalTreatments , context ) , } ) , ... ( input . CustomDeliveryConfiguration !== undefined && input . CustomDeliveryConfiguration !== null && { CustomDeliveryConfiguration : serializeAws_restJson1CustomDeliveryConfiguration ( input . CustomDeliveryConfiguration , context ) , } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . HoldoutPercent !== undefined && input . HoldoutPercent !== null && { HoldoutPercent : input . HoldoutPercent } ) , ... ( input . Hook !== undefined && input . Hook !== null && { Hook : serializeAws_restJson1CampaignHook ( input . Hook , context ) } ) , ... ( input . IsPaused !== undefined && input . IsPaused !== null && { IsPaused : input . IsPaused } ) , ... ( input . Limits !== undefined && input . Limits !== null && { Limits : serializeAws_restJson1CampaignLimits ( input . Limits , context ) } ) , ... ( input . MessageConfiguration !== undefined && input . MessageConfiguration !== null && { MessageConfiguration : serializeAws_restJson1MessageConfiguration ( input . MessageConfiguration , context ) , } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Priority !== undefined && input . Priority !== null && { Priority : input . Priority } ) , ... ( input . Schedule !== undefined && input . Schedule !== null && { Schedule : serializeAws_restJson1Schedule ( input . Schedule , context ) } ) , ... ( input . SegmentId !== undefined && input . SegmentId !== null && { SegmentId : input . SegmentId } ) , ... ( input . SegmentVersion !== undefined && input . SegmentVersion !== null && { SegmentVersion : input . SegmentVersion } ) , ... ( input . TemplateConfiguration !== undefined && input . TemplateConfiguration !== null && { TemplateConfiguration : serializeAws_restJson1TemplateConfiguration ( input . TemplateConfiguration , context ) , } ) , ... ( input . TreatmentDescription !== undefined && input . TreatmentDescription !== null && { TreatmentDescription : input . TreatmentDescription } ) , ... ( input . TreatmentName !== undefined && input . TreatmentName !== null && { TreatmentName : input . TreatmentName } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1WriteEventStream = ( input , context ) : any => { return { ... ( input . DestinationStreamArn !== undefined && input . DestinationStreamArn !== null && { DestinationStreamArn : input . DestinationStreamArn } ) , ... ( input . RoleArn !== undefined && input . RoleArn !== null && { RoleArn : input . RoleArn } ) , } ; } ; const serializeAws_restJson1WriteJourneyRequest = ( input , context ) : any => { return { ... ( input . Activities !== undefined && input . Activities !== null && { Activities : serializeAws_restJson1MapOfActivity ( input . Activities , context ) } ) , ... ( input . CreationDate !== undefined && input . CreationDate !== null && { CreationDate : input . CreationDate } ) , ... ( input . LastModifiedDate !== undefined && input . LastModifiedDate !== null && { LastModifiedDate : input . LastModifiedDate } ) , ... ( input . Limits !== undefined && input . Limits !== null && { Limits : serializeAws_restJson1JourneyLimits ( input . Limits , context ) } ) , ... ( input . LocalTime !== undefined && input . LocalTime !== null && { LocalTime : input . LocalTime } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . QuietTime !== undefined && input . QuietTime !== null && { QuietTime : serializeAws_restJson1QuietTime ( input . QuietTime , context ) } ) , ... ( input . RefreshFrequency !== undefined && input . RefreshFrequency !== null && { RefreshFrequency : input . RefreshFrequency } ) , ... ( input . RefreshOnSegmentUpdate !== undefined && input . RefreshOnSegmentUpdate !== null && { RefreshOnSegmentUpdate : input . RefreshOnSegmentUpdate } ) , ... ( input . Schedule !== undefined && input . Schedule !== null && { Schedule : serializeAws_restJson1JourneySchedule ( input . Schedule , context ) } ) , ... ( input . StartActivity !== undefined && input . StartActivity !== null && { StartActivity : input . StartActivity } ) , ... ( input . StartCondition !== undefined && input . StartCondition !== null && { StartCondition : serializeAws_restJson1StartCondition ( input . StartCondition , context ) , } ) , ... ( input . State !== undefined && input . State !== null && { State : input . State } ) , ... ( input . WaitForQuietTime !== undefined && input . WaitForQuietTime !== null && { WaitForQuietTime : input . WaitForQuietTime } ) , } ; } ; const serializeAws_restJson1WriteSegmentRequest = ( input , context ) : any => { return { ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1SegmentDimensions ( input . Dimensions , context ) } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . SegmentGroups !== undefined && input . SegmentGroups !== null && { SegmentGroups : serializeAws_restJson1SegmentGroupList ( input . SegmentGroups , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1MapOf__string ( input . tags , context ) } ) , } ; } ; const serializeAws_restJson1WriteTreatmentResource = ( input , context ) : any => { return { ... ( input . CustomDeliveryConfiguration !== undefined && input . CustomDeliveryConfiguration !== null && { CustomDeliveryConfiguration : serializeAws_restJson1CustomDeliveryConfiguration ( input . CustomDeliveryConfiguration , context ) , } ) , ... ( input . MessageConfiguration !== undefined && input . MessageConfiguration !== null && { MessageConfiguration : serializeAws_restJson1MessageConfiguration ( input . MessageConfiguration , context ) , } ) , ... ( input . Schedule !== undefined && input . Schedule !== null && { Schedule : serializeAws_restJson1Schedule ( input . Schedule , context ) } ) , ... ( input . SizePercent !== undefined && input . SizePercent !== null && { SizePercent : input . SizePercent } ) , ... ( input . TemplateConfiguration !== undefined && input . TemplateConfiguration !== null && { TemplateConfiguration : serializeAws_restJson1TemplateConfiguration ( input . TemplateConfiguration , context ) , } ) , ... ( input . TreatmentDescription !== undefined && input . TreatmentDescription !== null && { TreatmentDescription : input . TreatmentDescription } ) , ... ( input . TreatmentName !== undefined && input . TreatmentName !== null && { TreatmentName : input . TreatmentName } ) , } ; } ; const deserializeAws_restJson1ActivitiesResponse = ( output , context ) : ActivitiesResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfActivityResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1Activity = ( output , context ) : Activity => { return { CUSTOM : output . CUSTOM !== undefined && output . CUSTOM !== null ? deserializeAws_restJson1CustomMessageActivity ( output . CUSTOM , context ) : undefined , ConditionalSplit : output . ConditionalSplit !== undefined && output . ConditionalSplit !== null ? deserializeAws_restJson1ConditionalSplitActivity ( output . ConditionalSplit , context ) : undefined , ContactCenter : output . ContactCenter !== undefined && output . ContactCenter !== null ? deserializeAws_restJson1ContactCenterActivity ( output . ContactCenter , context ) : undefined , Description : __expectString ( output . Description ) , EMAIL : output . EMAIL !== undefined && output . EMAIL !== null ? deserializeAws_restJson1EmailMessageActivity ( output . EMAIL , context ) : undefined , Holdout : output . Holdout !== undefined && output . Holdout !== null ? deserializeAws_restJson1HoldoutActivity ( output . Holdout , context ) : undefined , MultiCondition : output . MultiCondition !== undefined && output . MultiCondition !== null ? deserializeAws_restJson1MultiConditionalSplitActivity ( output . MultiCondition , context ) : undefined , PUSH : output . PUSH !== undefined && output . PUSH !== null ? deserializeAws_restJson1PushMessageActivity ( output . PUSH , context ) : undefined , RandomSplit : output . RandomSplit !== undefined && output . RandomSplit !== null ? deserializeAws_restJson1RandomSplitActivity ( output . RandomSplit , context ) : undefined , SMS : output . SMS !== undefined && output . SMS !== null ? deserializeAws_restJson1SMSMessageActivity ( output . SMS , context ) : undefined , Wait : output . Wait !== undefined && output . Wait !== null ? deserializeAws_restJson1WaitActivity ( output . Wait , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ActivityResponse = ( output , context ) : ActivityResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CampaignId : __expectString ( output . CampaignId ) , End : __expectString ( output . End ) , Id : __expectString ( output . Id ) , Result : __expectString ( output . Result ) , ScheduledStart : __expectString ( output . ScheduledStart ) , Start : __expectString ( output . Start ) , State : __expectString ( output . State ) , SuccessfulEndpointCount : __expectInt32 ( output . SuccessfulEndpointCount ) , TimezonesCompletedCount : __expectInt32 ( output . TimezonesCompletedCount ) , TimezonesTotalCount : __expectInt32 ( output . TimezonesTotalCount ) , TotalEndpointCount : __expectInt32 ( output . TotalEndpointCount ) , TreatmentId : __expectString ( output . TreatmentId ) , } as any ; } ; const deserializeAws_restJson1ADMChannelResponse = ( output , context ) : ADMChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1AndroidPushNotificationTemplate = ( output , context ) : AndroidPushNotificationTemplate => { return { Action : __expectString ( output . Action ) , Body : __expectString ( output . Body ) , ImageIconUrl : __expectString ( output . ImageIconUrl ) , ImageUrl : __expectString ( output . ImageUrl ) , RawContent : __expectString ( output . RawContent ) , SmallImageIconUrl : __expectString ( output . SmallImageIconUrl ) , Sound : __expectString ( output . Sound ) , Title : __expectString ( output . Title ) , Url : __expectString ( output . Url ) , } as any ; } ; const deserializeAws_restJson1APNSChannelResponse = ( output , context ) : APNSChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , DefaultAuthenticationMethod : __expectString ( output . DefaultAuthenticationMethod ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , HasTokenKey : __expectBoolean ( output . HasTokenKey ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1APNSPushNotificationTemplate = ( output , context ) : APNSPushNotificationTemplate => { return { Action : __expectString ( output . Action ) , Body : __expectString ( output . Body ) , MediaUrl : __expectString ( output . MediaUrl ) , RawContent : __expectString ( output . RawContent ) , Sound : __expectString ( output . Sound ) , Title : __expectString ( output . Title ) , Url : __expectString ( output . Url ) , } as any ; } ; const deserializeAws_restJson1APNSSandboxChannelResponse = ( output , context ) : APNSSandboxChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , DefaultAuthenticationMethod : __expectString ( output . DefaultAuthenticationMethod ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , HasTokenKey : __expectBoolean ( output . HasTokenKey ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1APNSVoipChannelResponse = ( output , context ) : APNSVoipChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , DefaultAuthenticationMethod : __expectString ( output . DefaultAuthenticationMethod ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , HasTokenKey : __expectBoolean ( output . HasTokenKey ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1APNSVoipSandboxChannelResponse = ( output , context ) : APNSVoipSandboxChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , DefaultAuthenticationMethod : __expectString ( output . DefaultAuthenticationMethod ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , HasTokenKey : __expectBoolean ( output . HasTokenKey ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1ApplicationDateRangeKpiResponse = ( output , context ) : ApplicationDateRangeKpiResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . EndTime ) ) : undefined , KpiName : __expectString ( output . KpiName ) , KpiResult : output . KpiResult !== undefined && output . KpiResult !== null ? deserializeAws_restJson1BaseKpiResult ( output . KpiResult , context ) : undefined , NextToken : __expectString ( output . NextToken ) , StartTime : output . StartTime !== undefined && output . StartTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . StartTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ApplicationResponse = ( output , context ) : ApplicationResponse => { return { Arn : __expectString ( output . Arn ) , Id : __expectString ( output . Id ) , Name : __expectString ( output . Name ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ApplicationSettingsResource = ( output , context ) : ApplicationSettingsResource => { return { ApplicationId : __expectString ( output . ApplicationId ) , CampaignHook : output . CampaignHook !== undefined && output . CampaignHook !== null ? deserializeAws_restJson1CampaignHook ( output . CampaignHook , context ) : undefined , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Limits : output . Limits !== undefined && output . Limits !== null ? deserializeAws_restJson1CampaignLimits ( output . Limits , context ) : undefined , QuietTime : output . QuietTime !== undefined && output . QuietTime !== null ? deserializeAws_restJson1QuietTime ( output . QuietTime , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ApplicationsResponse = ( output , context ) : ApplicationsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfApplicationResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1AttributeDimension = ( output , context ) : AttributeDimension => { return { AttributeType : __expectString ( output . AttributeType ) , Values : output . Values !== undefined && output . Values !== null ? deserializeAws_restJson1ListOf__string ( output . Values , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AttributesResource = ( output , context ) : AttributesResource => { return { ApplicationId : __expectString ( output . ApplicationId ) , AttributeType : __expectString ( output . AttributeType ) , Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_restJson1ListOf__string ( output . Attributes , context ) : undefined , } as any ; } ; const deserializeAws_restJson1BaiduChannelResponse = ( output , context ) : BaiduChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Credential : __expectString ( output . Credential ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1BaseKpiResult = ( output , context ) : BaseKpiResult => { return { Rows : output . Rows !== undefined && output . Rows !== null ? deserializeAws_restJson1ListOfResultRow ( output . Rows , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CampaignCustomMessage = ( output , context ) : CampaignCustomMessage => { return { Data : __expectString ( output . Data ) , } as any ; } ; const deserializeAws_restJson1CampaignDateRangeKpiResponse = ( output , context ) : CampaignDateRangeKpiResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CampaignId : __expectString ( output . CampaignId ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . EndTime ) ) : undefined , KpiName : __expectString ( output . KpiName ) , KpiResult : output . KpiResult !== undefined && output . KpiResult !== null ? deserializeAws_restJson1BaseKpiResult ( output . KpiResult , context ) : undefined , NextToken : __expectString ( output . NextToken ) , StartTime : output . StartTime !== undefined && output . StartTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . StartTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1CampaignEmailMessage = ( output , context ) : CampaignEmailMessage => { return { Body : __expectString ( output . Body ) , FromAddress : __expectString ( output . FromAddress ) , HtmlBody : __expectString ( output . HtmlBody ) , Title : __expectString ( output . Title ) , } as any ; } ; const deserializeAws_restJson1CampaignEventFilter = ( output , context ) : CampaignEventFilter => { return { Dimensions : output . Dimensions !== undefined && output . Dimensions !== null ? deserializeAws_restJson1EventDimensions ( output . Dimensions , context ) : undefined , FilterType : __expectString ( output . FilterType ) , } as any ; } ; const deserializeAws_restJson1CampaignHook = ( output , context ) : CampaignHook => { return { LambdaFunctionName : __expectString ( output . LambdaFunctionName ) , Mode : __expectString ( output . Mode ) , WebUrl : __expectString ( output . WebUrl ) , } as any ; } ; const deserializeAws_restJson1CampaignInAppMessage = ( output , context ) : CampaignInAppMessage => { return { Body : __expectString ( output . Body ) , Content : output . Content !== undefined && output . Content !== null ? deserializeAws_restJson1ListOfInAppMessageContent ( output . Content , context ) : undefined , CustomConfig : output . CustomConfig !== undefined && output . CustomConfig !== null ? deserializeAws_restJson1MapOf__string ( output . CustomConfig , context ) : undefined , Layout : __expectString ( output . Layout ) , } as any ; } ; const deserializeAws_restJson1CampaignLimits = ( output , context ) : CampaignLimits => { return { Daily : __expectInt32 ( output . Daily ) , MaximumDuration : __expectInt32 ( output . MaximumDuration ) , MessagesPerSecond : __expectInt32 ( output . MessagesPerSecond ) , Session : __expectInt32 ( output . Session ) , Total : __expectInt32 ( output . Total ) , } as any ; } ; const deserializeAws_restJson1CampaignResponse = ( output , context ) : CampaignResponse => { return { AdditionalTreatments : output . AdditionalTreatments !== undefined && output . AdditionalTreatments !== null ? deserializeAws_restJson1ListOfTreatmentResource ( output . AdditionalTreatments , context ) : undefined , ApplicationId : __expectString ( output . ApplicationId ) , Arn : __expectString ( output . Arn ) , CreationDate : __expectString ( output . CreationDate ) , CustomDeliveryConfiguration : output . CustomDeliveryConfiguration !== undefined && output . CustomDeliveryConfiguration !== null ? deserializeAws_restJson1CustomDeliveryConfiguration ( output . CustomDeliveryConfiguration , context ) : undefined , DefaultState : output . DefaultState !== undefined && output . DefaultState !== null ? deserializeAws_restJson1CampaignState ( output . DefaultState , context ) : undefined , Description : __expectString ( output . Description ) , HoldoutPercent : __expectInt32 ( output . HoldoutPercent ) , Hook : output . Hook !== undefined && output . Hook !== null ? deserializeAws_restJson1CampaignHook ( output . Hook , context ) : undefined , Id : __expectString ( output . Id ) , IsPaused : __expectBoolean ( output . IsPaused ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Limits : output . Limits !== undefined && output . Limits !== null ? deserializeAws_restJson1CampaignLimits ( output . Limits , context ) : undefined , MessageConfiguration : output . MessageConfiguration !== undefined && output . MessageConfiguration !== null ? deserializeAws_restJson1MessageConfiguration ( output . MessageConfiguration , context ) : undefined , Name : __expectString ( output . Name ) , Priority : __expectInt32 ( output . Priority ) , Schedule : output . Schedule !== undefined && output . Schedule !== null ? deserializeAws_restJson1Schedule ( output . Schedule , context ) : undefined , SegmentId : __expectString ( output . SegmentId ) , SegmentVersion : __expectInt32 ( output . SegmentVersion ) , State : output . State !== undefined && output . State !== null ? deserializeAws_restJson1CampaignState ( output . State , context ) : undefined , TemplateConfiguration : output . TemplateConfiguration !== undefined && output . TemplateConfiguration !== null ? deserializeAws_restJson1TemplateConfiguration ( output . TemplateConfiguration , context ) : undefined , TreatmentDescription : __expectString ( output . TreatmentDescription ) , TreatmentName : __expectString ( output . TreatmentName ) , Version : __expectInt32 ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CampaignSmsMessage = ( output , context ) : CampaignSmsMessage => { return { Body : __expectString ( output . Body ) , EntityId : __expectString ( output . EntityId ) , MessageType : __expectString ( output . MessageType ) , OriginationNumber : __expectString ( output . OriginationNumber ) , SenderId : __expectString ( output . SenderId ) , TemplateId : __expectString ( output . TemplateId ) , } as any ; } ; const deserializeAws_restJson1CampaignsResponse = ( output , context ) : CampaignsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfCampaignResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1CampaignState = ( output , context ) : CampaignState => { return { CampaignStatus : __expectString ( output . CampaignStatus ) , } as any ; } ; const deserializeAws_restJson1ChannelResponse = ( output , context ) : ChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1ChannelsResponse = ( output , context ) : ChannelsResponse => { return { Channels : output . Channels !== undefined && output . Channels !== null ? deserializeAws_restJson1MapOfChannelResponse ( output . Channels , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Condition = ( output , context ) : Condition => { return { Conditions : output . Conditions !== undefined && output . Conditions !== null ? deserializeAws_restJson1ListOfSimpleCondition ( output . Conditions , context ) : undefined , Operator : __expectString ( output . Operator ) , } as any ; } ; const deserializeAws_restJson1ConditionalSplitActivity = ( output , context ) : ConditionalSplitActivity => { return { Condition : output . Condition !== undefined && output . Condition !== null ? deserializeAws_restJson1Condition ( output . Condition , context ) : undefined , EvaluationWaitTime : output . EvaluationWaitTime !== undefined && output . EvaluationWaitTime !== null ? deserializeAws_restJson1WaitTime ( output . EvaluationWaitTime , context ) : undefined , FalseActivity : __expectString ( output . FalseActivity ) , TrueActivity : __expectString ( output . TrueActivity ) , } as any ; } ; const deserializeAws_restJson1ContactCenterActivity = ( output , context ) : ContactCenterActivity => { return { NextActivity : __expectString ( output . NextActivity ) , } as any ; } ; const deserializeAws_restJson1CreateTemplateMessageBody = ( output , context ) : CreateTemplateMessageBody => { return { Arn : __expectString ( output . Arn ) , Message : __expectString ( output . Message ) , RequestID : __expectString ( output . RequestID ) , } as any ; } ; const deserializeAws_restJson1CustomDeliveryConfiguration = ( output , context ) : CustomDeliveryConfiguration => { return { DeliveryUri : __expectString ( output . DeliveryUri ) , EndpointTypes : output . EndpointTypes !== undefined && output . EndpointTypes !== null ? deserializeAws_restJson1ListOf__EndpointTypesElement ( output . EndpointTypes , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CustomMessageActivity = ( output , context ) : CustomMessageActivity => { return { DeliveryUri : __expectString ( output . DeliveryUri ) , EndpointTypes : output . EndpointTypes !== undefined && output . EndpointTypes !== null ? deserializeAws_restJson1ListOf__EndpointTypesElement ( output . EndpointTypes , context ) : undefined , MessageConfig : output . MessageConfig !== undefined && output . MessageConfig !== null ? deserializeAws_restJson1JourneyCustomMessage ( output . MessageConfig , context ) : undefined , NextActivity : __expectString ( output . NextActivity ) , TemplateName : __expectString ( output . TemplateName ) , TemplateVersion : __expectString ( output . TemplateVersion ) , } as any ; } ; const deserializeAws_restJson1DefaultButtonConfiguration = ( output , context ) : DefaultButtonConfiguration => { return { BackgroundColor : __expectString ( output . BackgroundColor ) , BorderRadius : __expectInt32 ( output . BorderRadius ) , ButtonAction : __expectString ( output . ButtonAction ) , Link : __expectString ( output . Link ) , Text : __expectString ( output . Text ) , TextColor : __expectString ( output . TextColor ) , } as any ; } ; const deserializeAws_restJson1DefaultPushNotificationTemplate = ( output , context ) : DefaultPushNotificationTemplate => { return { Action : __expectString ( output . Action ) , Body : __expectString ( output . Body ) , Sound : __expectString ( output . Sound ) , Title : __expectString ( output . Title ) , Url : __expectString ( output . Url ) , } as any ; } ; const deserializeAws_restJson1EmailChannelResponse = ( output , context ) : EmailChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , ConfigurationSet : __expectString ( output . ConfigurationSet ) , CreationDate : __expectString ( output . CreationDate ) , Enabled : __expectBoolean ( output . Enabled ) , FromAddress : __expectString ( output . FromAddress ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , Identity : __expectString ( output . Identity ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , MessagesPerSecond : __expectInt32 ( output . MessagesPerSecond ) , Platform : __expectString ( output . Platform ) , RoleArn : __expectString ( output . RoleArn ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1EmailMessageActivity = ( output , context ) : EmailMessageActivity => { return { MessageConfig : output . MessageConfig !== undefined && output . MessageConfig !== null ? deserializeAws_restJson1JourneyEmailMessage ( output . MessageConfig , context ) : undefined , NextActivity : __expectString ( output . NextActivity ) , TemplateName : __expectString ( output . TemplateName ) , TemplateVersion : __expectString ( output . TemplateVersion ) , } as any ; } ; const deserializeAws_restJson1EmailTemplateResponse = ( output , context ) : EmailTemplateResponse => { return { Arn : __expectString ( output . Arn ) , CreationDate : __expectString ( output . CreationDate ) , DefaultSubstitutions : __expectString ( output . DefaultSubstitutions ) , HtmlPart : __expectString ( output . HtmlPart ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , RecommenderId : __expectString ( output . RecommenderId ) , Subject : __expectString ( output . Subject ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , TextPart : __expectString ( output . TextPart ) , Version : __expectString ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EndpointDemographic = ( output , context ) : EndpointDemographic => { return { AppVersion : __expectString ( output . AppVersion ) , Locale : __expectString ( output . Locale ) , Make : __expectString ( output . Make ) , Model : __expectString ( output . Model ) , ModelVersion : __expectString ( output . ModelVersion ) , Platform : __expectString ( output . Platform ) , PlatformVersion : __expectString ( output . PlatformVersion ) , Timezone : __expectString ( output . Timezone ) , } as any ; } ; const deserializeAws_restJson1EndpointItemResponse = ( output , context ) : EndpointItemResponse => { return { Message : __expectString ( output . Message ) , StatusCode : __expectInt32 ( output . StatusCode ) , } as any ; } ; const deserializeAws_restJson1EndpointLocation = ( output , context ) : EndpointLocation => { return { City : __expectString ( output . City ) , Country : __expectString ( output . Country ) , Latitude : __limitedParseDouble ( output . Latitude ) , Longitude : __limitedParseDouble ( output . Longitude ) , PostalCode : __expectString ( output . PostalCode ) , Region : __expectString ( output . Region ) , } as any ; } ; const deserializeAws_restJson1EndpointMessageResult = ( output , context ) : EndpointMessageResult => { return { Address : __expectString ( output . Address ) , DeliveryStatus : __expectString ( output . DeliveryStatus ) , MessageId : __expectString ( output . MessageId ) , StatusCode : __expectInt32 ( output . StatusCode ) , StatusMessage : __expectString ( output . StatusMessage ) , UpdatedToken : __expectString ( output . UpdatedToken ) , } as any ; } ; const deserializeAws_restJson1EndpointResponse = ( output , context ) : EndpointResponse => { return { Address : __expectString ( output . Address ) , ApplicationId : __expectString ( output . ApplicationId ) , Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_restJson1MapOfListOf__string ( output . Attributes , context ) : undefined , ChannelType : __expectString ( output . ChannelType ) , CohortId : __expectString ( output . CohortId ) , CreationDate : __expectString ( output . CreationDate ) , Demographic : output . Demographic !== undefined && output . Demographic !== null ? deserializeAws_restJson1EndpointDemographic ( output . Demographic , context ) : undefined , EffectiveDate : __expectString ( output . EffectiveDate ) , EndpointStatus : __expectString ( output . EndpointStatus ) , Id : __expectString ( output . Id ) , Location : output . Location !== undefined && output . Location !== null ? deserializeAws_restJson1EndpointLocation ( output . Location , context ) : undefined , Metrics : output . Metrics !== undefined && output . Metrics !== null ? deserializeAws_restJson1MapOf__double ( output . Metrics , context ) : undefined , OptOut : __expectString ( output . OptOut ) , RequestId : __expectString ( output . RequestId ) , User : output . User !== undefined && output . User !== null ? deserializeAws_restJson1EndpointUser ( output . User , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EndpointsResponse = ( output , context ) : EndpointsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfEndpointResponse ( output . Item , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EndpointUser = ( output , context ) : EndpointUser => { return { UserAttributes : output . UserAttributes !== undefined && output . UserAttributes !== null ? deserializeAws_restJson1MapOfListOf__string ( output . UserAttributes , context ) : undefined , UserId : __expectString ( output . UserId ) , } as any ; } ; const deserializeAws_restJson1EventCondition = ( output , context ) : EventCondition => { return { Dimensions : output . Dimensions !== undefined && output . Dimensions !== null ? deserializeAws_restJson1EventDimensions ( output . Dimensions , context ) : undefined , MessageActivity : __expectString ( output . MessageActivity ) , } as any ; } ; const deserializeAws_restJson1EventDimensions = ( output , context ) : EventDimensions => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_restJson1MapOfAttributeDimension ( output . Attributes , context ) : undefined , EventType : output . EventType !== undefined && output . EventType !== null ? deserializeAws_restJson1SetDimension ( output . EventType , context ) : undefined , Metrics : output . Metrics !== undefined && output . Metrics !== null ? deserializeAws_restJson1MapOfMetricDimension ( output . Metrics , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EventFilter = ( output , context ) : EventFilter => { return { Dimensions : output . Dimensions !== undefined && output . Dimensions !== null ? deserializeAws_restJson1EventDimensions ( output . Dimensions , context ) : undefined , FilterType : __expectString ( output . FilterType ) , } as any ; } ; const deserializeAws_restJson1EventItemResponse = ( output , context ) : EventItemResponse => { return { Message : __expectString ( output . Message ) , StatusCode : __expectInt32 ( output . StatusCode ) , } as any ; } ; const deserializeAws_restJson1EventsResponse = ( output , context ) : EventsResponse => { return { Results : output . Results !== undefined && output . Results !== null ? deserializeAws_restJson1MapOfItemResponse ( output . Results , context ) : undefined , } as any ; } ; const deserializeAws_restJson1EventStartCondition = ( output , context ) : EventStartCondition => { return { EventFilter : output . EventFilter !== undefined && output . EventFilter !== null ? deserializeAws_restJson1EventFilter ( output . EventFilter , context ) : undefined , SegmentId : __expectString ( output . SegmentId ) , } as any ; } ; const deserializeAws_restJson1EventStream = ( output , context ) : EventStream => { return { ApplicationId : __expectString ( output . ApplicationId ) , DestinationStreamArn : __expectString ( output . DestinationStreamArn ) , ExternalId : __expectString ( output . ExternalId ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , LastUpdatedBy : __expectString ( output . LastUpdatedBy ) , RoleArn : __expectString ( output . RoleArn ) , } as any ; } ; const deserializeAws_restJson1ExportJobResource = ( output , context ) : ExportJobResource => { return { RoleArn : __expectString ( output . RoleArn ) , S3UrlPrefix : __expectString ( output . S3UrlPrefix ) , SegmentId : __expectString ( output . SegmentId ) , SegmentVersion : __expectInt32 ( output . SegmentVersion ) , } as any ; } ; const deserializeAws_restJson1ExportJobResponse = ( output , context ) : ExportJobResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CompletedPieces : __expectInt32 ( output . CompletedPieces ) , CompletionDate : __expectString ( output . CompletionDate ) , CreationDate : __expectString ( output . CreationDate ) , Definition : output . Definition !== undefined && output . Definition !== null ? deserializeAws_restJson1ExportJobResource ( output . Definition , context ) : undefined , FailedPieces : __expectInt32 ( output . FailedPieces ) , Failures : output . Failures !== undefined && output . Failures !== null ? deserializeAws_restJson1ListOf__string ( output . Failures , context ) : undefined , Id : __expectString ( output . Id ) , JobStatus : __expectString ( output . JobStatus ) , TotalFailures : __expectInt32 ( output . TotalFailures ) , TotalPieces : __expectInt32 ( output . TotalPieces ) , TotalProcessed : __expectInt32 ( output . TotalProcessed ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1ExportJobsResponse = ( output , context ) : ExportJobsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfExportJobResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1GCMChannelResponse = ( output , context ) : GCMChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Credential : __expectString ( output . Credential ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1GPSCoordinates = ( output , context ) : GPSCoordinates => { return { Latitude : __limitedParseDouble ( output . Latitude ) , Longitude : __limitedParseDouble ( output . Longitude ) , } as any ; } ; const deserializeAws_restJson1GPSPointDimension = ( output , context ) : GPSPointDimension => { return { Coordinates : output . Coordinates !== undefined && output . Coordinates !== null ? deserializeAws_restJson1GPSCoordinates ( output . Coordinates , context ) : undefined , RangeInKilometers : __limitedParseDouble ( output . RangeInKilometers ) , } as any ; } ; const deserializeAws_restJson1HoldoutActivity = ( output , context ) : HoldoutActivity => { return { NextActivity : __expectString ( output . NextActivity ) , Percentage : __expectInt32 ( output . Percentage ) , } as any ; } ; const deserializeAws_restJson1ImportJobResource = ( output , context ) : ImportJobResource => { return { DefineSegment : __expectBoolean ( output . DefineSegment ) , ExternalId : __expectString ( output . ExternalId ) , Format : __expectString ( output . Format ) , RegisterEndpoints : __expectBoolean ( output . RegisterEndpoints ) , RoleArn : __expectString ( output . RoleArn ) , S3Url : __expectString ( output . S3Url ) , SegmentId : __expectString ( output . SegmentId ) , SegmentName : __expectString ( output . SegmentName ) , } as any ; } ; const deserializeAws_restJson1ImportJobResponse = ( output , context ) : ImportJobResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CompletedPieces : __expectInt32 ( output . CompletedPieces ) , CompletionDate : __expectString ( output . CompletionDate ) , CreationDate : __expectString ( output . CreationDate ) , Definition : output . Definition !== undefined && output . Definition !== null ? deserializeAws_restJson1ImportJobResource ( output . Definition , context ) : undefined , FailedPieces : __expectInt32 ( output . FailedPieces ) , Failures : output . Failures !== undefined && output . Failures !== null ? deserializeAws_restJson1ListOf__string ( output . Failures , context ) : undefined , Id : __expectString ( output . Id ) , JobStatus : __expectString ( output . JobStatus ) , TotalFailures : __expectInt32 ( output . TotalFailures ) , TotalPieces : __expectInt32 ( output . TotalPieces ) , TotalProcessed : __expectInt32 ( output . TotalProcessed ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1ImportJobsResponse = ( output , context ) : ImportJobsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfImportJobResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1InAppCampaignSchedule = ( output , context ) : InAppCampaignSchedule => { return { EndDate : __expectString ( output . EndDate ) , EventFilter : output . EventFilter !== undefined && output . EventFilter !== null ? deserializeAws_restJson1CampaignEventFilter ( output . EventFilter , context ) : undefined , QuietTime : output . QuietTime !== undefined && output . QuietTime !== null ? deserializeAws_restJson1QuietTime ( output . QuietTime , context ) : undefined , } as any ; } ; const deserializeAws_restJson1InAppMessage = ( output , context ) : InAppMessage => { return { Content : output . Content !== undefined && output . Content !== null ? deserializeAws_restJson1ListOfInAppMessageContent ( output . Content , context ) : undefined , CustomConfig : output . CustomConfig !== undefined && output . CustomConfig !== null ? deserializeAws_restJson1MapOf__string ( output . CustomConfig , context ) : undefined , Layout : __expectString ( output . Layout ) , } as any ; } ; const deserializeAws_restJson1InAppMessageBodyConfig = ( output , context ) : InAppMessageBodyConfig => { return { Alignment : __expectString ( output . Alignment ) , Body : __expectString ( output . Body ) , TextColor : __expectString ( output . TextColor ) , } as any ; } ; const deserializeAws_restJson1InAppMessageButton = ( output , context ) : InAppMessageButton => { return { Android : output . Android !== undefined && output . Android !== null ? deserializeAws_restJson1OverrideButtonConfiguration ( output . Android , context ) : undefined , DefaultConfig : output . DefaultConfig !== undefined && output . DefaultConfig !== null ? deserializeAws_restJson1DefaultButtonConfiguration ( output . DefaultConfig , context ) : undefined , IOS : output . IOS !== undefined && output . IOS !== null ? deserializeAws_restJson1OverrideButtonConfiguration ( output . IOS , context ) : undefined , Web : output . Web !== undefined && output . Web !== null ? deserializeAws_restJson1OverrideButtonConfiguration ( output . Web , context ) : undefined , } as any ; } ; const deserializeAws_restJson1InAppMessageCampaign = ( output , context ) : InAppMessageCampaign => { return { CampaignId : __expectString ( output . CampaignId ) , DailyCap : __expectInt32 ( output . DailyCap ) , InAppMessage : output . InAppMessage !== undefined && output . InAppMessage !== null ? deserializeAws_restJson1InAppMessage ( output . InAppMessage , context ) : undefined , Priority : __expectInt32 ( output . Priority ) , Schedule : output . Schedule !== undefined && output . Schedule !== null ? deserializeAws_restJson1InAppCampaignSchedule ( output . Schedule , context ) : undefined , SessionCap : __expectInt32 ( output . SessionCap ) , TotalCap : __expectInt32 ( output . TotalCap ) , TreatmentId : __expectString ( output . TreatmentId ) , } as any ; } ; const deserializeAws_restJson1InAppMessageContent = ( output , context ) : InAppMessageContent => { return { BackgroundColor : __expectString ( output . BackgroundColor ) , BodyConfig : output . BodyConfig !== undefined && output . BodyConfig !== null ? deserializeAws_restJson1InAppMessageBodyConfig ( output . BodyConfig , context ) : undefined , HeaderConfig : output . HeaderConfig !== undefined && output . HeaderConfig !== null ? deserializeAws_restJson1InAppMessageHeaderConfig ( output . HeaderConfig , context ) : undefined , ImageUrl : __expectString ( output . ImageUrl ) , PrimaryBtn : output . PrimaryBtn !== undefined && output . PrimaryBtn !== null ? deserializeAws_restJson1InAppMessageButton ( output . PrimaryBtn , context ) : undefined , SecondaryBtn : output . SecondaryBtn !== undefined && output . SecondaryBtn !== null ? deserializeAws_restJson1InAppMessageButton ( output . SecondaryBtn , context ) : undefined , } as any ; } ; const deserializeAws_restJson1InAppMessageHeaderConfig = ( output , context ) : InAppMessageHeaderConfig => { return { Alignment : __expectString ( output . Alignment ) , Header : __expectString ( output . Header ) , TextColor : __expectString ( output . TextColor ) , } as any ; } ; const deserializeAws_restJson1InAppMessagesResponse = ( output , context ) : InAppMessagesResponse => { return { InAppMessageCampaigns : output . InAppMessageCampaigns !== undefined && output . InAppMessageCampaigns !== null ? deserializeAws_restJson1ListOfInAppMessageCampaign ( output . InAppMessageCampaigns , context ) : undefined , } as any ; } ; const deserializeAws_restJson1InAppTemplateResponse = ( output , context ) : InAppTemplateResponse => { return { Arn : __expectString ( output . Arn ) , Content : output . Content !== undefined && output . Content !== null ? deserializeAws_restJson1ListOfInAppMessageContent ( output . Content , context ) : undefined , CreationDate : __expectString ( output . CreationDate ) , CustomConfig : output . CustomConfig !== undefined && output . CustomConfig !== null ? deserializeAws_restJson1MapOf__string ( output . CustomConfig , context ) : undefined , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Layout : __expectString ( output . Layout ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , Version : __expectString ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ItemResponse = ( output , context ) : ItemResponse => { return { EndpointItemResponse : output . EndpointItemResponse !== undefined && output . EndpointItemResponse !== null ? deserializeAws_restJson1EndpointItemResponse ( output . EndpointItemResponse , context ) : undefined , EventsItemResponse : output . EventsItemResponse !== undefined && output . EventsItemResponse !== null ? deserializeAws_restJson1MapOfEventItemResponse ( output . EventsItemResponse , context ) : undefined , } as any ; } ; const deserializeAws_restJson1JourneyChannelSettings = ( output , context ) : JourneyChannelSettings => { return { ConnectCampaignArn : __expectString ( output . ConnectCampaignArn ) , ConnectCampaignExecutionRoleArn : __expectString ( output . ConnectCampaignExecutionRoleArn ) , } as any ; } ; const deserializeAws_restJson1JourneyCustomMessage = ( output , context ) : JourneyCustomMessage => { return { Data : __expectString ( output . Data ) , } as any ; } ; const deserializeAws_restJson1JourneyDateRangeKpiResponse = ( output , context ) : JourneyDateRangeKpiResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . EndTime ) ) : undefined , JourneyId : __expectString ( output . JourneyId ) , KpiName : __expectString ( output . KpiName ) , KpiResult : output . KpiResult !== undefined && output . KpiResult !== null ? deserializeAws_restJson1BaseKpiResult ( output . KpiResult , context ) : undefined , NextToken : __expectString ( output . NextToken ) , StartTime : output . StartTime !== undefined && output . StartTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . StartTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1JourneyEmailMessage = ( output , context ) : JourneyEmailMessage => { return { FromAddress : __expectString ( output . FromAddress ) , } as any ; } ; const deserializeAws_restJson1JourneyExecutionActivityMetricsResponse = ( output , context ) : JourneyExecutionActivityMetricsResponse => { return { ActivityType : __expectString ( output . ActivityType ) , ApplicationId : __expectString ( output . ApplicationId ) , JourneyActivityId : __expectString ( output . JourneyActivityId ) , JourneyId : __expectString ( output . JourneyId ) , LastEvaluatedTime : __expectString ( output . LastEvaluatedTime ) , Metrics : output . Metrics !== undefined && output . Metrics !== null ? deserializeAws_restJson1MapOf__string ( output . Metrics , context ) : undefined , } as any ; } ; const deserializeAws_restJson1JourneyExecutionMetricsResponse = ( output , context ) : JourneyExecutionMetricsResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , JourneyId : __expectString ( output . JourneyId ) , LastEvaluatedTime : __expectString ( output . LastEvaluatedTime ) , Metrics : output . Metrics !== undefined && output . Metrics !== null ? deserializeAws_restJson1MapOf__string ( output . Metrics , context ) : undefined , } as any ; } ; const deserializeAws_restJson1JourneyLimits = ( output , context ) : JourneyLimits => { return { DailyCap : __expectInt32 ( output . DailyCap ) , EndpointReentryCap : __expectInt32 ( output . EndpointReentryCap ) , EndpointReentryInterval : __expectString ( output . EndpointReentryInterval ) , MessagesPerSecond : __expectInt32 ( output . MessagesPerSecond ) , } as any ; } ; const deserializeAws_restJson1JourneyPushMessage = ( output , context ) : JourneyPushMessage => { return { TimeToLive : __expectString ( output . TimeToLive ) , } as any ; } ; const deserializeAws_restJson1JourneyResponse = ( output , context ) : JourneyResponse => { return { Activities : output . Activities !== undefined && output . Activities !== null ? deserializeAws_restJson1MapOfActivity ( output . Activities , context ) : undefined , ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Id : __expectString ( output . Id ) , JourneyChannelSettings : output . JourneyChannelSettings !== undefined && output . JourneyChannelSettings !== null ? deserializeAws_restJson1JourneyChannelSettings ( output . JourneyChannelSettings , context ) : undefined , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Limits : output . Limits !== undefined && output . Limits !== null ? deserializeAws_restJson1JourneyLimits ( output . Limits , context ) : undefined , LocalTime : __expectBoolean ( output . LocalTime ) , Name : __expectString ( output . Name ) , QuietTime : output . QuietTime !== undefined && output . QuietTime !== null ? deserializeAws_restJson1QuietTime ( output . QuietTime , context ) : undefined , RefreshFrequency : __expectString ( output . RefreshFrequency ) , RefreshOnSegmentUpdate : __expectBoolean ( output . RefreshOnSegmentUpdate ) , Schedule : output . Schedule !== undefined && output . Schedule !== null ? deserializeAws_restJson1JourneySchedule ( output . Schedule , context ) : undefined , StartActivity : __expectString ( output . StartActivity ) , StartCondition : output . StartCondition !== undefined && output . StartCondition !== null ? deserializeAws_restJson1StartCondition ( output . StartCondition , context ) : undefined , State : __expectString ( output . State ) , WaitForQuietTime : __expectBoolean ( output . WaitForQuietTime ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1JourneySchedule = ( output , context ) : JourneySchedule => { return { EndTime : output . EndTime !== undefined && output . EndTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . EndTime ) ) : undefined , StartTime : output . StartTime !== undefined && output . StartTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . StartTime ) ) : undefined , Timezone : __expectString ( output . Timezone ) , } as any ; } ; const deserializeAws_restJson1JourneySMSMessage = ( output , context ) : JourneySMSMessage => { return { EntityId : __expectString ( output . EntityId ) , MessageType : __expectString ( output . MessageType ) , OriginationNumber : __expectString ( output . OriginationNumber ) , SenderId : __expectString ( output . SenderId ) , TemplateId : __expectString ( output . TemplateId ) , } as any ; } ; const deserializeAws_restJson1JourneysResponse = ( output , context ) : JourneysResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfJourneyResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1ListOf__EndpointTypesElement = ( output , context ) : ( __EndpointTypesElement | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ListOf__string = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1ListOfActivityResponse = ( output , context ) : ActivityResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ActivityResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfApplicationResponse = ( output , context ) : ApplicationResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ApplicationResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfCampaignResponse = ( output , context ) : CampaignResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CampaignResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfEndpointResponse = ( output , context ) : EndpointResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EndpointResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfExportJobResponse = ( output , context ) : ExportJobResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ExportJobResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfImportJobResponse = ( output , context ) : ImportJobResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ImportJobResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfInAppMessageCampaign = ( output , context ) : InAppMessageCampaign [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1InAppMessageCampaign ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfInAppMessageContent = ( output , context ) : InAppMessageContent [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1InAppMessageContent ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfJourneyResponse = ( output , context ) : JourneyResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1JourneyResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfMultiConditionalBranch = ( output , context ) : MultiConditionalBranch [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1MultiConditionalBranch ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRandomSplitEntry = ( output , context ) : RandomSplitEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RandomSplitEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfRecommenderConfigurationResponse = ( output , context ) : RecommenderConfigurationResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1RecommenderConfigurationResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfResultRow = ( output , context ) : ResultRow [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ResultRow ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfResultRowValue = ( output , context ) : ResultRowValue [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ResultRowValue ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSegmentDimensions = ( output , context ) : SegmentDimensions [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SegmentDimensions ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSegmentGroup = ( output , context ) : SegmentGroup [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SegmentGroup ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSegmentReference = ( output , context ) : SegmentReference [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SegmentReference ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSegmentResponse = ( output , context ) : SegmentResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SegmentResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfSimpleCondition = ( output , context ) : SimpleCondition [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SimpleCondition ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfTemplateResponse = ( output , context ) : TemplateResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TemplateResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfTemplateVersionResponse = ( output , context ) : TemplateVersionResponse [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TemplateVersionResponse ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListOfTreatmentResource = ( output , context ) : TreatmentResource [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TreatmentResource ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListRecommenderConfigurationsResponse = ( output , context ) : ListRecommenderConfigurationsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfRecommenderConfigurationResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1MapOf__double = ( output , context ) : { [ key ] : number ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __limitedParseDouble ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOf__integer = ( output , context ) : { [ key ] : number ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectInt32 ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOf__string = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfActivity = ( output , context ) : { [ key ] : Activity ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1Activity ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfAttributeDimension = ( output , context ) : { [ key ] : AttributeDimension ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1AttributeDimension ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfChannelResponse = ( output , context ) : { [ key ] : ChannelResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ChannelResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfEndpointMessageResult = ( output , context ) : { [ key ] : EndpointMessageResult ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1EndpointMessageResult ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfEventItemResponse = ( output , context ) : { [ key ] : EventItemResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1EventItemResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfItemResponse = ( output , context ) : { [ key ] : ItemResponse ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ItemResponse ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfListOf__string = ( output , context ) : { [ key ] : string [ ] ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ListOf__string ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMapOfEndpointMessageResult = ( output , context ) : { [ key ] : { [ key ] : EndpointMessageResult ; } ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MapOfEndpointMessageResult ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMessageResult = ( output , context ) : { [ key ] : MessageResult ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MessageResult ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1MapOfMetricDimension = ( output , context ) : { [ key ] : MetricDimension ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1MetricDimension ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1Message = ( output , context ) : Message => { return { Action : __expectString ( output . Action ) , Body : __expectString ( output . Body ) , ImageIconUrl : __expectString ( output . ImageIconUrl ) , ImageSmallIconUrl : __expectString ( output . ImageSmallIconUrl ) , ImageUrl : __expectString ( output . ImageUrl ) , JsonBody : __expectString ( output . JsonBody ) , MediaUrl : __expectString ( output . MediaUrl ) , RawContent : __expectString ( output . RawContent ) , SilentPush : __expectBoolean ( output . SilentPush ) , TimeToLive : __expectInt32 ( output . TimeToLive ) , Title : __expectString ( output . Title ) , Url : __expectString ( output . Url ) , } as any ; } ; const deserializeAws_restJson1MessageBody = ( output , context ) : MessageBody => { return { Message : __expectString ( output . Message ) , RequestID : __expectString ( output . RequestID ) , } as any ; } ; const deserializeAws_restJson1MessageConfiguration = ( output , context ) : MessageConfiguration => { return { ADMMessage : output . ADMMessage !== undefined && output . ADMMessage !== null ? deserializeAws_restJson1Message ( output . ADMMessage , context ) : undefined , APNSMessage : output . APNSMessage !== undefined && output . APNSMessage !== null ? deserializeAws_restJson1Message ( output . APNSMessage , context ) : undefined , BaiduMessage : output . BaiduMessage !== undefined && output . BaiduMessage !== null ? deserializeAws_restJson1Message ( output . BaiduMessage , context ) : undefined , CustomMessage : output . CustomMessage !== undefined && output . CustomMessage !== null ? deserializeAws_restJson1CampaignCustomMessage ( output . CustomMessage , context ) : undefined , DefaultMessage : output . DefaultMessage !== undefined && output . DefaultMessage !== null ? deserializeAws_restJson1Message ( output . DefaultMessage , context ) : undefined , EmailMessage : output . EmailMessage !== undefined && output . EmailMessage !== null ? deserializeAws_restJson1CampaignEmailMessage ( output . EmailMessage , context ) : undefined , GCMMessage : output . GCMMessage !== undefined && output . GCMMessage !== null ? deserializeAws_restJson1Message ( output . GCMMessage , context ) : undefined , InAppMessage : output . InAppMessage !== undefined && output . InAppMessage !== null ? deserializeAws_restJson1CampaignInAppMessage ( output . InAppMessage , context ) : undefined , SMSMessage : output . SMSMessage !== undefined && output . SMSMessage !== null ? deserializeAws_restJson1CampaignSmsMessage ( output . SMSMessage , context ) : undefined , } as any ; } ; const deserializeAws_restJson1MessageResponse = ( output , context ) : MessageResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , EndpointResult : output . EndpointResult !== undefined && output . EndpointResult !== null ? deserializeAws_restJson1MapOfEndpointMessageResult ( output . EndpointResult , context ) : undefined , RequestId : __expectString ( output . RequestId ) , Result : output . Result !== undefined && output . Result !== null ? deserializeAws_restJson1MapOfMessageResult ( output . Result , context ) : undefined , } as any ; } ; const deserializeAws_restJson1MessageResult = ( output , context ) : MessageResult => { return { DeliveryStatus : __expectString ( output . DeliveryStatus ) , MessageId : __expectString ( output . MessageId ) , StatusCode : __expectInt32 ( output . StatusCode ) , StatusMessage : __expectString ( output . StatusMessage ) , UpdatedToken : __expectString ( output . UpdatedToken ) , } as any ; } ; const deserializeAws_restJson1MetricDimension = ( output , context ) : MetricDimension => { return { ComparisonOperator : __expectString ( output . ComparisonOperator ) , Value : __limitedParseDouble ( output . Value ) , } as any ; } ; const deserializeAws_restJson1MultiConditionalBranch = ( output , context ) : MultiConditionalBranch => { return { Condition : output . Condition !== undefined && output . Condition !== null ? deserializeAws_restJson1SimpleCondition ( output . Condition , context ) : undefined , NextActivity : __expectString ( output . NextActivity ) , } as any ; } ; const deserializeAws_restJson1MultiConditionalSplitActivity = ( output , context ) : MultiConditionalSplitActivity => { return { Branches : output . Branches !== undefined && output . Branches !== null ? deserializeAws_restJson1ListOfMultiConditionalBranch ( output . Branches , context ) : undefined , DefaultActivity : __expectString ( output . DefaultActivity ) , EvaluationWaitTime : output . EvaluationWaitTime !== undefined && output . EvaluationWaitTime !== null ? deserializeAws_restJson1WaitTime ( output . EvaluationWaitTime , context ) : undefined , } as any ; } ; const deserializeAws_restJson1NumberValidateResponse = ( output , context ) : NumberValidateResponse => { return { Carrier : __expectString ( output . Carrier ) , City : __expectString ( output . City ) , CleansedPhoneNumberE164 : __expectString ( output . CleansedPhoneNumberE164 ) , CleansedPhoneNumberNational : __expectString ( output . CleansedPhoneNumberNational ) , Country : __expectString ( output . Country ) , CountryCodeIso2 : __expectString ( output . CountryCodeIso2 ) , CountryCodeNumeric : __expectString ( output . CountryCodeNumeric ) , County : __expectString ( output . County ) , OriginalCountryCodeIso2 : __expectString ( output . OriginalCountryCodeIso2 ) , OriginalPhoneNumber : __expectString ( output . OriginalPhoneNumber ) , PhoneType : __expectString ( output . PhoneType ) , PhoneTypeCode : __expectInt32 ( output . PhoneTypeCode ) , Timezone : __expectString ( output . Timezone ) , ZipCode : __expectString ( output . ZipCode ) , } as any ; } ; const deserializeAws_restJson1OverrideButtonConfiguration = ( output , context ) : OverrideButtonConfiguration => { return { ButtonAction : __expectString ( output . ButtonAction ) , Link : __expectString ( output . Link ) , } as any ; } ; const deserializeAws_restJson1PushMessageActivity = ( output , context ) : PushMessageActivity => { return { MessageConfig : output . MessageConfig !== undefined && output . MessageConfig !== null ? deserializeAws_restJson1JourneyPushMessage ( output . MessageConfig , context ) : undefined , NextActivity : __expectString ( output . NextActivity ) , TemplateName : __expectString ( output . TemplateName ) , TemplateVersion : __expectString ( output . TemplateVersion ) , } as any ; } ; const deserializeAws_restJson1PushNotificationTemplateResponse = ( output , context ) : PushNotificationTemplateResponse => { return { ADM : output . ADM !== undefined && output . ADM !== null ? deserializeAws_restJson1AndroidPushNotificationTemplate ( output . ADM , context ) : undefined , APNS : output . APNS !== undefined && output . APNS !== null ? deserializeAws_restJson1APNSPushNotificationTemplate ( output . APNS , context ) : undefined , Arn : __expectString ( output . Arn ) , Baidu : output . Baidu !== undefined && output . Baidu !== null ? deserializeAws_restJson1AndroidPushNotificationTemplate ( output . Baidu , context ) : undefined , CreationDate : __expectString ( output . CreationDate ) , Default : output . Default !== undefined && output . Default !== null ? deserializeAws_restJson1DefaultPushNotificationTemplate ( output . Default , context ) : undefined , DefaultSubstitutions : __expectString ( output . DefaultSubstitutions ) , GCM : output . GCM !== undefined && output . GCM !== null ? deserializeAws_restJson1AndroidPushNotificationTemplate ( output . GCM , context ) : undefined , LastModifiedDate : __expectString ( output . LastModifiedDate ) , RecommenderId : __expectString ( output . RecommenderId ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , Version : __expectString ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1QuietTime = ( output , context ) : QuietTime => { return { End : __expectString ( output . End ) , Start : __expectString ( output . Start ) , } as any ; } ; const deserializeAws_restJson1RandomSplitActivity = ( output , context ) : RandomSplitActivity => { return { Branches : output . Branches !== undefined && output . Branches !== null ? deserializeAws_restJson1ListOfRandomSplitEntry ( output . Branches , context ) : undefined , } as any ; } ; const deserializeAws_restJson1RandomSplitEntry = ( output , context ) : RandomSplitEntry => { return { NextActivity : __expectString ( output . NextActivity ) , Percentage : __expectInt32 ( output . Percentage ) , } as any ; } ; const deserializeAws_restJson1RecencyDimension = ( output , context ) : RecencyDimension => { return { Duration : __expectString ( output . Duration ) , RecencyType : __expectString ( output . RecencyType ) , } as any ; } ; const deserializeAws_restJson1RecommenderConfigurationResponse = ( output , context ) : RecommenderConfigurationResponse => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_restJson1MapOf__string ( output . Attributes , context ) : undefined , CreationDate : __expectString ( output . CreationDate ) , Description : __expectString ( output . Description ) , Id : __expectString ( output . Id ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Name : __expectString ( output . Name ) , RecommendationProviderIdType : __expectString ( output . RecommendationProviderIdType ) , RecommendationProviderRoleArn : __expectString ( output . RecommendationProviderRoleArn ) , RecommendationProviderUri : __expectString ( output . RecommendationProviderUri ) , RecommendationTransformerUri : __expectString ( output . RecommendationTransformerUri ) , RecommendationsDisplayName : __expectString ( output . RecommendationsDisplayName ) , RecommendationsPerMessage : __expectInt32 ( output . RecommendationsPerMessage ) , } as any ; } ; const deserializeAws_restJson1ResultRow = ( output , context ) : ResultRow => { return { GroupedBys : output . GroupedBys !== undefined && output . GroupedBys !== null ? deserializeAws_restJson1ListOfResultRowValue ( output . GroupedBys , context ) : undefined , Values : output . Values !== undefined && output . Values !== null ? deserializeAws_restJson1ListOfResultRowValue ( output . Values , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ResultRowValue = ( output , context ) : ResultRowValue => { return { Key : __expectString ( output . Key ) , Type : __expectString ( output . Type ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_restJson1Schedule = ( output , context ) : Schedule => { return { EndTime : __expectString ( output . EndTime ) , EventFilter : output . EventFilter !== undefined && output . EventFilter !== null ? deserializeAws_restJson1CampaignEventFilter ( output . EventFilter , context ) : undefined , Frequency : __expectString ( output . Frequency ) , IsLocalTime : __expectBoolean ( output . IsLocalTime ) , QuietTime : output . QuietTime !== undefined && output . QuietTime !== null ? deserializeAws_restJson1QuietTime ( output . QuietTime , context ) : undefined , StartTime : __expectString ( output . StartTime ) , Timezone : __expectString ( output . Timezone ) , } as any ; } ; const deserializeAws_restJson1SegmentBehaviors = ( output , context ) : SegmentBehaviors => { return { Recency : output . Recency !== undefined && output . Recency !== null ? deserializeAws_restJson1RecencyDimension ( output . Recency , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SegmentCondition = ( output , context ) : SegmentCondition => { return { SegmentId : __expectString ( output . SegmentId ) , } as any ; } ; const deserializeAws_restJson1SegmentDemographics = ( output , context ) : SegmentDemographics => { return { AppVersion : output . AppVersion !== undefined && output . AppVersion !== null ? deserializeAws_restJson1SetDimension ( output . AppVersion , context ) : undefined , Channel : output . Channel !== undefined && output . Channel !== null ? deserializeAws_restJson1SetDimension ( output . Channel , context ) : undefined , DeviceType : output . DeviceType !== undefined && output . DeviceType !== null ? deserializeAws_restJson1SetDimension ( output . DeviceType , context ) : undefined , Make : output . Make !== undefined && output . Make !== null ? deserializeAws_restJson1SetDimension ( output . Make , context ) : undefined , Model : output . Model !== undefined && output . Model !== null ? deserializeAws_restJson1SetDimension ( output . Model , context ) : undefined , Platform : output . Platform !== undefined && output . Platform !== null ? deserializeAws_restJson1SetDimension ( output . Platform , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SegmentDimensions = ( output , context ) : SegmentDimensions => { return { Attributes : output . Attributes !== undefined && output . Attributes !== null ? deserializeAws_restJson1MapOfAttributeDimension ( output . Attributes , context ) : undefined , Behavior : output . Behavior !== undefined && output . Behavior !== null ? deserializeAws_restJson1SegmentBehaviors ( output . Behavior , context ) : undefined , Demographic : output . Demographic !== undefined && output . Demographic !== null ? deserializeAws_restJson1SegmentDemographics ( output . Demographic , context ) : undefined , Location : output . Location !== undefined && output . Location !== null ? deserializeAws_restJson1SegmentLocation ( output . Location , context ) : undefined , Metrics : output . Metrics !== undefined && output . Metrics !== null ? deserializeAws_restJson1MapOfMetricDimension ( output . Metrics , context ) : undefined , UserAttributes : output . UserAttributes !== undefined && output . UserAttributes !== null ? deserializeAws_restJson1MapOfAttributeDimension ( output . UserAttributes , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SegmentGroup = ( output , context ) : SegmentGroup => { return { Dimensions : output . Dimensions !== undefined && output . Dimensions !== null ? deserializeAws_restJson1ListOfSegmentDimensions ( output . Dimensions , context ) : undefined , SourceSegments : output . SourceSegments !== undefined && output . SourceSegments !== null ? deserializeAws_restJson1ListOfSegmentReference ( output . SourceSegments , context ) : undefined , SourceType : __expectString ( output . SourceType ) , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_restJson1SegmentGroupList = ( output , context ) : SegmentGroupList => { return { Groups : output . Groups !== undefined && output . Groups !== null ? deserializeAws_restJson1ListOfSegmentGroup ( output . Groups , context ) : undefined , Include : __expectString ( output . Include ) , } as any ; } ; const deserializeAws_restJson1SegmentImportResource = ( output , context ) : SegmentImportResource => { return { ChannelCounts : output . ChannelCounts !== undefined && output . ChannelCounts !== null ? deserializeAws_restJson1MapOf__integer ( output . ChannelCounts , context ) : undefined , ExternalId : __expectString ( output . ExternalId ) , Format : __expectString ( output . Format ) , RoleArn : __expectString ( output . RoleArn ) , S3Url : __expectString ( output . S3Url ) , Size : __expectInt32 ( output . Size ) , } as any ; } ; const deserializeAws_restJson1SegmentLocation = ( output , context ) : SegmentLocation => { return { Country : output . Country !== undefined && output . Country !== null ? deserializeAws_restJson1SetDimension ( output . Country , context ) : undefined , GPSPoint : output . GPSPoint !== undefined && output . GPSPoint !== null ? deserializeAws_restJson1GPSPointDimension ( output . GPSPoint , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SegmentReference = ( output , context ) : SegmentReference => { return { Id : __expectString ( output . Id ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1SegmentResponse = ( output , context ) : SegmentResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , Arn : __expectString ( output . Arn ) , CreationDate : __expectString ( output . CreationDate ) , Dimensions : output . Dimensions !== undefined && output . Dimensions !== null ? deserializeAws_restJson1SegmentDimensions ( output . Dimensions , context ) : undefined , Id : __expectString ( output . Id ) , ImportDefinition : output . ImportDefinition !== undefined && output . ImportDefinition !== null ? deserializeAws_restJson1SegmentImportResource ( output . ImportDefinition , context ) : undefined , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Name : __expectString ( output . Name ) , SegmentGroups : output . SegmentGroups !== undefined && output . SegmentGroups !== null ? deserializeAws_restJson1SegmentGroupList ( output . SegmentGroups , context ) : undefined , SegmentType : __expectString ( output . SegmentType ) , Version : __expectInt32 ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SegmentsResponse = ( output , context ) : SegmentsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfSegmentResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1SendUsersMessageResponse = ( output , context ) : SendUsersMessageResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , RequestId : __expectString ( output . RequestId ) , Result : output . Result !== undefined && output . Result !== null ? deserializeAws_restJson1MapOfMapOfEndpointMessageResult ( output . Result , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SetDimension = ( output , context ) : SetDimension => { return { DimensionType : __expectString ( output . DimensionType ) , Values : output . Values !== undefined && output . Values !== null ? deserializeAws_restJson1ListOf__string ( output . Values , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SimpleCondition = ( output , context ) : SimpleCondition => { return { EventCondition : output . EventCondition !== undefined && output . EventCondition !== null ? deserializeAws_restJson1EventCondition ( output . EventCondition , context ) : undefined , SegmentCondition : output . SegmentCondition !== undefined && output . SegmentCondition !== null ? deserializeAws_restJson1SegmentCondition ( output . SegmentCondition , context ) : undefined , SegmentDimensions : output . segmentDimensions !== undefined && output . segmentDimensions !== null ? deserializeAws_restJson1SegmentDimensions ( output . segmentDimensions , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SMSChannelResponse = ( output , context ) : SMSChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , PromotionalMessagesPerSecond : __expectInt32 ( output . PromotionalMessagesPerSecond ) , SenderId : __expectString ( output . SenderId ) , ShortCode : __expectString ( output . ShortCode ) , TransactionalMessagesPerSecond : __expectInt32 ( output . TransactionalMessagesPerSecond ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1SMSMessageActivity = ( output , context ) : SMSMessageActivity => { return { MessageConfig : output . MessageConfig !== undefined && output . MessageConfig !== null ? deserializeAws_restJson1JourneySMSMessage ( output . MessageConfig , context ) : undefined , NextActivity : __expectString ( output . NextActivity ) , TemplateName : __expectString ( output . TemplateName ) , TemplateVersion : __expectString ( output . TemplateVersion ) , } as any ; } ; const deserializeAws_restJson1SMSTemplateResponse = ( output , context ) : SMSTemplateResponse => { return { Arn : __expectString ( output . Arn ) , Body : __expectString ( output . Body ) , CreationDate : __expectString ( output . CreationDate ) , DefaultSubstitutions : __expectString ( output . DefaultSubstitutions ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , RecommenderId : __expectString ( output . RecommenderId ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , Version : __expectString ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1StartCondition = ( output , context ) : StartCondition => { return { Description : __expectString ( output . Description ) , EventStartCondition : output . EventStartCondition !== undefined && output . EventStartCondition !== null ? deserializeAws_restJson1EventStartCondition ( output . EventStartCondition , context ) : undefined , SegmentStartCondition : output . SegmentStartCondition !== undefined && output . SegmentStartCondition !== null ? deserializeAws_restJson1SegmentCondition ( output . SegmentStartCondition , context ) : undefined , } as any ; } ; const deserializeAws_restJson1TagsModel = ( output , context ) : TagsModel => { return { tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Template = ( output , context ) : Template => { return { Name : __expectString ( output . Name ) , Version : __expectString ( output . Version ) , } as any ; } ; const deserializeAws_restJson1TemplateConfiguration = ( output , context ) : TemplateConfiguration => { return { EmailTemplate : output . EmailTemplate !== undefined && output . EmailTemplate !== null ? deserializeAws_restJson1Template ( output . EmailTemplate , context ) : undefined , PushTemplate : output . PushTemplate !== undefined && output . PushTemplate !== null ? deserializeAws_restJson1Template ( output . PushTemplate , context ) : undefined , SMSTemplate : output . SMSTemplate !== undefined && output . SMSTemplate !== null ? deserializeAws_restJson1Template ( output . SMSTemplate , context ) : undefined , VoiceTemplate : output . VoiceTemplate !== undefined && output . VoiceTemplate !== null ? deserializeAws_restJson1Template ( output . VoiceTemplate , context ) : undefined , } as any ; } ; const deserializeAws_restJson1TemplateCreateMessageBody = ( output , context ) : TemplateCreateMessageBody => { return { Arn : __expectString ( output . Arn ) , Message : __expectString ( output . Message ) , RequestID : __expectString ( output . RequestID ) , } as any ; } ; const deserializeAws_restJson1TemplateResponse = ( output , context ) : TemplateResponse => { return { Arn : __expectString ( output . Arn ) , CreationDate : __expectString ( output . CreationDate ) , DefaultSubstitutions : __expectString ( output . DefaultSubstitutions ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , Version : __expectString ( output . Version ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1TemplatesResponse = ( output , context ) : TemplatesResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfTemplateResponse ( output . Item , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_restJson1TemplateVersionResponse = ( output , context ) : TemplateVersionResponse => { return { CreationDate : __expectString ( output . CreationDate ) , DefaultSubstitutions : __expectString ( output . DefaultSubstitutions ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , Version : __expectString ( output . Version ) , } as any ; } ; const deserializeAws_restJson1TemplateVersionsResponse = ( output , context ) : TemplateVersionsResponse => { return { Item : output . Item !== undefined && output . Item !== null ? deserializeAws_restJson1ListOfTemplateVersionResponse ( output . Item , context ) : undefined , Message : __expectString ( output . Message ) , NextToken : __expectString ( output . NextToken ) , RequestID : __expectString ( output . RequestID ) , } as any ; } ; const deserializeAws_restJson1TreatmentResource = ( output , context ) : TreatmentResource => { return { CustomDeliveryConfiguration : output . CustomDeliveryConfiguration !== undefined && output . CustomDeliveryConfiguration !== null ? deserializeAws_restJson1CustomDeliveryConfiguration ( output . CustomDeliveryConfiguration , context ) : undefined , Id : __expectString ( output . Id ) , MessageConfiguration : output . MessageConfiguration !== undefined && output . MessageConfiguration !== null ? deserializeAws_restJson1MessageConfiguration ( output . MessageConfiguration , context ) : undefined , Schedule : output . Schedule !== undefined && output . Schedule !== null ? deserializeAws_restJson1Schedule ( output . Schedule , context ) : undefined , SizePercent : __expectInt32 ( output . SizePercent ) , State : output . State !== undefined && output . State !== null ? deserializeAws_restJson1CampaignState ( output . State , context ) : undefined , TemplateConfiguration : output . TemplateConfiguration !== undefined && output . TemplateConfiguration !== null ? deserializeAws_restJson1TemplateConfiguration ( output . TemplateConfiguration , context ) : undefined , TreatmentDescription : __expectString ( output . TreatmentDescription ) , TreatmentName : __expectString ( output . TreatmentName ) , } as any ; } ; const deserializeAws_restJson1VerificationResponse = ( output , context ) : VerificationResponse => { return { Valid : __expectBoolean ( output . Valid ) , } as any ; } ; const deserializeAws_restJson1VoiceChannelResponse = ( output , context ) : VoiceChannelResponse => { return { ApplicationId : __expectString ( output . ApplicationId ) , CreationDate : __expectString ( output . CreationDate ) , Enabled : __expectBoolean ( output . Enabled ) , HasCredential : __expectBoolean ( output . HasCredential ) , Id : __expectString ( output . Id ) , IsArchived : __expectBoolean ( output . IsArchived ) , LastModifiedBy : __expectString ( output . LastModifiedBy ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , Platform : __expectString ( output . Platform ) , Version : __expectInt32 ( output . Version ) , } as any ; } ; const deserializeAws_restJson1VoiceTemplateResponse = ( output , context ) : VoiceTemplateResponse => { return { Arn : __expectString ( output . Arn ) , Body : __expectString ( output . Body ) , CreationDate : __expectString ( output . CreationDate ) , DefaultSubstitutions : __expectString ( output . DefaultSubstitutions ) , LanguageCode : __expectString ( output . LanguageCode ) , LastModifiedDate : __expectString ( output . LastModifiedDate ) , TemplateDescription : __expectString ( output . TemplateDescription ) , TemplateName : __expectString ( output . TemplateName ) , TemplateType : __expectString ( output . TemplateType ) , Version : __expectString ( output . Version ) , VoiceId : __expectString ( output . VoiceId ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1MapOf__string ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1WaitActivity = ( output , context ) : WaitActivity => { return { NextActivity : __expectString ( output . NextActivity ) , WaitTime : output . WaitTime !== undefined && output . WaitTime !== null ? deserializeAws_restJson1WaitTime ( output . WaitTime , context ) : undefined , } as any ; } ; const deserializeAws_restJson1WaitTime = ( output , context ) : WaitTime => { return { WaitFor : __expectString ( output . WaitFor ) , WaitUntil : __expectString ( output . WaitUntil ) , } 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 "" ; } ;