import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectString as __expectString , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , HeaderBag as __HeaderBag , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { AcceptQualificationRequestCommandInput , AcceptQualificationRequestCommandOutput , } from "../commands/AcceptQualificationRequestCommand" ; import { ApproveAssignmentCommandInput , ApproveAssignmentCommandOutput } from "../commands/ApproveAssignmentCommand" ; import { AssociateQualificationWithWorkerCommandInput , AssociateQualificationWithWorkerCommandOutput , } from "../commands/AssociateQualificationWithWorkerCommand" ; import { CreateAdditionalAssignmentsForHITCommandInput , CreateAdditionalAssignmentsForHITCommandOutput , } from "../commands/CreateAdditionalAssignmentsForHITCommand" ; import { CreateHITCommandInput , CreateHITCommandOutput } from "../commands/CreateHITCommand" ; import { CreateHITTypeCommandInput , CreateHITTypeCommandOutput } from "../commands/CreateHITTypeCommand" ; import { CreateHITWithHITTypeCommandInput , CreateHITWithHITTypeCommandOutput , } from "../commands/CreateHITWithHITTypeCommand" ; import { CreateQualificationTypeCommandInput , CreateQualificationTypeCommandOutput , } from "../commands/CreateQualificationTypeCommand" ; import { CreateWorkerBlockCommandInput , CreateWorkerBlockCommandOutput } from "../commands/CreateWorkerBlockCommand" ; import { DeleteHITCommandInput , DeleteHITCommandOutput } from "../commands/DeleteHITCommand" ; import { DeleteQualificationTypeCommandInput , DeleteQualificationTypeCommandOutput , } from "../commands/DeleteQualificationTypeCommand" ; import { DeleteWorkerBlockCommandInput , DeleteWorkerBlockCommandOutput } from "../commands/DeleteWorkerBlockCommand" ; import { DisassociateQualificationFromWorkerCommandInput , DisassociateQualificationFromWorkerCommandOutput , } from "../commands/DisassociateQualificationFromWorkerCommand" ; import { GetAccountBalanceCommandInput , GetAccountBalanceCommandOutput } from "../commands/GetAccountBalanceCommand" ; import { GetAssignmentCommandInput , GetAssignmentCommandOutput } from "../commands/GetAssignmentCommand" ; import { GetFileUploadURLCommandInput , GetFileUploadURLCommandOutput } from "../commands/GetFileUploadURLCommand" ; import { GetHITCommandInput , GetHITCommandOutput } from "../commands/GetHITCommand" ; import { GetQualificationScoreCommandInput , GetQualificationScoreCommandOutput , } from "../commands/GetQualificationScoreCommand" ; import { GetQualificationTypeCommandInput , GetQualificationTypeCommandOutput , } from "../commands/GetQualificationTypeCommand" ; import { ListAssignmentsForHITCommandInput , ListAssignmentsForHITCommandOutput , } from "../commands/ListAssignmentsForHITCommand" ; import { ListBonusPaymentsCommandInput , ListBonusPaymentsCommandOutput } from "../commands/ListBonusPaymentsCommand" ; import { ListHITsCommandInput , ListHITsCommandOutput } from "../commands/ListHITsCommand" ; import { ListHITsForQualificationTypeCommandInput , ListHITsForQualificationTypeCommandOutput , } from "../commands/ListHITsForQualificationTypeCommand" ; import { ListQualificationRequestsCommandInput , ListQualificationRequestsCommandOutput , } from "../commands/ListQualificationRequestsCommand" ; import { ListQualificationTypesCommandInput , ListQualificationTypesCommandOutput , } from "../commands/ListQualificationTypesCommand" ; import { ListReviewableHITsCommandInput , ListReviewableHITsCommandOutput } from "../commands/ListReviewableHITsCommand" ; import { ListReviewPolicyResultsForHITCommandInput , ListReviewPolicyResultsForHITCommandOutput , } from "../commands/ListReviewPolicyResultsForHITCommand" ; import { ListWorkerBlocksCommandInput , ListWorkerBlocksCommandOutput } from "../commands/ListWorkerBlocksCommand" ; import { ListWorkersWithQualificationTypeCommandInput , ListWorkersWithQualificationTypeCommandOutput , } from "../commands/ListWorkersWithQualificationTypeCommand" ; import { NotifyWorkersCommandInput , NotifyWorkersCommandOutput } from "../commands/NotifyWorkersCommand" ; import { RejectAssignmentCommandInput , RejectAssignmentCommandOutput } from "../commands/RejectAssignmentCommand" ; import { RejectQualificationRequestCommandInput , RejectQualificationRequestCommandOutput , } from "../commands/RejectQualificationRequestCommand" ; import { SendBonusCommandInput , SendBonusCommandOutput } from "../commands/SendBonusCommand" ; import { SendTestEventNotificationCommandInput , SendTestEventNotificationCommandOutput , } from "../commands/SendTestEventNotificationCommand" ; import { UpdateExpirationForHITCommandInput , UpdateExpirationForHITCommandOutput , } from "../commands/UpdateExpirationForHITCommand" ; import { UpdateHITReviewStatusCommandInput , UpdateHITReviewStatusCommandOutput , } from "../commands/UpdateHITReviewStatusCommand" ; import { UpdateHITTypeOfHITCommandInput , UpdateHITTypeOfHITCommandOutput } from "../commands/UpdateHITTypeOfHITCommand" ; import { UpdateNotificationSettingsCommandInput , UpdateNotificationSettingsCommandOutput , } from "../commands/UpdateNotificationSettingsCommand" ; import { UpdateQualificationTypeCommandInput , UpdateQualificationTypeCommandOutput , } from "../commands/UpdateQualificationTypeCommand" ; import { AcceptQualificationRequestRequest , AcceptQualificationRequestResponse , ApproveAssignmentRequest , ApproveAssignmentResponse , Assignment , AssignmentStatus , AssociateQualificationWithWorkerRequest , AssociateQualificationWithWorkerResponse , BonusPayment , CreateAdditionalAssignmentsForHITRequest , CreateAdditionalAssignmentsForHITResponse , CreateHITRequest , CreateHITResponse , CreateHITTypeRequest , CreateHITTypeResponse , CreateHITWithHITTypeRequest , CreateHITWithHITTypeResponse , CreateQualificationTypeRequest , CreateQualificationTypeResponse , CreateWorkerBlockRequest , CreateWorkerBlockResponse , DeleteHITRequest , DeleteHITResponse , DeleteQualificationTypeRequest , DeleteQualificationTypeResponse , DeleteWorkerBlockRequest , DeleteWorkerBlockResponse , DisassociateQualificationFromWorkerRequest , DisassociateQualificationFromWorkerResponse , EventType , GetAccountBalanceRequest , GetAccountBalanceResponse , GetAssignmentRequest , GetAssignmentResponse , GetFileUploadURLRequest , GetFileUploadURLResponse , GetHITRequest , GetHITResponse , GetQualificationScoreRequest , GetQualificationScoreResponse , GetQualificationTypeRequest , GetQualificationTypeResponse , HIT , HITLayoutParameter , ListAssignmentsForHITRequest , ListAssignmentsForHITResponse , ListBonusPaymentsRequest , ListBonusPaymentsResponse , ListHITsForQualificationTypeRequest , ListHITsForQualificationTypeResponse , ListHITsRequest , ListHITsResponse , ListQualificationRequestsRequest , ListQualificationRequestsResponse , ListQualificationTypesRequest , ListQualificationTypesResponse , ListReviewableHITsRequest , ListReviewableHITsResponse , ListReviewPolicyResultsForHITRequest , ListReviewPolicyResultsForHITResponse , ListWorkerBlocksRequest , ListWorkerBlocksResponse , ListWorkersWithQualificationTypeRequest , ListWorkersWithQualificationTypeResponse , Locale , NotificationSpecification , NotifyWorkersFailureStatus , NotifyWorkersRequest , NotifyWorkersResponse , ParameterMapEntry , PolicyParameter , Qualification , QualificationRequest , QualificationRequirement , QualificationType , RejectAssignmentRequest , RejectAssignmentResponse , RejectQualificationRequestRequest , RejectQualificationRequestResponse , RequestError , ReviewActionDetail , ReviewPolicy , ReviewPolicyLevel , ReviewReport , ReviewResultDetail , SendBonusRequest , SendBonusResponse , SendTestEventNotificationRequest , SendTestEventNotificationResponse , ServiceFault , UpdateExpirationForHITRequest , UpdateExpirationForHITResponse , UpdateHITReviewStatusRequest , UpdateHITReviewStatusResponse , UpdateHITTypeOfHITRequest , UpdateHITTypeOfHITResponse , UpdateNotificationSettingsRequest , UpdateNotificationSettingsResponse , UpdateQualificationTypeRequest , UpdateQualificationTypeResponse , WorkerBlock , } from "../models/models_0" ; export const serializeAws_json1_1AcceptQualificationRequestCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.AcceptQualificationRequest" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AcceptQualificationRequestRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ApproveAssignmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ApproveAssignment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ApproveAssignmentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1AssociateQualificationWithWorkerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.AssociateQualificationWithWorker" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1AssociateQualificationWithWorkerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateAdditionalAssignmentsForHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.CreateAdditionalAssignmentsForHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateAdditionalAssignmentsForHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.CreateHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateHITTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.CreateHITType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateHITTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateHITWithHITTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.CreateHITWithHITType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateHITWithHITTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateQualificationTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.CreateQualificationType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateQualificationTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateWorkerBlockCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.CreateWorkerBlock" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateWorkerBlockRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.DeleteHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteQualificationTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.DeleteQualificationType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteQualificationTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteWorkerBlockCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.DeleteWorkerBlock" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteWorkerBlockRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DisassociateQualificationFromWorkerCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.DisassociateQualificationFromWorker" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DisassociateQualificationFromWorkerRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetAccountBalanceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.GetAccountBalance" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetAccountBalanceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetAssignmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.GetAssignment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetAssignmentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetFileUploadURLCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.GetFileUploadURL" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetFileUploadURLRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.GetHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetQualificationScoreCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.GetQualificationScore" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetQualificationScoreRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetQualificationTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.GetQualificationType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetQualificationTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListAssignmentsForHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListAssignmentsForHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListAssignmentsForHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListBonusPaymentsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListBonusPayments" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListBonusPaymentsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListHITsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListHITs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListHITsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListHITsForQualificationTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListHITsForQualificationType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListHITsForQualificationTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListQualificationRequestsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListQualificationRequests" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListQualificationRequestsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListQualificationTypesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListQualificationTypes" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListQualificationTypesRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListReviewableHITsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListReviewableHITs" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListReviewableHITsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListReviewPolicyResultsForHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListReviewPolicyResultsForHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListReviewPolicyResultsForHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListWorkerBlocksCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListWorkerBlocks" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListWorkerBlocksRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListWorkersWithQualificationTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.ListWorkersWithQualificationType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListWorkersWithQualificationTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1NotifyWorkersCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.NotifyWorkers" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1NotifyWorkersRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RejectAssignmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.RejectAssignment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RejectAssignmentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1RejectQualificationRequestCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.RejectQualificationRequest" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1RejectQualificationRequestRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SendBonusCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.SendBonus" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SendBonusRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SendTestEventNotificationCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.SendTestEventNotification" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SendTestEventNotificationRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateExpirationForHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.UpdateExpirationForHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateExpirationForHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateHITReviewStatusCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.UpdateHITReviewStatus" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateHITReviewStatusRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateHITTypeOfHITCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.UpdateHITTypeOfHIT" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateHITTypeOfHITRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateNotificationSettingsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.UpdateNotificationSettings" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateNotificationSettingsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateQualificationTypeCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "MTurkRequesterServiceV20170117.UpdateQualificationType" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateQualificationTypeRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1AcceptQualificationRequestCommand = async ( output , context ) : Promise < AcceptQualificationRequestCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AcceptQualificationRequestCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1AcceptQualificationRequestResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AcceptQualificationRequestCommandError = async ( output , context ) : Promise < AcceptQualificationRequestCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ApproveAssignmentCommand = async ( output , context ) : Promise < ApproveAssignmentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ApproveAssignmentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ApproveAssignmentResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ApproveAssignmentCommandError = async ( output , context ) : Promise < ApproveAssignmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1AssociateQualificationWithWorkerCommand = async ( output , context ) : Promise < AssociateQualificationWithWorkerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1AssociateQualificationWithWorkerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1AssociateQualificationWithWorkerResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1AssociateQualificationWithWorkerCommandError = async ( output , context ) : Promise < AssociateQualificationWithWorkerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1CreateAdditionalAssignmentsForHITCommand = async ( output , context ) : Promise < CreateAdditionalAssignmentsForHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateAdditionalAssignmentsForHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateAdditionalAssignmentsForHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateAdditionalAssignmentsForHITCommandError = async ( output , context ) : Promise < CreateAdditionalAssignmentsForHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1CreateHITCommand = async ( output , context ) : Promise < CreateHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateHITCommandError = async ( output , context ) : Promise < CreateHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1CreateHITTypeCommand = async ( output , context ) : Promise < CreateHITTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateHITTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateHITTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateHITTypeCommandError = async ( output , context ) : Promise < CreateHITTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1CreateHITWithHITTypeCommand = async ( output , context ) : Promise < CreateHITWithHITTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateHITWithHITTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateHITWithHITTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateHITWithHITTypeCommandError = async ( output , context ) : Promise < CreateHITWithHITTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1CreateQualificationTypeCommand = async ( output , context ) : Promise < CreateQualificationTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateQualificationTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateQualificationTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateQualificationTypeCommandError = async ( output , context ) : Promise < CreateQualificationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1CreateWorkerBlockCommand = async ( output , context ) : Promise < CreateWorkerBlockCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateWorkerBlockCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateWorkerBlockResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateWorkerBlockCommandError = async ( output , context ) : Promise < CreateWorkerBlockCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1DeleteHITCommand = async ( output , context ) : Promise < DeleteHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteHITCommandError = async ( output , context ) : Promise < DeleteHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1DeleteQualificationTypeCommand = async ( output , context ) : Promise < DeleteQualificationTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteQualificationTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteQualificationTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteQualificationTypeCommandError = async ( output , context ) : Promise < DeleteQualificationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1DeleteWorkerBlockCommand = async ( output , context ) : Promise < DeleteWorkerBlockCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteWorkerBlockCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteWorkerBlockResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteWorkerBlockCommandError = async ( output , context ) : Promise < DeleteWorkerBlockCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1DisassociateQualificationFromWorkerCommand = async ( output , context ) : Promise < DisassociateQualificationFromWorkerCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DisassociateQualificationFromWorkerCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DisassociateQualificationFromWorkerResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DisassociateQualificationFromWorkerCommandError = async ( output , context ) : Promise < DisassociateQualificationFromWorkerCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1GetAccountBalanceCommand = async ( output , context ) : Promise < GetAccountBalanceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetAccountBalanceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetAccountBalanceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetAccountBalanceCommandError = async ( output , context ) : Promise < GetAccountBalanceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1GetAssignmentCommand = async ( output , context ) : Promise < GetAssignmentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetAssignmentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetAssignmentResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetAssignmentCommandError = async ( output , context ) : Promise < GetAssignmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1GetFileUploadURLCommand = async ( output , context ) : Promise < GetFileUploadURLCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetFileUploadURLCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetFileUploadURLResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetFileUploadURLCommandError = async ( output , context ) : Promise < GetFileUploadURLCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1GetHITCommand = async ( output , context ) : Promise < GetHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetHITCommandError = async ( output , context ) : Promise < GetHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1GetQualificationScoreCommand = async ( output , context ) : Promise < GetQualificationScoreCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetQualificationScoreCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetQualificationScoreResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetQualificationScoreCommandError = async ( output , context ) : Promise < GetQualificationScoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1GetQualificationTypeCommand = async ( output , context ) : Promise < GetQualificationTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetQualificationTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetQualificationTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetQualificationTypeCommandError = async ( output , context ) : Promise < GetQualificationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListAssignmentsForHITCommand = async ( output , context ) : Promise < ListAssignmentsForHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListAssignmentsForHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListAssignmentsForHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListAssignmentsForHITCommandError = async ( output , context ) : Promise < ListAssignmentsForHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListBonusPaymentsCommand = async ( output , context ) : Promise < ListBonusPaymentsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListBonusPaymentsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListBonusPaymentsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListBonusPaymentsCommandError = async ( output , context ) : Promise < ListBonusPaymentsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListHITsCommand = async ( output , context ) : Promise < ListHITsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListHITsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListHITsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListHITsCommandError = async ( output , context ) : Promise < ListHITsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListHITsForQualificationTypeCommand = async ( output , context ) : Promise < ListHITsForQualificationTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListHITsForQualificationTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListHITsForQualificationTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListHITsForQualificationTypeCommandError = async ( output , context ) : Promise < ListHITsForQualificationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListQualificationRequestsCommand = async ( output , context ) : Promise < ListQualificationRequestsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListQualificationRequestsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListQualificationRequestsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListQualificationRequestsCommandError = async ( output , context ) : Promise < ListQualificationRequestsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListQualificationTypesCommand = async ( output , context ) : Promise < ListQualificationTypesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListQualificationTypesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListQualificationTypesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListQualificationTypesCommandError = async ( output , context ) : Promise < ListQualificationTypesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListReviewableHITsCommand = async ( output , context ) : Promise < ListReviewableHITsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListReviewableHITsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListReviewableHITsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListReviewableHITsCommandError = async ( output , context ) : Promise < ListReviewableHITsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListReviewPolicyResultsForHITCommand = async ( output , context ) : Promise < ListReviewPolicyResultsForHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListReviewPolicyResultsForHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListReviewPolicyResultsForHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListReviewPolicyResultsForHITCommandError = async ( output , context ) : Promise < ListReviewPolicyResultsForHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListWorkerBlocksCommand = async ( output , context ) : Promise < ListWorkerBlocksCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListWorkerBlocksCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListWorkerBlocksResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListWorkerBlocksCommandError = async ( output , context ) : Promise < ListWorkerBlocksCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1ListWorkersWithQualificationTypeCommand = async ( output , context ) : Promise < ListWorkersWithQualificationTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListWorkersWithQualificationTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListWorkersWithQualificationTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListWorkersWithQualificationTypeCommandError = async ( output , context ) : Promise < ListWorkersWithQualificationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1NotifyWorkersCommand = async ( output , context ) : Promise < NotifyWorkersCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1NotifyWorkersCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1NotifyWorkersResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1NotifyWorkersCommandError = async ( output , context ) : Promise < NotifyWorkersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1RejectAssignmentCommand = async ( output , context ) : Promise < RejectAssignmentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RejectAssignmentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RejectAssignmentResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RejectAssignmentCommandError = async ( output , context ) : Promise < RejectAssignmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1RejectQualificationRequestCommand = async ( output , context ) : Promise < RejectQualificationRequestCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1RejectQualificationRequestCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1RejectQualificationRequestResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1RejectQualificationRequestCommandError = async ( output , context ) : Promise < RejectQualificationRequestCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1SendBonusCommand = async ( output , context ) : Promise < SendBonusCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SendBonusCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1SendBonusResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SendBonusCommandError = async ( output , context ) : Promise < SendBonusCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1SendTestEventNotificationCommand = async ( output , context ) : Promise < SendTestEventNotificationCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SendTestEventNotificationCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1SendTestEventNotificationResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SendTestEventNotificationCommandError = async ( output , context ) : Promise < SendTestEventNotificationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1UpdateExpirationForHITCommand = async ( output , context ) : Promise < UpdateExpirationForHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateExpirationForHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateExpirationForHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateExpirationForHITCommandError = async ( output , context ) : Promise < UpdateExpirationForHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1UpdateHITReviewStatusCommand = async ( output , context ) : Promise < UpdateHITReviewStatusCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateHITReviewStatusCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateHITReviewStatusResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateHITReviewStatusCommandError = async ( output , context ) : Promise < UpdateHITReviewStatusCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1UpdateHITTypeOfHITCommand = async ( output , context ) : Promise < UpdateHITTypeOfHITCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateHITTypeOfHITCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateHITTypeOfHITResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateHITTypeOfHITCommandError = async ( output , context ) : Promise < UpdateHITTypeOfHITCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1UpdateNotificationSettingsCommand = async ( output , context ) : Promise < UpdateNotificationSettingsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateNotificationSettingsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateNotificationSettingsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateNotificationSettingsCommandError = async ( output , context ) : Promise < UpdateNotificationSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1UpdateQualificationTypeCommand = async ( output , context ) : Promise < UpdateQualificationTypeCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateQualificationTypeCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateQualificationTypeResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateQualificationTypeCommandError = async ( output , context ) : Promise < UpdateQualificationTypeCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "RequestError" : case "com.amazonaws.mturk#RequestError" : response = { ... ( await deserializeAws_json1_1RequestErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceFault" : case "com.amazonaws.mturk#ServiceFault" : response = { ... ( await deserializeAws_json1_1ServiceFaultResponse ( 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_json1_1RequestErrorResponse = async ( parsedOutput , context ) : Promise < RequestError > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1RequestError ( body , context ) ; const contents = { name : "RequestError" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ServiceFaultResponse = async ( parsedOutput , context ) : Promise < ServiceFault > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ServiceFault ( body , context ) ; const contents = { name : "ServiceFault" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1AcceptQualificationRequestRequest = ( input , context ) : any => { return { ... ( input . IntegerValue !== undefined && input . IntegerValue !== null && { IntegerValue : input . IntegerValue } ) , ... ( input . QualificationRequestId !== undefined && input . QualificationRequestId !== null && { QualificationRequestId : input . QualificationRequestId } ) , } ; } ; const serializeAws_json1_1ApproveAssignmentRequest = ( input , context ) : any => { return { ... ( input . AssignmentId !== undefined && input . AssignmentId !== null && { AssignmentId : input . AssignmentId } ) , ... ( input . OverrideRejection !== undefined && input . OverrideRejection !== null && { OverrideRejection : input . OverrideRejection } ) , ... ( input . RequesterFeedback !== undefined && input . RequesterFeedback !== null && { RequesterFeedback : input . RequesterFeedback } ) , } ; } ; const serializeAws_json1_1AssignmentStatusList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1AssociateQualificationWithWorkerRequest = ( input , context ) : any => { return { ... ( input . IntegerValue !== undefined && input . IntegerValue !== null && { IntegerValue : input . IntegerValue } ) , ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , ... ( input . SendNotification !== undefined && input . SendNotification !== null && { SendNotification : input . SendNotification } ) , ... ( input . WorkerId !== undefined && input . WorkerId !== null && { WorkerId : input . WorkerId } ) , } ; } ; const serializeAws_json1_1CreateAdditionalAssignmentsForHITRequest = ( input , context ) : any => { return { ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , ... ( input . NumberOfAdditionalAssignments !== undefined && input . NumberOfAdditionalAssignments !== null && { NumberOfAdditionalAssignments : input . NumberOfAdditionalAssignments , } ) , ... ( input . UniqueRequestToken !== undefined && input . UniqueRequestToken !== null && { UniqueRequestToken : input . UniqueRequestToken } ) , } ; } ; const serializeAws_json1_1CreateHITRequest = ( input , context ) : any => { return { ... ( input . AssignmentDurationInSeconds !== undefined && input . AssignmentDurationInSeconds !== null && { AssignmentDurationInSeconds : input . AssignmentDurationInSeconds } ) , ... ( input . AssignmentReviewPolicy !== undefined && input . AssignmentReviewPolicy !== null && { AssignmentReviewPolicy : serializeAws_json1_1ReviewPolicy ( input . AssignmentReviewPolicy , context ) , } ) , ... ( input . AutoApprovalDelayInSeconds !== undefined && input . AutoApprovalDelayInSeconds !== null && { AutoApprovalDelayInSeconds : input . AutoApprovalDelayInSeconds } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . HITLayoutId !== undefined && input . HITLayoutId !== null && { HITLayoutId : input . HITLayoutId } ) , ... ( input . HITLayoutParameters !== undefined && input . HITLayoutParameters !== null && { HITLayoutParameters : serializeAws_json1_1HITLayoutParameterList ( input . HITLayoutParameters , context ) , } ) , ... ( input . HITReviewPolicy !== undefined && input . HITReviewPolicy !== null && { HITReviewPolicy : serializeAws_json1_1ReviewPolicy ( input . HITReviewPolicy , context ) , } ) , ... ( input . Keywords !== undefined && input . Keywords !== null && { Keywords : input . Keywords } ) , ... ( input . LifetimeInSeconds !== undefined && input . LifetimeInSeconds !== null && { LifetimeInSeconds : input . LifetimeInSeconds } ) , ... ( input . MaxAssignments !== undefined && input . MaxAssignments !== null && { MaxAssignments : input . MaxAssignments } ) , ... ( input . QualificationRequirements !== undefined && input . QualificationRequirements !== null && { QualificationRequirements : serializeAws_json1_1QualificationRequirementList ( input . QualificationRequirements , context ) , } ) , ... ( input . Question !== undefined && input . Question !== null && { Question : input . Question } ) , ... ( input . RequesterAnnotation !== undefined && input . RequesterAnnotation !== null && { RequesterAnnotation : input . RequesterAnnotation } ) , ... ( input . Reward !== undefined && input . Reward !== null && { Reward : input . Reward } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , ... ( input . UniqueRequestToken !== undefined && input . UniqueRequestToken !== null && { UniqueRequestToken : input . UniqueRequestToken } ) , } ; } ; const serializeAws_json1_1CreateHITTypeRequest = ( input , context ) : any => { return { ... ( input . AssignmentDurationInSeconds !== undefined && input . AssignmentDurationInSeconds !== null && { AssignmentDurationInSeconds : input . AssignmentDurationInSeconds } ) , ... ( input . AutoApprovalDelayInSeconds !== undefined && input . AutoApprovalDelayInSeconds !== null && { AutoApprovalDelayInSeconds : input . AutoApprovalDelayInSeconds } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Keywords !== undefined && input . Keywords !== null && { Keywords : input . Keywords } ) , ... ( input . QualificationRequirements !== undefined && input . QualificationRequirements !== null && { QualificationRequirements : serializeAws_json1_1QualificationRequirementList ( input . QualificationRequirements , context ) , } ) , ... ( input . Reward !== undefined && input . Reward !== null && { Reward : input . Reward } ) , ... ( input . Title !== undefined && input . Title !== null && { Title : input . Title } ) , } ; } ; const serializeAws_json1_1CreateHITWithHITTypeRequest = ( input , context ) : any => { return { ... ( input . AssignmentReviewPolicy !== undefined && input . AssignmentReviewPolicy !== null && { AssignmentReviewPolicy : serializeAws_json1_1ReviewPolicy ( input . AssignmentReviewPolicy , context ) , } ) , ... ( input . HITLayoutId !== undefined && input . HITLayoutId !== null && { HITLayoutId : input . HITLayoutId } ) , ... ( input . HITLayoutParameters !== undefined && input . HITLayoutParameters !== null && { HITLayoutParameters : serializeAws_json1_1HITLayoutParameterList ( input . HITLayoutParameters , context ) , } ) , ... ( input . HITReviewPolicy !== undefined && input . HITReviewPolicy !== null && { HITReviewPolicy : serializeAws_json1_1ReviewPolicy ( input . HITReviewPolicy , context ) , } ) , ... ( input . HITTypeId !== undefined && input . HITTypeId !== null && { HITTypeId : input . HITTypeId } ) , ... ( input . LifetimeInSeconds !== undefined && input . LifetimeInSeconds !== null && { LifetimeInSeconds : input . LifetimeInSeconds } ) , ... ( input . MaxAssignments !== undefined && input . MaxAssignments !== null && { MaxAssignments : input . MaxAssignments } ) , ... ( input . Question !== undefined && input . Question !== null && { Question : input . Question } ) , ... ( input . RequesterAnnotation !== undefined && input . RequesterAnnotation !== null && { RequesterAnnotation : input . RequesterAnnotation } ) , ... ( input . UniqueRequestToken !== undefined && input . UniqueRequestToken !== null && { UniqueRequestToken : input . UniqueRequestToken } ) , } ; } ; const serializeAws_json1_1CreateQualificationTypeRequest = ( input , context ) : any => { return { ... ( input . AnswerKey !== undefined && input . AnswerKey !== null && { AnswerKey : input . AnswerKey } ) , ... ( input . AutoGranted !== undefined && input . AutoGranted !== null && { AutoGranted : input . AutoGranted } ) , ... ( input . AutoGrantedValue !== undefined && input . AutoGrantedValue !== null && { AutoGrantedValue : input . AutoGrantedValue } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . Keywords !== undefined && input . Keywords !== null && { Keywords : input . Keywords } ) , ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . QualificationTypeStatus !== undefined && input . QualificationTypeStatus !== null && { QualificationTypeStatus : input . QualificationTypeStatus } ) , ... ( input . RetryDelayInSeconds !== undefined && input . RetryDelayInSeconds !== null && { RetryDelayInSeconds : input . RetryDelayInSeconds } ) , ... ( input . Test !== undefined && input . Test !== null && { Test : input . Test } ) , ... ( input . TestDurationInSeconds !== undefined && input . TestDurationInSeconds !== null && { TestDurationInSeconds : input . TestDurationInSeconds } ) , } ; } ; const serializeAws_json1_1CreateWorkerBlockRequest = ( input , context ) : any => { return { ... ( input . Reason !== undefined && input . Reason !== null && { Reason : input . Reason } ) , ... ( input . WorkerId !== undefined && input . WorkerId !== null && { WorkerId : input . WorkerId } ) , } ; } ; const serializeAws_json1_1CustomerIdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1DeleteHITRequest = ( input , context ) : any => { return { ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , } ; } ; const serializeAws_json1_1DeleteQualificationTypeRequest = ( input , context ) : any => { return { ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , } ; } ; const serializeAws_json1_1DeleteWorkerBlockRequest = ( input , context ) : any => { return { ... ( input . Reason !== undefined && input . Reason !== null && { Reason : input . Reason } ) , ... ( input . WorkerId !== undefined && input . WorkerId !== null && { WorkerId : input . WorkerId } ) , } ; } ; const serializeAws_json1_1DisassociateQualificationFromWorkerRequest = ( input , context ) : any => { return { ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , ... ( input . Reason !== undefined && input . Reason !== null && { Reason : input . Reason } ) , ... ( input . WorkerId !== undefined && input . WorkerId !== null && { WorkerId : input . WorkerId } ) , } ; } ; const serializeAws_json1_1EventTypeList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1GetAccountBalanceRequest = ( input , context ) : any => { return { } ; } ; const serializeAws_json1_1GetAssignmentRequest = ( input , context ) : any => { return { ... ( input . AssignmentId !== undefined && input . AssignmentId !== null && { AssignmentId : input . AssignmentId } ) , } ; } ; const serializeAws_json1_1GetFileUploadURLRequest = ( input , context ) : any => { return { ... ( input . AssignmentId !== undefined && input . AssignmentId !== null && { AssignmentId : input . AssignmentId } ) , ... ( input . QuestionIdentifier !== undefined && input . QuestionIdentifier !== null && { QuestionIdentifier : input . QuestionIdentifier } ) , } ; } ; const serializeAws_json1_1GetHITRequest = ( input , context ) : any => { return { ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , } ; } ; const serializeAws_json1_1GetQualificationScoreRequest = ( input , context ) : any => { return { ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , ... ( input . WorkerId !== undefined && input . WorkerId !== null && { WorkerId : input . WorkerId } ) , } ; } ; const serializeAws_json1_1GetQualificationTypeRequest = ( input , context ) : any => { return { ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , } ; } ; const serializeAws_json1_1HITLayoutParameter = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_json1_1HITLayoutParameterList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1HITLayoutParameter ( entry , context ) ; } ) ; } ; const serializeAws_json1_1IntegerList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1ListAssignmentsForHITRequest = ( input , context ) : any => { return { ... ( input . AssignmentStatuses !== undefined && input . AssignmentStatuses !== null && { AssignmentStatuses : serializeAws_json1_1AssignmentStatusList ( input . AssignmentStatuses , context ) , } ) , ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListBonusPaymentsRequest = ( input , context ) : any => { return { ... ( input . AssignmentId !== undefined && input . AssignmentId !== null && { AssignmentId : input . AssignmentId } ) , ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListHITsForQualificationTypeRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , } ; } ; const serializeAws_json1_1ListHITsRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListQualificationRequestsRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , } ; } ; const serializeAws_json1_1ListQualificationTypesRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . MustBeOwnedByCaller !== undefined && input . MustBeOwnedByCaller !== null && { MustBeOwnedByCaller : input . MustBeOwnedByCaller } ) , ... ( input . MustBeRequestable !== undefined && input . MustBeRequestable !== null && { MustBeRequestable : input . MustBeRequestable } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . Query !== undefined && input . Query !== null && { Query : input . Query } ) , } ; } ; const serializeAws_json1_1ListReviewableHITsRequest = ( input , context ) : any => { return { ... ( input . HITTypeId !== undefined && input . HITTypeId !== null && { HITTypeId : input . HITTypeId } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . Status !== undefined && input . Status !== null && { Status : input . Status } ) , } ; } ; const serializeAws_json1_1ListReviewPolicyResultsForHITRequest = ( input , context ) : any => { return { ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . PolicyLevels !== undefined && input . PolicyLevels !== null && { PolicyLevels : serializeAws_json1_1ReviewPolicyLevelList ( input . PolicyLevels , context ) , } ) , ... ( input . RetrieveActions !== undefined && input . RetrieveActions !== null && { RetrieveActions : input . RetrieveActions } ) , ... ( input . RetrieveResults !== undefined && input . RetrieveResults !== null && { RetrieveResults : input . RetrieveResults } ) , } ; } ; const serializeAws_json1_1ListWorkerBlocksRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListWorkersWithQualificationTypeRequest = ( input , context ) : any => { return { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , ... ( input . Status !== undefined && input . Status !== null && { Status : input . Status } ) , } ; } ; const serializeAws_json1_1Locale = ( input , context ) : any => { return { ... ( input . Country !== undefined && input . Country !== null && { Country : input . Country } ) , ... ( input . Subdivision !== undefined && input . Subdivision !== null && { Subdivision : input . Subdivision } ) , } ; } ; const serializeAws_json1_1LocaleList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1Locale ( entry , context ) ; } ) ; } ; const serializeAws_json1_1NotificationSpecification = ( input , context ) : any => { return { ... ( input . Destination !== undefined && input . Destination !== null && { Destination : input . Destination } ) , ... ( input . EventTypes !== undefined && input . EventTypes !== null && { EventTypes : serializeAws_json1_1EventTypeList ( input . EventTypes , context ) } ) , ... ( input . Transport !== undefined && input . Transport !== null && { Transport : input . Transport } ) , ... ( input . Version !== undefined && input . Version !== null && { Version : input . Version } ) , } ; } ; const serializeAws_json1_1NotifyWorkersRequest = ( input , context ) : any => { return { ... ( input . MessageText !== undefined && input . MessageText !== null && { MessageText : input . MessageText } ) , ... ( input . Subject !== undefined && input . Subject !== null && { Subject : input . Subject } ) , ... ( input . WorkerIds !== undefined && input . WorkerIds !== null && { WorkerIds : serializeAws_json1_1CustomerIdList ( input . WorkerIds , context ) } ) , } ; } ; const serializeAws_json1_1ParameterMapEntry = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Values !== undefined && input . Values !== null && { Values : serializeAws_json1_1StringList ( input . Values , context ) } ) , } ; } ; const serializeAws_json1_1ParameterMapEntryList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1ParameterMapEntry ( entry , context ) ; } ) ; } ; const serializeAws_json1_1PolicyParameter = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . MapEntries !== undefined && input . MapEntries !== null && { MapEntries : serializeAws_json1_1ParameterMapEntryList ( input . MapEntries , context ) , } ) , ... ( input . Values !== undefined && input . Values !== null && { Values : serializeAws_json1_1StringList ( input . Values , context ) } ) , } ; } ; const serializeAws_json1_1PolicyParameterList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1PolicyParameter ( entry , context ) ; } ) ; } ; const serializeAws_json1_1QualificationRequirement = ( input , context ) : any => { return { ... ( input . ActionsGuarded !== undefined && input . ActionsGuarded !== null && { ActionsGuarded : input . ActionsGuarded } ) , ... ( input . Comparator !== undefined && input . Comparator !== null && { Comparator : input . Comparator } ) , ... ( input . IntegerValues !== undefined && input . IntegerValues !== null && { IntegerValues : serializeAws_json1_1IntegerList ( input . IntegerValues , context ) } ) , ... ( input . LocaleValues !== undefined && input . LocaleValues !== null && { LocaleValues : serializeAws_json1_1LocaleList ( input . LocaleValues , context ) } ) , ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , ... ( input . RequiredToPreview !== undefined && input . RequiredToPreview !== null && { RequiredToPreview : input . RequiredToPreview } ) , } ; } ; const serializeAws_json1_1QualificationRequirementList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1QualificationRequirement ( entry , context ) ; } ) ; } ; const serializeAws_json1_1RejectAssignmentRequest = ( input , context ) : any => { return { ... ( input . AssignmentId !== undefined && input . AssignmentId !== null && { AssignmentId : input . AssignmentId } ) , ... ( input . RequesterFeedback !== undefined && input . RequesterFeedback !== null && { RequesterFeedback : input . RequesterFeedback } ) , } ; } ; const serializeAws_json1_1RejectQualificationRequestRequest = ( input , context ) : any => { return { ... ( input . QualificationRequestId !== undefined && input . QualificationRequestId !== null && { QualificationRequestId : input . QualificationRequestId } ) , ... ( input . Reason !== undefined && input . Reason !== null && { Reason : input . Reason } ) , } ; } ; const serializeAws_json1_1ReviewPolicy = ( input , context ) : any => { return { ... ( input . Parameters !== undefined && input . Parameters !== null && { Parameters : serializeAws_json1_1PolicyParameterList ( input . Parameters , context ) } ) , ... ( input . PolicyName !== undefined && input . PolicyName !== null && { PolicyName : input . PolicyName } ) , } ; } ; const serializeAws_json1_1ReviewPolicyLevelList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1SendBonusRequest = ( input , context ) : any => { return { ... ( input . AssignmentId !== undefined && input . AssignmentId !== null && { AssignmentId : input . AssignmentId } ) , ... ( input . BonusAmount !== undefined && input . BonusAmount !== null && { BonusAmount : input . BonusAmount } ) , ... ( input . Reason !== undefined && input . Reason !== null && { Reason : input . Reason } ) , ... ( input . UniqueRequestToken !== undefined && input . UniqueRequestToken !== null && { UniqueRequestToken : input . UniqueRequestToken } ) , ... ( input . WorkerId !== undefined && input . WorkerId !== null && { WorkerId : input . WorkerId } ) , } ; } ; const serializeAws_json1_1SendTestEventNotificationRequest = ( input , context ) : any => { return { ... ( input . Notification !== undefined && input . Notification !== null && { Notification : serializeAws_json1_1NotificationSpecification ( input . Notification , context ) , } ) , ... ( input . TestEventType !== undefined && input . TestEventType !== null && { TestEventType : input . TestEventType } ) , } ; } ; const serializeAws_json1_1StringList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1UpdateExpirationForHITRequest = ( input , context ) : any => { return { ... ( input . ExpireAt !== undefined && input . ExpireAt !== null && { ExpireAt : Math . round ( input . ExpireAt . getTime ( ) / 1000 ) } ) , ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , } ; } ; const serializeAws_json1_1UpdateHITReviewStatusRequest = ( input , context ) : any => { return { ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , ... ( input . Revert !== undefined && input . Revert !== null && { Revert : input . Revert } ) , } ; } ; const serializeAws_json1_1UpdateHITTypeOfHITRequest = ( input , context ) : any => { return { ... ( input . HITId !== undefined && input . HITId !== null && { HITId : input . HITId } ) , ... ( input . HITTypeId !== undefined && input . HITTypeId !== null && { HITTypeId : input . HITTypeId } ) , } ; } ; const serializeAws_json1_1UpdateNotificationSettingsRequest = ( input , context ) : any => { return { ... ( input . Active !== undefined && input . Active !== null && { Active : input . Active } ) , ... ( input . HITTypeId !== undefined && input . HITTypeId !== null && { HITTypeId : input . HITTypeId } ) , ... ( input . Notification !== undefined && input . Notification !== null && { Notification : serializeAws_json1_1NotificationSpecification ( input . Notification , context ) , } ) , } ; } ; const serializeAws_json1_1UpdateQualificationTypeRequest = ( input , context ) : any => { return { ... ( input . AnswerKey !== undefined && input . AnswerKey !== null && { AnswerKey : input . AnswerKey } ) , ... ( input . AutoGranted !== undefined && input . AutoGranted !== null && { AutoGranted : input . AutoGranted } ) , ... ( input . AutoGrantedValue !== undefined && input . AutoGrantedValue !== null && { AutoGrantedValue : input . AutoGrantedValue } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . QualificationTypeId !== undefined && input . QualificationTypeId !== null && { QualificationTypeId : input . QualificationTypeId } ) , ... ( input . QualificationTypeStatus !== undefined && input . QualificationTypeStatus !== null && { QualificationTypeStatus : input . QualificationTypeStatus } ) , ... ( input . RetryDelayInSeconds !== undefined && input . RetryDelayInSeconds !== null && { RetryDelayInSeconds : input . RetryDelayInSeconds } ) , ... ( input . Test !== undefined && input . Test !== null && { Test : input . Test } ) , ... ( input . TestDurationInSeconds !== undefined && input . TestDurationInSeconds !== null && { TestDurationInSeconds : input . TestDurationInSeconds } ) , } ; } ; const deserializeAws_json1_1AcceptQualificationRequestResponse = ( output , context ) : AcceptQualificationRequestResponse => { return { } as any ; } ; const deserializeAws_json1_1ApproveAssignmentResponse = ( output , context ) : ApproveAssignmentResponse => { return { } as any ; } ; const deserializeAws_json1_1Assignment = ( output , context ) : Assignment => { return { AcceptTime : output . AcceptTime !== undefined && output . AcceptTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . AcceptTime ) ) ) : undefined , Answer : __expectString ( output . Answer ) , ApprovalTime : output . ApprovalTime !== undefined && output . ApprovalTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . ApprovalTime ) ) ) : undefined , AssignmentId : __expectString ( output . AssignmentId ) , AssignmentStatus : __expectString ( output . AssignmentStatus ) , AutoApprovalTime : output . AutoApprovalTime !== undefined && output . AutoApprovalTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . AutoApprovalTime ) ) ) : undefined , Deadline : output . Deadline !== undefined && output . Deadline !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . Deadline ) ) ) : undefined , HITId : __expectString ( output . HITId ) , RejectionTime : output . RejectionTime !== undefined && output . RejectionTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . RejectionTime ) ) ) : undefined , RequesterFeedback : __expectString ( output . RequesterFeedback ) , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , WorkerId : __expectString ( output . WorkerId ) , } as any ; } ; const deserializeAws_json1_1AssignmentList = ( output , context ) : Assignment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Assignment ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1AssociateQualificationWithWorkerResponse = ( output , context ) : AssociateQualificationWithWorkerResponse => { return { } as any ; } ; const deserializeAws_json1_1BonusPayment = ( output , context ) : BonusPayment => { return { AssignmentId : __expectString ( output . AssignmentId ) , BonusAmount : __expectString ( output . BonusAmount ) , GrantTime : output . GrantTime !== undefined && output . GrantTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . GrantTime ) ) ) : undefined , Reason : __expectString ( output . Reason ) , WorkerId : __expectString ( output . WorkerId ) , } as any ; } ; const deserializeAws_json1_1BonusPaymentList = ( output , context ) : BonusPayment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1BonusPayment ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1CreateAdditionalAssignmentsForHITResponse = ( output , context ) : CreateAdditionalAssignmentsForHITResponse => { return { } as any ; } ; const deserializeAws_json1_1CreateHITResponse = ( output , context ) : CreateHITResponse => { return { HIT : output . HIT !== undefined && output . HIT !== null ? deserializeAws_json1_1HIT ( output . HIT , context ) : undefined , } as any ; } ; const deserializeAws_json1_1CreateHITTypeResponse = ( output , context ) : CreateHITTypeResponse => { return { HITTypeId : __expectString ( output . HITTypeId ) , } as any ; } ; const deserializeAws_json1_1CreateHITWithHITTypeResponse = ( output , context ) : CreateHITWithHITTypeResponse => { return { HIT : output . HIT !== undefined && output . HIT !== null ? deserializeAws_json1_1HIT ( output . HIT , context ) : undefined , } as any ; } ; const deserializeAws_json1_1CreateQualificationTypeResponse = ( output , context ) : CreateQualificationTypeResponse => { return { QualificationType : output . QualificationType !== undefined && output . QualificationType !== null ? deserializeAws_json1_1QualificationType ( output . QualificationType , context ) : undefined , } as any ; } ; const deserializeAws_json1_1CreateWorkerBlockResponse = ( output , context ) : CreateWorkerBlockResponse => { return { } as any ; } ; const deserializeAws_json1_1DeleteHITResponse = ( output , context ) : DeleteHITResponse => { return { } as any ; } ; const deserializeAws_json1_1DeleteQualificationTypeResponse = ( output , context ) : DeleteQualificationTypeResponse => { return { } as any ; } ; const deserializeAws_json1_1DeleteWorkerBlockResponse = ( output , context ) : DeleteWorkerBlockResponse => { return { } as any ; } ; const deserializeAws_json1_1DisassociateQualificationFromWorkerResponse = ( output , context ) : DisassociateQualificationFromWorkerResponse => { return { } as any ; } ; const deserializeAws_json1_1GetAccountBalanceResponse = ( output , context ) : GetAccountBalanceResponse => { return { AvailableBalance : __expectString ( output . AvailableBalance ) , OnHoldBalance : __expectString ( output . OnHoldBalance ) , } as any ; } ; const deserializeAws_json1_1GetAssignmentResponse = ( output , context ) : GetAssignmentResponse => { return { Assignment : output . Assignment !== undefined && output . Assignment !== null ? deserializeAws_json1_1Assignment ( output . Assignment , context ) : undefined , HIT : output . HIT !== undefined && output . HIT !== null ? deserializeAws_json1_1HIT ( output . HIT , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetFileUploadURLResponse = ( output , context ) : GetFileUploadURLResponse => { return { FileUploadURL : __expectString ( output . FileUploadURL ) , } as any ; } ; const deserializeAws_json1_1GetHITResponse = ( output , context ) : GetHITResponse => { return { HIT : output . HIT !== undefined && output . HIT !== null ? deserializeAws_json1_1HIT ( output . HIT , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetQualificationScoreResponse = ( output , context ) : GetQualificationScoreResponse => { return { Qualification : output . Qualification !== undefined && output . Qualification !== null ? deserializeAws_json1_1Qualification ( output . Qualification , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetQualificationTypeResponse = ( output , context ) : GetQualificationTypeResponse => { return { QualificationType : output . QualificationType !== undefined && output . QualificationType !== null ? deserializeAws_json1_1QualificationType ( output . QualificationType , context ) : undefined , } as any ; } ; const deserializeAws_json1_1HIT = ( output , context ) : HIT => { return { AssignmentDurationInSeconds : __expectLong ( output . AssignmentDurationInSeconds ) , AutoApprovalDelayInSeconds : __expectLong ( output . AutoApprovalDelayInSeconds ) , CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , Description : __expectString ( output . Description ) , Expiration : output . Expiration !== undefined && output . Expiration !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . Expiration ) ) ) : undefined , HITGroupId : __expectString ( output . HITGroupId ) , HITId : __expectString ( output . HITId ) , HITLayoutId : __expectString ( output . HITLayoutId ) , HITReviewStatus : __expectString ( output . HITReviewStatus ) , HITStatus : __expectString ( output . HITStatus ) , HITTypeId : __expectString ( output . HITTypeId ) , Keywords : __expectString ( output . Keywords ) , MaxAssignments : __expectInt32 ( output . MaxAssignments ) , NumberOfAssignmentsAvailable : __expectInt32 ( output . NumberOfAssignmentsAvailable ) , NumberOfAssignmentsCompleted : __expectInt32 ( output . NumberOfAssignmentsCompleted ) , NumberOfAssignmentsPending : __expectInt32 ( output . NumberOfAssignmentsPending ) , QualificationRequirements : output . QualificationRequirements !== undefined && output . QualificationRequirements !== null ? deserializeAws_json1_1QualificationRequirementList ( output . QualificationRequirements , context ) : undefined , Question : __expectString ( output . Question ) , RequesterAnnotation : __expectString ( output . RequesterAnnotation ) , Reward : __expectString ( output . Reward ) , Title : __expectString ( output . Title ) , } as any ; } ; const deserializeAws_json1_1HITList = ( output , context ) : HIT [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1HIT ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1IntegerList = ( output , context ) : number [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectInt32 ( entry ) as any ; } ) ; } ; const deserializeAws_json1_1ListAssignmentsForHITResponse = ( output , context ) : ListAssignmentsForHITResponse => { return { Assignments : output . Assignments !== undefined && output . Assignments !== null ? deserializeAws_json1_1AssignmentList ( output . Assignments , context ) : undefined , NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , } as any ; } ; const deserializeAws_json1_1ListBonusPaymentsResponse = ( output , context ) : ListBonusPaymentsResponse => { return { BonusPayments : output . BonusPayments !== undefined && output . BonusPayments !== null ? deserializeAws_json1_1BonusPaymentList ( output . BonusPayments , context ) : undefined , NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , } as any ; } ; const deserializeAws_json1_1ListHITsForQualificationTypeResponse = ( output , context ) : ListHITsForQualificationTypeResponse => { return { HITs : output . HITs !== undefined && output . HITs !== null ? deserializeAws_json1_1HITList ( output . HITs , context ) : undefined , NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , } as any ; } ; const deserializeAws_json1_1ListHITsResponse = ( output , context ) : ListHITsResponse => { return { HITs : output . HITs !== undefined && output . HITs !== null ? deserializeAws_json1_1HITList ( output . HITs , context ) : undefined , NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , } as any ; } ; const deserializeAws_json1_1ListQualificationRequestsResponse = ( output , context ) : ListQualificationRequestsResponse => { return { NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , QualificationRequests : output . QualificationRequests !== undefined && output . QualificationRequests !== null ? deserializeAws_json1_1QualificationRequestList ( output . QualificationRequests , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListQualificationTypesResponse = ( output , context ) : ListQualificationTypesResponse => { return { NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , QualificationTypes : output . QualificationTypes !== undefined && output . QualificationTypes !== null ? deserializeAws_json1_1QualificationTypeList ( output . QualificationTypes , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListReviewableHITsResponse = ( output , context ) : ListReviewableHITsResponse => { return { HITs : output . HITs !== undefined && output . HITs !== null ? deserializeAws_json1_1HITList ( output . HITs , context ) : undefined , NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , } as any ; } ; const deserializeAws_json1_1ListReviewPolicyResultsForHITResponse = ( output , context ) : ListReviewPolicyResultsForHITResponse => { return { AssignmentReviewPolicy : output . AssignmentReviewPolicy !== undefined && output . AssignmentReviewPolicy !== null ? deserializeAws_json1_1ReviewPolicy ( output . AssignmentReviewPolicy , context ) : undefined , AssignmentReviewReport : output . AssignmentReviewReport !== undefined && output . AssignmentReviewReport !== null ? deserializeAws_json1_1ReviewReport ( output . AssignmentReviewReport , context ) : undefined , HITId : __expectString ( output . HITId ) , HITReviewPolicy : output . HITReviewPolicy !== undefined && output . HITReviewPolicy !== null ? deserializeAws_json1_1ReviewPolicy ( output . HITReviewPolicy , context ) : undefined , HITReviewReport : output . HITReviewReport !== undefined && output . HITReviewReport !== null ? deserializeAws_json1_1ReviewReport ( output . HITReviewReport , context ) : undefined , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListWorkerBlocksResponse = ( output , context ) : ListWorkerBlocksResponse => { return { NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , WorkerBlocks : output . WorkerBlocks !== undefined && output . WorkerBlocks !== null ? deserializeAws_json1_1WorkerBlockList ( output . WorkerBlocks , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ListWorkersWithQualificationTypeResponse = ( output , context ) : ListWorkersWithQualificationTypeResponse => { return { NextToken : __expectString ( output . NextToken ) , NumResults : __expectInt32 ( output . NumResults ) , Qualifications : output . Qualifications !== undefined && output . Qualifications !== null ? deserializeAws_json1_1QualificationList ( output . Qualifications , context ) : undefined , } as any ; } ; const deserializeAws_json1_1Locale = ( output , context ) : Locale => { return { Country : __expectString ( output . Country ) , Subdivision : __expectString ( output . Subdivision ) , } as any ; } ; const deserializeAws_json1_1LocaleList = ( output , context ) : Locale [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Locale ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1NotifyWorkersFailureStatus = ( output , context ) : NotifyWorkersFailureStatus => { return { NotifyWorkersFailureCode : __expectString ( output . NotifyWorkersFailureCode ) , NotifyWorkersFailureMessage : __expectString ( output . NotifyWorkersFailureMessage ) , WorkerId : __expectString ( output . WorkerId ) , } as any ; } ; const deserializeAws_json1_1NotifyWorkersFailureStatusList = ( output , context ) : NotifyWorkersFailureStatus [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1NotifyWorkersFailureStatus ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1NotifyWorkersResponse = ( output , context ) : NotifyWorkersResponse => { return { NotifyWorkersFailureStatuses : output . NotifyWorkersFailureStatuses !== undefined && output . NotifyWorkersFailureStatuses !== null ? deserializeAws_json1_1NotifyWorkersFailureStatusList ( output . NotifyWorkersFailureStatuses , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ParameterMapEntry = ( output , context ) : ParameterMapEntry => { return { Key : __expectString ( output . Key ) , Values : output . Values !== undefined && output . Values !== null ? deserializeAws_json1_1StringList ( output . Values , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ParameterMapEntryList = ( output , context ) : ParameterMapEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ParameterMapEntry ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1PolicyParameter = ( output , context ) : PolicyParameter => { return { Key : __expectString ( output . Key ) , MapEntries : output . MapEntries !== undefined && output . MapEntries !== null ? deserializeAws_json1_1ParameterMapEntryList ( output . MapEntries , context ) : undefined , Values : output . Values !== undefined && output . Values !== null ? deserializeAws_json1_1StringList ( output . Values , context ) : undefined , } as any ; } ; const deserializeAws_json1_1PolicyParameterList = ( output , context ) : PolicyParameter [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1PolicyParameter ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1Qualification = ( output , context ) : Qualification => { return { GrantTime : output . GrantTime !== undefined && output . GrantTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . GrantTime ) ) ) : undefined , IntegerValue : __expectInt32 ( output . IntegerValue ) , LocaleValue : output . LocaleValue !== undefined && output . LocaleValue !== null ? deserializeAws_json1_1Locale ( output . LocaleValue , context ) : undefined , QualificationTypeId : __expectString ( output . QualificationTypeId ) , Status : __expectString ( output . Status ) , WorkerId : __expectString ( output . WorkerId ) , } as any ; } ; const deserializeAws_json1_1QualificationList = ( output , context ) : Qualification [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Qualification ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1QualificationRequest = ( output , context ) : QualificationRequest => { return { Answer : __expectString ( output . Answer ) , QualificationRequestId : __expectString ( output . QualificationRequestId ) , QualificationTypeId : __expectString ( output . QualificationTypeId ) , SubmitTime : output . SubmitTime !== undefined && output . SubmitTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . SubmitTime ) ) ) : undefined , Test : __expectString ( output . Test ) , WorkerId : __expectString ( output . WorkerId ) , } as any ; } ; const deserializeAws_json1_1QualificationRequestList = ( output , context ) : QualificationRequest [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1QualificationRequest ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1QualificationRequirement = ( output , context ) : QualificationRequirement => { return { ActionsGuarded : __expectString ( output . ActionsGuarded ) , Comparator : __expectString ( output . Comparator ) , IntegerValues : output . IntegerValues !== undefined && output . IntegerValues !== null ? deserializeAws_json1_1IntegerList ( output . IntegerValues , context ) : undefined , LocaleValues : output . LocaleValues !== undefined && output . LocaleValues !== null ? deserializeAws_json1_1LocaleList ( output . LocaleValues , context ) : undefined , QualificationTypeId : __expectString ( output . QualificationTypeId ) , RequiredToPreview : __expectBoolean ( output . RequiredToPreview ) , } as any ; } ; const deserializeAws_json1_1QualificationRequirementList = ( output , context ) : QualificationRequirement [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1QualificationRequirement ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1QualificationType = ( output , context ) : QualificationType => { return { AnswerKey : __expectString ( output . AnswerKey ) , AutoGranted : __expectBoolean ( output . AutoGranted ) , AutoGrantedValue : __expectInt32 ( output . AutoGrantedValue ) , CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , Description : __expectString ( output . Description ) , IsRequestable : __expectBoolean ( output . IsRequestable ) , Keywords : __expectString ( output . Keywords ) , Name : __expectString ( output . Name ) , QualificationTypeId : __expectString ( output . QualificationTypeId ) , QualificationTypeStatus : __expectString ( output . QualificationTypeStatus ) , RetryDelayInSeconds : __expectLong ( output . RetryDelayInSeconds ) , Test : __expectString ( output . Test ) , TestDurationInSeconds : __expectLong ( output . TestDurationInSeconds ) , } as any ; } ; const deserializeAws_json1_1QualificationTypeList = ( output , context ) : QualificationType [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1QualificationType ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1RejectAssignmentResponse = ( output , context ) : RejectAssignmentResponse => { return { } as any ; } ; const deserializeAws_json1_1RejectQualificationRequestResponse = ( output , context ) : RejectQualificationRequestResponse => { return { } as any ; } ; const deserializeAws_json1_1RequestError = ( output , context ) : RequestError => { return { Message : __expectString ( output . Message ) , TurkErrorCode : __expectString ( output . TurkErrorCode ) , } as any ; } ; const deserializeAws_json1_1ReviewActionDetail = ( output , context ) : ReviewActionDetail => { return { ActionId : __expectString ( output . ActionId ) , ActionName : __expectString ( output . ActionName ) , CompleteTime : output . CompleteTime !== undefined && output . CompleteTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CompleteTime ) ) ) : undefined , ErrorCode : __expectString ( output . ErrorCode ) , Result : __expectString ( output . Result ) , Status : __expectString ( output . Status ) , TargetId : __expectString ( output . TargetId ) , TargetType : __expectString ( output . TargetType ) , } as any ; } ; const deserializeAws_json1_1ReviewActionDetailList = ( output , context ) : ReviewActionDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ReviewActionDetail ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ReviewPolicy = ( output , context ) : ReviewPolicy => { return { Parameters : output . Parameters !== undefined && output . Parameters !== null ? deserializeAws_json1_1PolicyParameterList ( output . Parameters , context ) : undefined , PolicyName : __expectString ( output . PolicyName ) , } as any ; } ; const deserializeAws_json1_1ReviewReport = ( output , context ) : ReviewReport => { return { ReviewActions : output . ReviewActions !== undefined && output . ReviewActions !== null ? deserializeAws_json1_1ReviewActionDetailList ( output . ReviewActions , context ) : undefined , ReviewResults : output . ReviewResults !== undefined && output . ReviewResults !== null ? deserializeAws_json1_1ReviewResultDetailList ( output . ReviewResults , context ) : undefined , } as any ; } ; const deserializeAws_json1_1ReviewResultDetail = ( output , context ) : ReviewResultDetail => { return { ActionId : __expectString ( output . ActionId ) , Key : __expectString ( output . Key ) , QuestionId : __expectString ( output . QuestionId ) , SubjectId : __expectString ( output . SubjectId ) , SubjectType : __expectString ( output . SubjectType ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1ReviewResultDetailList = ( output , context ) : ReviewResultDetail [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1ReviewResultDetail ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1SendBonusResponse = ( output , context ) : SendBonusResponse => { return { } as any ; } ; const deserializeAws_json1_1SendTestEventNotificationResponse = ( output , context ) : SendTestEventNotificationResponse => { return { } as any ; } ; const deserializeAws_json1_1ServiceFault = ( output , context ) : ServiceFault => { return { Message : __expectString ( output . Message ) , TurkErrorCode : __expectString ( output . TurkErrorCode ) , } as any ; } ; const deserializeAws_json1_1StringList = ( 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_json1_1UpdateExpirationForHITResponse = ( output , context ) : UpdateExpirationForHITResponse => { return { } as any ; } ; const deserializeAws_json1_1UpdateHITReviewStatusResponse = ( output , context ) : UpdateHITReviewStatusResponse => { return { } as any ; } ; const deserializeAws_json1_1UpdateHITTypeOfHITResponse = ( output , context ) : UpdateHITTypeOfHITResponse => { return { } as any ; } ; const deserializeAws_json1_1UpdateNotificationSettingsResponse = ( output , context ) : UpdateNotificationSettingsResponse => { return { } as any ; } ; const deserializeAws_json1_1UpdateQualificationTypeResponse = ( output , context ) : UpdateQualificationTypeResponse => { return { QualificationType : output . QualificationType !== undefined && output . QualificationType !== null ? deserializeAws_json1_1QualificationType ( output . QualificationType , context ) : undefined , } as any ; } ; const deserializeAws_json1_1WorkerBlock = ( output , context ) : WorkerBlock => { return { Reason : __expectString ( output . Reason ) , WorkerId : __expectString ( output . WorkerId ) , } as any ; } ; const deserializeAws_json1_1WorkerBlockList = ( output , context ) : WorkerBlock [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1WorkerBlock ( entry , context ) ; } ) ; } ; 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 buildHttpRpcRequest = async ( context , headers , path , resolvedHostname , body ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const contents = { protocol , hostname , port , method : "POST" , path : basePath . endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) + path : basePath + path , headers , } ; if ( resolvedHostname !== undefined ) { contents . hostname = resolvedHostname ; } if ( body !== undefined ) { contents . body = body ; } return new __HttpRequest ( contents ) ; } ; 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 "" ; } ;