use std::error::Error;
use std::fmt;
use std::io;
#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};
use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;
use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AcceptQualificationRequestRequest {
#[serde(rename = "IntegerValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integer_value: Option<i64>,
#[serde(rename = "QualificationRequestId")]
pub qualification_request_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AcceptQualificationRequestResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ApproveAssignmentRequest {
#[serde(rename = "AssignmentId")]
pub assignment_id: String,
#[serde(rename = "OverrideRejection")]
#[serde(skip_serializing_if = "Option::is_none")]
pub override_rejection: Option<bool>,
#[serde(rename = "RequesterFeedback")]
#[serde(skip_serializing_if = "Option::is_none")]
pub requester_feedback: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ApproveAssignmentResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Assignment {
#[serde(rename = "AcceptTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub accept_time: Option<f64>,
#[serde(rename = "Answer")]
#[serde(skip_serializing_if = "Option::is_none")]
pub answer: Option<String>,
#[serde(rename = "ApprovalTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub approval_time: Option<f64>,
#[serde(rename = "AssignmentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_id: Option<String>,
#[serde(rename = "AssignmentStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_status: Option<String>,
#[serde(rename = "AutoApprovalTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_approval_time: Option<f64>,
#[serde(rename = "Deadline")]
#[serde(skip_serializing_if = "Option::is_none")]
pub deadline: Option<f64>,
#[serde(rename = "HITId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_id: Option<String>,
#[serde(rename = "RejectionTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub rejection_time: Option<f64>,
#[serde(rename = "RequesterFeedback")]
#[serde(skip_serializing_if = "Option::is_none")]
pub requester_feedback: Option<String>,
#[serde(rename = "SubmitTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub submit_time: Option<f64>,
#[serde(rename = "WorkerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct AssociateQualificationWithWorkerRequest {
#[serde(rename = "IntegerValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integer_value: Option<i64>,
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
#[serde(rename = "SendNotification")]
#[serde(skip_serializing_if = "Option::is_none")]
pub send_notification: Option<bool>,
#[serde(rename = "WorkerId")]
pub worker_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct AssociateQualificationWithWorkerResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct BonusPayment {
#[serde(rename = "AssignmentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_id: Option<String>,
#[serde(rename = "BonusAmount")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bonus_amount: Option<String>,
#[serde(rename = "GrantTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub grant_time: Option<f64>,
#[serde(rename = "Reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(rename = "WorkerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateAdditionalAssignmentsForHITRequest {
#[serde(rename = "HITId")]
pub hit_id: String,
#[serde(rename = "NumberOfAdditionalAssignments")]
pub number_of_additional_assignments: i64,
#[serde(rename = "UniqueRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unique_request_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateAdditionalAssignmentsForHITResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateHITRequest {
#[serde(rename = "AssignmentDurationInSeconds")]
pub assignment_duration_in_seconds: i64,
#[serde(rename = "AssignmentReviewPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_review_policy: Option<ReviewPolicy>,
#[serde(rename = "AutoApprovalDelayInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_approval_delay_in_seconds: Option<i64>,
#[serde(rename = "Description")]
pub description: String,
#[serde(rename = "HITLayoutId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_layout_id: Option<String>,
#[serde(rename = "HITLayoutParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_layout_parameters: Option<Vec<HITLayoutParameter>>,
#[serde(rename = "HITReviewPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_review_policy: Option<ReviewPolicy>,
#[serde(rename = "Keywords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<String>,
#[serde(rename = "LifetimeInSeconds")]
pub lifetime_in_seconds: i64,
#[serde(rename = "MaxAssignments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_assignments: Option<i64>,
#[serde(rename = "QualificationRequirements")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_requirements: Option<Vec<QualificationRequirement>>,
#[serde(rename = "Question")]
#[serde(skip_serializing_if = "Option::is_none")]
pub question: Option<String>,
#[serde(rename = "RequesterAnnotation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub requester_annotation: Option<String>,
#[serde(rename = "Reward")]
pub reward: String,
#[serde(rename = "Title")]
pub title: String,
#[serde(rename = "UniqueRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unique_request_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateHITResponse {
#[serde(rename = "HIT")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit: Option<HIT>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateHITTypeRequest {
#[serde(rename = "AssignmentDurationInSeconds")]
pub assignment_duration_in_seconds: i64,
#[serde(rename = "AutoApprovalDelayInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_approval_delay_in_seconds: Option<i64>,
#[serde(rename = "Description")]
pub description: String,
#[serde(rename = "Keywords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<String>,
#[serde(rename = "QualificationRequirements")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_requirements: Option<Vec<QualificationRequirement>>,
#[serde(rename = "Reward")]
pub reward: String,
#[serde(rename = "Title")]
pub title: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateHITTypeResponse {
#[serde(rename = "HITTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_type_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateHITWithHITTypeRequest {
#[serde(rename = "AssignmentReviewPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_review_policy: Option<ReviewPolicy>,
#[serde(rename = "HITLayoutId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_layout_id: Option<String>,
#[serde(rename = "HITLayoutParameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_layout_parameters: Option<Vec<HITLayoutParameter>>,
#[serde(rename = "HITReviewPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_review_policy: Option<ReviewPolicy>,
#[serde(rename = "HITTypeId")]
pub hit_type_id: String,
#[serde(rename = "LifetimeInSeconds")]
pub lifetime_in_seconds: i64,
#[serde(rename = "MaxAssignments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_assignments: Option<i64>,
#[serde(rename = "Question")]
#[serde(skip_serializing_if = "Option::is_none")]
pub question: Option<String>,
#[serde(rename = "RequesterAnnotation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub requester_annotation: Option<String>,
#[serde(rename = "UniqueRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unique_request_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateHITWithHITTypeResponse {
#[serde(rename = "HIT")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit: Option<HIT>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateQualificationTypeRequest {
#[serde(rename = "AnswerKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub answer_key: Option<String>,
#[serde(rename = "AutoGranted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_granted: Option<bool>,
#[serde(rename = "AutoGrantedValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_granted_value: Option<i64>,
#[serde(rename = "Description")]
pub description: String,
#[serde(rename = "Keywords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<String>,
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "QualificationTypeStatus")]
pub qualification_type_status: String,
#[serde(rename = "RetryDelayInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retry_delay_in_seconds: Option<i64>,
#[serde(rename = "Test")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test: Option<String>,
#[serde(rename = "TestDurationInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test_duration_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateQualificationTypeResponse {
#[serde(rename = "QualificationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type: Option<QualificationType>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateWorkerBlockRequest {
#[serde(rename = "Reason")]
pub reason: String,
#[serde(rename = "WorkerId")]
pub worker_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateWorkerBlockResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteHITRequest {
#[serde(rename = "HITId")]
pub hit_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteHITResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteQualificationTypeRequest {
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteQualificationTypeResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteWorkerBlockRequest {
#[serde(rename = "Reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(rename = "WorkerId")]
pub worker_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteWorkerBlockResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DisassociateQualificationFromWorkerRequest {
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
#[serde(rename = "Reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(rename = "WorkerId")]
pub worker_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DisassociateQualificationFromWorkerResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAccountBalanceRequest {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetAccountBalanceResponse {
#[serde(rename = "AvailableBalance")]
#[serde(skip_serializing_if = "Option::is_none")]
pub available_balance: Option<String>,
#[serde(rename = "OnHoldBalance")]
#[serde(skip_serializing_if = "Option::is_none")]
pub on_hold_balance: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetAssignmentRequest {
#[serde(rename = "AssignmentId")]
pub assignment_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetAssignmentResponse {
#[serde(rename = "Assignment")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment: Option<Assignment>,
#[serde(rename = "HIT")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit: Option<HIT>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetFileUploadURLRequest {
#[serde(rename = "AssignmentId")]
pub assignment_id: String,
#[serde(rename = "QuestionIdentifier")]
pub question_identifier: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetFileUploadURLResponse {
#[serde(rename = "FileUploadURL")]
#[serde(skip_serializing_if = "Option::is_none")]
pub file_upload_url: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetHITRequest {
#[serde(rename = "HITId")]
pub hit_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetHITResponse {
#[serde(rename = "HIT")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit: Option<HIT>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetQualificationScoreRequest {
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
#[serde(rename = "WorkerId")]
pub worker_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetQualificationScoreResponse {
#[serde(rename = "Qualification")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification: Option<Qualification>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetQualificationTypeRequest {
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetQualificationTypeResponse {
#[serde(rename = "QualificationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type: Option<QualificationType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct HIT {
#[serde(rename = "AssignmentDurationInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_duration_in_seconds: Option<i64>,
#[serde(rename = "AutoApprovalDelayInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_approval_delay_in_seconds: Option<i64>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "Expiration")]
#[serde(skip_serializing_if = "Option::is_none")]
pub expiration: Option<f64>,
#[serde(rename = "HITGroupId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_group_id: Option<String>,
#[serde(rename = "HITId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_id: Option<String>,
#[serde(rename = "HITLayoutId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_layout_id: Option<String>,
#[serde(rename = "HITReviewStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_review_status: Option<String>,
#[serde(rename = "HITStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_status: Option<String>,
#[serde(rename = "HITTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_type_id: Option<String>,
#[serde(rename = "Keywords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<String>,
#[serde(rename = "MaxAssignments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_assignments: Option<i64>,
#[serde(rename = "NumberOfAssignmentsAvailable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_assignments_available: Option<i64>,
#[serde(rename = "NumberOfAssignmentsCompleted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_assignments_completed: Option<i64>,
#[serde(rename = "NumberOfAssignmentsPending")]
#[serde(skip_serializing_if = "Option::is_none")]
pub number_of_assignments_pending: Option<i64>,
#[serde(rename = "QualificationRequirements")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_requirements: Option<Vec<QualificationRequirement>>,
#[serde(rename = "Question")]
#[serde(skip_serializing_if = "Option::is_none")]
pub question: Option<String>,
#[serde(rename = "RequesterAnnotation")]
#[serde(skip_serializing_if = "Option::is_none")]
pub requester_annotation: Option<String>,
#[serde(rename = "Reward")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reward: Option<String>,
#[serde(rename = "Title")]
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct HITLayoutParameter {
#[serde(rename = "Name")]
pub name: String,
#[serde(rename = "Value")]
pub value: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListAssignmentsForHITRequest {
#[serde(rename = "AssignmentStatuses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_statuses: Option<Vec<String>>,
#[serde(rename = "HITId")]
pub hit_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListAssignmentsForHITResponse {
#[serde(rename = "Assignments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignments: Option<Vec<Assignment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListBonusPaymentsRequest {
#[serde(rename = "AssignmentId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_id: Option<String>,
#[serde(rename = "HITId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_id: Option<String>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListBonusPaymentsResponse {
#[serde(rename = "BonusPayments")]
#[serde(skip_serializing_if = "Option::is_none")]
pub bonus_payments: Option<Vec<BonusPayment>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListHITsForQualificationTypeRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListHITsForQualificationTypeResponse {
#[serde(rename = "HITs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hi_ts: Option<Vec<HIT>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListHITsRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListHITsResponse {
#[serde(rename = "HITs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hi_ts: Option<Vec<HIT>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListQualificationRequestsRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "QualificationTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListQualificationRequestsResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
#[serde(rename = "QualificationRequests")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_requests: Option<Vec<QualificationRequest>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListQualificationTypesRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "MustBeOwnedByCaller")]
#[serde(skip_serializing_if = "Option::is_none")]
pub must_be_owned_by_caller: Option<bool>,
#[serde(rename = "MustBeRequestable")]
pub must_be_requestable: bool,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Query")]
#[serde(skip_serializing_if = "Option::is_none")]
pub query: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListQualificationTypesResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
#[serde(rename = "QualificationTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_types: Option<Vec<QualificationType>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListReviewPolicyResultsForHITRequest {
#[serde(rename = "HITId")]
pub hit_id: String,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "PolicyLevels")]
#[serde(skip_serializing_if = "Option::is_none")]
pub policy_levels: Option<Vec<String>>,
#[serde(rename = "RetrieveActions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retrieve_actions: Option<bool>,
#[serde(rename = "RetrieveResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retrieve_results: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListReviewPolicyResultsForHITResponse {
#[serde(rename = "AssignmentReviewPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_review_policy: Option<ReviewPolicy>,
#[serde(rename = "AssignmentReviewReport")]
#[serde(skip_serializing_if = "Option::is_none")]
pub assignment_review_report: Option<ReviewReport>,
#[serde(rename = "HITId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_id: Option<String>,
#[serde(rename = "HITReviewPolicy")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_review_policy: Option<ReviewPolicy>,
#[serde(rename = "HITReviewReport")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_review_report: Option<ReviewReport>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListReviewableHITsRequest {
#[serde(rename = "HITTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hit_type_id: Option<String>,
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListReviewableHITsResponse {
#[serde(rename = "HITs")]
#[serde(skip_serializing_if = "Option::is_none")]
pub hi_ts: Option<Vec<HIT>>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListWorkerBlocksRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListWorkerBlocksResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
#[serde(rename = "WorkerBlocks")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_blocks: Option<Vec<WorkerBlock>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct ListWorkersWithQualificationTypeRequest {
#[serde(rename = "MaxResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub max_results: Option<i64>,
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ListWorkersWithQualificationTypeResponse {
#[serde(rename = "NextToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub next_token: Option<String>,
#[serde(rename = "NumResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
#[serde(rename = "Qualifications")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualifications: Option<Vec<Qualification>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Locale {
#[serde(rename = "Country")]
pub country: String,
#[serde(rename = "Subdivision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subdivision: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NotificationSpecification {
#[serde(rename = "Destination")]
pub destination: String,
#[serde(rename = "EventTypes")]
pub event_types: Vec<String>,
#[serde(rename = "Transport")]
pub transport: String,
#[serde(rename = "Version")]
pub version: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NotifyWorkersFailureStatus {
#[serde(rename = "NotifyWorkersFailureCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notify_workers_failure_code: Option<String>,
#[serde(rename = "NotifyWorkersFailureMessage")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notify_workers_failure_message: Option<String>,
#[serde(rename = "WorkerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct NotifyWorkersRequest {
#[serde(rename = "MessageText")]
pub message_text: String,
#[serde(rename = "Subject")]
pub subject: String,
#[serde(rename = "WorkerIds")]
pub worker_ids: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct NotifyWorkersResponse {
#[serde(rename = "NotifyWorkersFailureStatuses")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notify_workers_failure_statuses: Option<Vec<NotifyWorkersFailureStatus>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ParameterMapEntry {
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "Values")]
#[serde(skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PolicyParameter {
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "MapEntries")]
#[serde(skip_serializing_if = "Option::is_none")]
pub map_entries: Option<Vec<ParameterMapEntry>>,
#[serde(rename = "Values")]
#[serde(skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Qualification {
#[serde(rename = "GrantTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub grant_time: Option<f64>,
#[serde(rename = "IntegerValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integer_value: Option<i64>,
#[serde(rename = "LocaleValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale_value: Option<Locale>,
#[serde(rename = "QualificationTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type_id: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "WorkerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct QualificationRequest {
#[serde(rename = "Answer")]
#[serde(skip_serializing_if = "Option::is_none")]
pub answer: Option<String>,
#[serde(rename = "QualificationRequestId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_request_id: Option<String>,
#[serde(rename = "QualificationTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type_id: Option<String>,
#[serde(rename = "SubmitTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub submit_time: Option<f64>,
#[serde(rename = "Test")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test: Option<String>,
#[serde(rename = "WorkerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_id: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct QualificationRequirement {
#[serde(rename = "ActionsGuarded")]
#[serde(skip_serializing_if = "Option::is_none")]
pub actions_guarded: Option<String>,
#[serde(rename = "Comparator")]
pub comparator: String,
#[serde(rename = "IntegerValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub integer_values: Option<Vec<i64>>,
#[serde(rename = "LocaleValues")]
#[serde(skip_serializing_if = "Option::is_none")]
pub locale_values: Option<Vec<Locale>>,
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct QualificationType {
#[serde(rename = "AnswerKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub answer_key: Option<String>,
#[serde(rename = "AutoGranted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_granted: Option<bool>,
#[serde(rename = "AutoGrantedValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_granted_value: Option<i64>,
#[serde(rename = "CreationTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub creation_time: Option<f64>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "IsRequestable")]
#[serde(skip_serializing_if = "Option::is_none")]
pub is_requestable: Option<bool>,
#[serde(rename = "Keywords")]
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<String>,
#[serde(rename = "Name")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "QualificationTypeId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type_id: Option<String>,
#[serde(rename = "QualificationTypeStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type_status: Option<String>,
#[serde(rename = "RetryDelayInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retry_delay_in_seconds: Option<i64>,
#[serde(rename = "Test")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test: Option<String>,
#[serde(rename = "TestDurationInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test_duration_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RejectAssignmentRequest {
#[serde(rename = "AssignmentId")]
pub assignment_id: String,
#[serde(rename = "RequesterFeedback")]
pub requester_feedback: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RejectAssignmentResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct RejectQualificationRequestRequest {
#[serde(rename = "QualificationRequestId")]
pub qualification_request_id: String,
#[serde(rename = "Reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct RejectQualificationRequestResponse {}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ReviewActionDetail {
#[serde(rename = "ActionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_id: Option<String>,
#[serde(rename = "ActionName")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_name: Option<String>,
#[serde(rename = "CompleteTime")]
#[serde(skip_serializing_if = "Option::is_none")]
pub complete_time: Option<f64>,
#[serde(rename = "ErrorCode")]
#[serde(skip_serializing_if = "Option::is_none")]
pub error_code: Option<String>,
#[serde(rename = "Result")]
#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<String>,
#[serde(rename = "Status")]
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[serde(rename = "TargetId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_id: Option<String>,
#[serde(rename = "TargetType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub target_type: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ReviewPolicy {
#[serde(rename = "Parameters")]
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<Vec<PolicyParameter>>,
#[serde(rename = "PolicyName")]
pub policy_name: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ReviewReport {
#[serde(rename = "ReviewActions")]
#[serde(skip_serializing_if = "Option::is_none")]
pub review_actions: Option<Vec<ReviewActionDetail>>,
#[serde(rename = "ReviewResults")]
#[serde(skip_serializing_if = "Option::is_none")]
pub review_results: Option<Vec<ReviewResultDetail>>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ReviewResultDetail {
#[serde(rename = "ActionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub action_id: Option<String>,
#[serde(rename = "Key")]
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "QuestionId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub question_id: Option<String>,
#[serde(rename = "SubjectId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subject_id: Option<String>,
#[serde(rename = "SubjectType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub subject_type: Option<String>,
#[serde(rename = "Value")]
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SendBonusRequest {
#[serde(rename = "AssignmentId")]
pub assignment_id: String,
#[serde(rename = "BonusAmount")]
pub bonus_amount: String,
#[serde(rename = "Reason")]
pub reason: String,
#[serde(rename = "UniqueRequestToken")]
#[serde(skip_serializing_if = "Option::is_none")]
pub unique_request_token: Option<String>,
#[serde(rename = "WorkerId")]
pub worker_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SendBonusResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct SendTestEventNotificationRequest {
#[serde(rename = "Notification")]
pub notification: NotificationSpecification,
#[serde(rename = "TestEventType")]
pub test_event_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct SendTestEventNotificationResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateExpirationForHITRequest {
#[serde(rename = "ExpireAt")]
pub expire_at: f64,
#[serde(rename = "HITId")]
pub hit_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateExpirationForHITResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateHITReviewStatusRequest {
#[serde(rename = "HITId")]
pub hit_id: String,
#[serde(rename = "Revert")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revert: Option<bool>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateHITReviewStatusResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateHITTypeOfHITRequest {
#[serde(rename = "HITId")]
pub hit_id: String,
#[serde(rename = "HITTypeId")]
pub hit_type_id: String,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateHITTypeOfHITResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateNotificationSettingsRequest {
#[serde(rename = "Active")]
#[serde(skip_serializing_if = "Option::is_none")]
pub active: Option<bool>,
#[serde(rename = "HITTypeId")]
pub hit_type_id: String,
#[serde(rename = "Notification")]
#[serde(skip_serializing_if = "Option::is_none")]
pub notification: Option<NotificationSpecification>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateNotificationSettingsResponse {}
#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateQualificationTypeRequest {
#[serde(rename = "AnswerKey")]
#[serde(skip_serializing_if = "Option::is_none")]
pub answer_key: Option<String>,
#[serde(rename = "AutoGranted")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_granted: Option<bool>,
#[serde(rename = "AutoGrantedValue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_granted_value: Option<i64>,
#[serde(rename = "Description")]
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "QualificationTypeId")]
pub qualification_type_id: String,
#[serde(rename = "QualificationTypeStatus")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type_status: Option<String>,
#[serde(rename = "RetryDelayInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub retry_delay_in_seconds: Option<i64>,
#[serde(rename = "Test")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test: Option<String>,
#[serde(rename = "TestDurationInSeconds")]
#[serde(skip_serializing_if = "Option::is_none")]
pub test_duration_in_seconds: Option<i64>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateQualificationTypeResponse {
#[serde(rename = "QualificationType")]
#[serde(skip_serializing_if = "Option::is_none")]
pub qualification_type: Option<QualificationType>,
}
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct WorkerBlock {
#[serde(rename = "Reason")]
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
#[serde(rename = "WorkerId")]
#[serde(skip_serializing_if = "Option::is_none")]
pub worker_id: Option<String>,
}
#[derive(Debug, PartialEq)]
pub enum AcceptQualificationRequestError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AcceptQualificationRequestError {
pub fn from_response(res: BufferedHttpResponse) -> AcceptQualificationRequestError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return AcceptQualificationRequestError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return AcceptQualificationRequestError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return AcceptQualificationRequestError::Validation(error_message.to_string());
}
_ => {}
}
}
return AcceptQualificationRequestError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AcceptQualificationRequestError {
fn from(err: serde_json::error::Error) -> AcceptQualificationRequestError {
AcceptQualificationRequestError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AcceptQualificationRequestError {
fn from(err: CredentialsError) -> AcceptQualificationRequestError {
AcceptQualificationRequestError::Credentials(err)
}
}
impl From<HttpDispatchError> for AcceptQualificationRequestError {
fn from(err: HttpDispatchError) -> AcceptQualificationRequestError {
AcceptQualificationRequestError::HttpDispatch(err)
}
}
impl From<io::Error> for AcceptQualificationRequestError {
fn from(err: io::Error) -> AcceptQualificationRequestError {
AcceptQualificationRequestError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AcceptQualificationRequestError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AcceptQualificationRequestError {
fn description(&self) -> &str {
match *self {
AcceptQualificationRequestError::RequestError(ref cause) => cause,
AcceptQualificationRequestError::ServiceFault(ref cause) => cause,
AcceptQualificationRequestError::Validation(ref cause) => cause,
AcceptQualificationRequestError::Credentials(ref err) => err.description(),
AcceptQualificationRequestError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AcceptQualificationRequestError::ParseError(ref cause) => cause,
AcceptQualificationRequestError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ApproveAssignmentError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ApproveAssignmentError {
pub fn from_response(res: BufferedHttpResponse) -> ApproveAssignmentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ApproveAssignmentError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ApproveAssignmentError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ApproveAssignmentError::Validation(error_message.to_string());
}
_ => {}
}
}
return ApproveAssignmentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ApproveAssignmentError {
fn from(err: serde_json::error::Error) -> ApproveAssignmentError {
ApproveAssignmentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ApproveAssignmentError {
fn from(err: CredentialsError) -> ApproveAssignmentError {
ApproveAssignmentError::Credentials(err)
}
}
impl From<HttpDispatchError> for ApproveAssignmentError {
fn from(err: HttpDispatchError) -> ApproveAssignmentError {
ApproveAssignmentError::HttpDispatch(err)
}
}
impl From<io::Error> for ApproveAssignmentError {
fn from(err: io::Error) -> ApproveAssignmentError {
ApproveAssignmentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ApproveAssignmentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ApproveAssignmentError {
fn description(&self) -> &str {
match *self {
ApproveAssignmentError::RequestError(ref cause) => cause,
ApproveAssignmentError::ServiceFault(ref cause) => cause,
ApproveAssignmentError::Validation(ref cause) => cause,
ApproveAssignmentError::Credentials(ref err) => err.description(),
ApproveAssignmentError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ApproveAssignmentError::ParseError(ref cause) => cause,
ApproveAssignmentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum AssociateQualificationWithWorkerError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl AssociateQualificationWithWorkerError {
pub fn from_response(res: BufferedHttpResponse) -> AssociateQualificationWithWorkerError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return AssociateQualificationWithWorkerError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return AssociateQualificationWithWorkerError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return AssociateQualificationWithWorkerError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return AssociateQualificationWithWorkerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for AssociateQualificationWithWorkerError {
fn from(err: serde_json::error::Error) -> AssociateQualificationWithWorkerError {
AssociateQualificationWithWorkerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for AssociateQualificationWithWorkerError {
fn from(err: CredentialsError) -> AssociateQualificationWithWorkerError {
AssociateQualificationWithWorkerError::Credentials(err)
}
}
impl From<HttpDispatchError> for AssociateQualificationWithWorkerError {
fn from(err: HttpDispatchError) -> AssociateQualificationWithWorkerError {
AssociateQualificationWithWorkerError::HttpDispatch(err)
}
}
impl From<io::Error> for AssociateQualificationWithWorkerError {
fn from(err: io::Error) -> AssociateQualificationWithWorkerError {
AssociateQualificationWithWorkerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for AssociateQualificationWithWorkerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for AssociateQualificationWithWorkerError {
fn description(&self) -> &str {
match *self {
AssociateQualificationWithWorkerError::RequestError(ref cause) => cause,
AssociateQualificationWithWorkerError::ServiceFault(ref cause) => cause,
AssociateQualificationWithWorkerError::Validation(ref cause) => cause,
AssociateQualificationWithWorkerError::Credentials(ref err) => err.description(),
AssociateQualificationWithWorkerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
AssociateQualificationWithWorkerError::ParseError(ref cause) => cause,
AssociateQualificationWithWorkerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateAdditionalAssignmentsForHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateAdditionalAssignmentsForHITError {
pub fn from_response(res: BufferedHttpResponse) -> CreateAdditionalAssignmentsForHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return CreateAdditionalAssignmentsForHITError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return CreateAdditionalAssignmentsForHITError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return CreateAdditionalAssignmentsForHITError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return CreateAdditionalAssignmentsForHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateAdditionalAssignmentsForHITError {
fn from(err: serde_json::error::Error) -> CreateAdditionalAssignmentsForHITError {
CreateAdditionalAssignmentsForHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateAdditionalAssignmentsForHITError {
fn from(err: CredentialsError) -> CreateAdditionalAssignmentsForHITError {
CreateAdditionalAssignmentsForHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateAdditionalAssignmentsForHITError {
fn from(err: HttpDispatchError) -> CreateAdditionalAssignmentsForHITError {
CreateAdditionalAssignmentsForHITError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateAdditionalAssignmentsForHITError {
fn from(err: io::Error) -> CreateAdditionalAssignmentsForHITError {
CreateAdditionalAssignmentsForHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateAdditionalAssignmentsForHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateAdditionalAssignmentsForHITError {
fn description(&self) -> &str {
match *self {
CreateAdditionalAssignmentsForHITError::RequestError(ref cause) => cause,
CreateAdditionalAssignmentsForHITError::ServiceFault(ref cause) => cause,
CreateAdditionalAssignmentsForHITError::Validation(ref cause) => cause,
CreateAdditionalAssignmentsForHITError::Credentials(ref err) => err.description(),
CreateAdditionalAssignmentsForHITError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateAdditionalAssignmentsForHITError::ParseError(ref cause) => cause,
CreateAdditionalAssignmentsForHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateHITError {
pub fn from_response(res: BufferedHttpResponse) -> CreateHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => return CreateHITError::RequestError(String::from(error_message)),
"ServiceFault" => return CreateHITError::ServiceFault(String::from(error_message)),
"ValidationException" => {
return CreateHITError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateHITError {
fn from(err: serde_json::error::Error) -> CreateHITError {
CreateHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateHITError {
fn from(err: CredentialsError) -> CreateHITError {
CreateHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateHITError {
fn from(err: HttpDispatchError) -> CreateHITError {
CreateHITError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateHITError {
fn from(err: io::Error) -> CreateHITError {
CreateHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateHITError {
fn description(&self) -> &str {
match *self {
CreateHITError::RequestError(ref cause) => cause,
CreateHITError::ServiceFault(ref cause) => cause,
CreateHITError::Validation(ref cause) => cause,
CreateHITError::Credentials(ref err) => err.description(),
CreateHITError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateHITError::ParseError(ref cause) => cause,
CreateHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateHITTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateHITTypeError {
pub fn from_response(res: BufferedHttpResponse) -> CreateHITTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return CreateHITTypeError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return CreateHITTypeError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return CreateHITTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateHITTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateHITTypeError {
fn from(err: serde_json::error::Error) -> CreateHITTypeError {
CreateHITTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateHITTypeError {
fn from(err: CredentialsError) -> CreateHITTypeError {
CreateHITTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateHITTypeError {
fn from(err: HttpDispatchError) -> CreateHITTypeError {
CreateHITTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateHITTypeError {
fn from(err: io::Error) -> CreateHITTypeError {
CreateHITTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateHITTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateHITTypeError {
fn description(&self) -> &str {
match *self {
CreateHITTypeError::RequestError(ref cause) => cause,
CreateHITTypeError::ServiceFault(ref cause) => cause,
CreateHITTypeError::Validation(ref cause) => cause,
CreateHITTypeError::Credentials(ref err) => err.description(),
CreateHITTypeError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
CreateHITTypeError::ParseError(ref cause) => cause,
CreateHITTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateHITWithHITTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateHITWithHITTypeError {
pub fn from_response(res: BufferedHttpResponse) -> CreateHITWithHITTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return CreateHITWithHITTypeError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return CreateHITWithHITTypeError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return CreateHITWithHITTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateHITWithHITTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateHITWithHITTypeError {
fn from(err: serde_json::error::Error) -> CreateHITWithHITTypeError {
CreateHITWithHITTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateHITWithHITTypeError {
fn from(err: CredentialsError) -> CreateHITWithHITTypeError {
CreateHITWithHITTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateHITWithHITTypeError {
fn from(err: HttpDispatchError) -> CreateHITWithHITTypeError {
CreateHITWithHITTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateHITWithHITTypeError {
fn from(err: io::Error) -> CreateHITWithHITTypeError {
CreateHITWithHITTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateHITWithHITTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateHITWithHITTypeError {
fn description(&self) -> &str {
match *self {
CreateHITWithHITTypeError::RequestError(ref cause) => cause,
CreateHITWithHITTypeError::ServiceFault(ref cause) => cause,
CreateHITWithHITTypeError::Validation(ref cause) => cause,
CreateHITWithHITTypeError::Credentials(ref err) => err.description(),
CreateHITWithHITTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateHITWithHITTypeError::ParseError(ref cause) => cause,
CreateHITWithHITTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateQualificationTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateQualificationTypeError {
pub fn from_response(res: BufferedHttpResponse) -> CreateQualificationTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return CreateQualificationTypeError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return CreateQualificationTypeError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return CreateQualificationTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateQualificationTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateQualificationTypeError {
fn from(err: serde_json::error::Error) -> CreateQualificationTypeError {
CreateQualificationTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateQualificationTypeError {
fn from(err: CredentialsError) -> CreateQualificationTypeError {
CreateQualificationTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateQualificationTypeError {
fn from(err: HttpDispatchError) -> CreateQualificationTypeError {
CreateQualificationTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateQualificationTypeError {
fn from(err: io::Error) -> CreateQualificationTypeError {
CreateQualificationTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateQualificationTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateQualificationTypeError {
fn description(&self) -> &str {
match *self {
CreateQualificationTypeError::RequestError(ref cause) => cause,
CreateQualificationTypeError::ServiceFault(ref cause) => cause,
CreateQualificationTypeError::Validation(ref cause) => cause,
CreateQualificationTypeError::Credentials(ref err) => err.description(),
CreateQualificationTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateQualificationTypeError::ParseError(ref cause) => cause,
CreateQualificationTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum CreateWorkerBlockError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl CreateWorkerBlockError {
pub fn from_response(res: BufferedHttpResponse) -> CreateWorkerBlockError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return CreateWorkerBlockError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return CreateWorkerBlockError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return CreateWorkerBlockError::Validation(error_message.to_string());
}
_ => {}
}
}
return CreateWorkerBlockError::Unknown(res);
}
}
impl From<serde_json::error::Error> for CreateWorkerBlockError {
fn from(err: serde_json::error::Error) -> CreateWorkerBlockError {
CreateWorkerBlockError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for CreateWorkerBlockError {
fn from(err: CredentialsError) -> CreateWorkerBlockError {
CreateWorkerBlockError::Credentials(err)
}
}
impl From<HttpDispatchError> for CreateWorkerBlockError {
fn from(err: HttpDispatchError) -> CreateWorkerBlockError {
CreateWorkerBlockError::HttpDispatch(err)
}
}
impl From<io::Error> for CreateWorkerBlockError {
fn from(err: io::Error) -> CreateWorkerBlockError {
CreateWorkerBlockError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for CreateWorkerBlockError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for CreateWorkerBlockError {
fn description(&self) -> &str {
match *self {
CreateWorkerBlockError::RequestError(ref cause) => cause,
CreateWorkerBlockError::ServiceFault(ref cause) => cause,
CreateWorkerBlockError::Validation(ref cause) => cause,
CreateWorkerBlockError::Credentials(ref err) => err.description(),
CreateWorkerBlockError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
CreateWorkerBlockError::ParseError(ref cause) => cause,
CreateWorkerBlockError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteHITError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => return DeleteHITError::RequestError(String::from(error_message)),
"ServiceFault" => return DeleteHITError::ServiceFault(String::from(error_message)),
"ValidationException" => {
return DeleteHITError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteHITError {
fn from(err: serde_json::error::Error) -> DeleteHITError {
DeleteHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteHITError {
fn from(err: CredentialsError) -> DeleteHITError {
DeleteHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteHITError {
fn from(err: HttpDispatchError) -> DeleteHITError {
DeleteHITError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteHITError {
fn from(err: io::Error) -> DeleteHITError {
DeleteHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteHITError {
fn description(&self) -> &str {
match *self {
DeleteHITError::RequestError(ref cause) => cause,
DeleteHITError::ServiceFault(ref cause) => cause,
DeleteHITError::Validation(ref cause) => cause,
DeleteHITError::Credentials(ref err) => err.description(),
DeleteHITError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
DeleteHITError::ParseError(ref cause) => cause,
DeleteHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteQualificationTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteQualificationTypeError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteQualificationTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return DeleteQualificationTypeError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return DeleteQualificationTypeError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return DeleteQualificationTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteQualificationTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteQualificationTypeError {
fn from(err: serde_json::error::Error) -> DeleteQualificationTypeError {
DeleteQualificationTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteQualificationTypeError {
fn from(err: CredentialsError) -> DeleteQualificationTypeError {
DeleteQualificationTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteQualificationTypeError {
fn from(err: HttpDispatchError) -> DeleteQualificationTypeError {
DeleteQualificationTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteQualificationTypeError {
fn from(err: io::Error) -> DeleteQualificationTypeError {
DeleteQualificationTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteQualificationTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteQualificationTypeError {
fn description(&self) -> &str {
match *self {
DeleteQualificationTypeError::RequestError(ref cause) => cause,
DeleteQualificationTypeError::ServiceFault(ref cause) => cause,
DeleteQualificationTypeError::Validation(ref cause) => cause,
DeleteQualificationTypeError::Credentials(ref err) => err.description(),
DeleteQualificationTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteQualificationTypeError::ParseError(ref cause) => cause,
DeleteQualificationTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DeleteWorkerBlockError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DeleteWorkerBlockError {
pub fn from_response(res: BufferedHttpResponse) -> DeleteWorkerBlockError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return DeleteWorkerBlockError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return DeleteWorkerBlockError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return DeleteWorkerBlockError::Validation(error_message.to_string());
}
_ => {}
}
}
return DeleteWorkerBlockError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DeleteWorkerBlockError {
fn from(err: serde_json::error::Error) -> DeleteWorkerBlockError {
DeleteWorkerBlockError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DeleteWorkerBlockError {
fn from(err: CredentialsError) -> DeleteWorkerBlockError {
DeleteWorkerBlockError::Credentials(err)
}
}
impl From<HttpDispatchError> for DeleteWorkerBlockError {
fn from(err: HttpDispatchError) -> DeleteWorkerBlockError {
DeleteWorkerBlockError::HttpDispatch(err)
}
}
impl From<io::Error> for DeleteWorkerBlockError {
fn from(err: io::Error) -> DeleteWorkerBlockError {
DeleteWorkerBlockError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DeleteWorkerBlockError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DeleteWorkerBlockError {
fn description(&self) -> &str {
match *self {
DeleteWorkerBlockError::RequestError(ref cause) => cause,
DeleteWorkerBlockError::ServiceFault(ref cause) => cause,
DeleteWorkerBlockError::Validation(ref cause) => cause,
DeleteWorkerBlockError::Credentials(ref err) => err.description(),
DeleteWorkerBlockError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DeleteWorkerBlockError::ParseError(ref cause) => cause,
DeleteWorkerBlockError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum DisassociateQualificationFromWorkerError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl DisassociateQualificationFromWorkerError {
pub fn from_response(res: BufferedHttpResponse) -> DisassociateQualificationFromWorkerError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return DisassociateQualificationFromWorkerError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return DisassociateQualificationFromWorkerError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return DisassociateQualificationFromWorkerError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return DisassociateQualificationFromWorkerError::Unknown(res);
}
}
impl From<serde_json::error::Error> for DisassociateQualificationFromWorkerError {
fn from(err: serde_json::error::Error) -> DisassociateQualificationFromWorkerError {
DisassociateQualificationFromWorkerError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for DisassociateQualificationFromWorkerError {
fn from(err: CredentialsError) -> DisassociateQualificationFromWorkerError {
DisassociateQualificationFromWorkerError::Credentials(err)
}
}
impl From<HttpDispatchError> for DisassociateQualificationFromWorkerError {
fn from(err: HttpDispatchError) -> DisassociateQualificationFromWorkerError {
DisassociateQualificationFromWorkerError::HttpDispatch(err)
}
}
impl From<io::Error> for DisassociateQualificationFromWorkerError {
fn from(err: io::Error) -> DisassociateQualificationFromWorkerError {
DisassociateQualificationFromWorkerError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for DisassociateQualificationFromWorkerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for DisassociateQualificationFromWorkerError {
fn description(&self) -> &str {
match *self {
DisassociateQualificationFromWorkerError::RequestError(ref cause) => cause,
DisassociateQualificationFromWorkerError::ServiceFault(ref cause) => cause,
DisassociateQualificationFromWorkerError::Validation(ref cause) => cause,
DisassociateQualificationFromWorkerError::Credentials(ref err) => err.description(),
DisassociateQualificationFromWorkerError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
DisassociateQualificationFromWorkerError::ParseError(ref cause) => cause,
DisassociateQualificationFromWorkerError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAccountBalanceError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAccountBalanceError {
pub fn from_response(res: BufferedHttpResponse) -> GetAccountBalanceError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return GetAccountBalanceError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return GetAccountBalanceError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return GetAccountBalanceError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetAccountBalanceError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAccountBalanceError {
fn from(err: serde_json::error::Error) -> GetAccountBalanceError {
GetAccountBalanceError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAccountBalanceError {
fn from(err: CredentialsError) -> GetAccountBalanceError {
GetAccountBalanceError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAccountBalanceError {
fn from(err: HttpDispatchError) -> GetAccountBalanceError {
GetAccountBalanceError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAccountBalanceError {
fn from(err: io::Error) -> GetAccountBalanceError {
GetAccountBalanceError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAccountBalanceError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAccountBalanceError {
fn description(&self) -> &str {
match *self {
GetAccountBalanceError::RequestError(ref cause) => cause,
GetAccountBalanceError::ServiceFault(ref cause) => cause,
GetAccountBalanceError::Validation(ref cause) => cause,
GetAccountBalanceError::Credentials(ref err) => err.description(),
GetAccountBalanceError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetAccountBalanceError::ParseError(ref cause) => cause,
GetAccountBalanceError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetAssignmentError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetAssignmentError {
pub fn from_response(res: BufferedHttpResponse) -> GetAssignmentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return GetAssignmentError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return GetAssignmentError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return GetAssignmentError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetAssignmentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetAssignmentError {
fn from(err: serde_json::error::Error) -> GetAssignmentError {
GetAssignmentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetAssignmentError {
fn from(err: CredentialsError) -> GetAssignmentError {
GetAssignmentError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetAssignmentError {
fn from(err: HttpDispatchError) -> GetAssignmentError {
GetAssignmentError::HttpDispatch(err)
}
}
impl From<io::Error> for GetAssignmentError {
fn from(err: io::Error) -> GetAssignmentError {
GetAssignmentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetAssignmentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetAssignmentError {
fn description(&self) -> &str {
match *self {
GetAssignmentError::RequestError(ref cause) => cause,
GetAssignmentError::ServiceFault(ref cause) => cause,
GetAssignmentError::Validation(ref cause) => cause,
GetAssignmentError::Credentials(ref err) => err.description(),
GetAssignmentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetAssignmentError::ParseError(ref cause) => cause,
GetAssignmentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetFileUploadURLError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetFileUploadURLError {
pub fn from_response(res: BufferedHttpResponse) -> GetFileUploadURLError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return GetFileUploadURLError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return GetFileUploadURLError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return GetFileUploadURLError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetFileUploadURLError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetFileUploadURLError {
fn from(err: serde_json::error::Error) -> GetFileUploadURLError {
GetFileUploadURLError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetFileUploadURLError {
fn from(err: CredentialsError) -> GetFileUploadURLError {
GetFileUploadURLError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetFileUploadURLError {
fn from(err: HttpDispatchError) -> GetFileUploadURLError {
GetFileUploadURLError::HttpDispatch(err)
}
}
impl From<io::Error> for GetFileUploadURLError {
fn from(err: io::Error) -> GetFileUploadURLError {
GetFileUploadURLError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetFileUploadURLError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetFileUploadURLError {
fn description(&self) -> &str {
match *self {
GetFileUploadURLError::RequestError(ref cause) => cause,
GetFileUploadURLError::ServiceFault(ref cause) => cause,
GetFileUploadURLError::Validation(ref cause) => cause,
GetFileUploadURLError::Credentials(ref err) => err.description(),
GetFileUploadURLError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetFileUploadURLError::ParseError(ref cause) => cause,
GetFileUploadURLError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetHITError {
pub fn from_response(res: BufferedHttpResponse) -> GetHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => return GetHITError::RequestError(String::from(error_message)),
"ServiceFault" => return GetHITError::ServiceFault(String::from(error_message)),
"ValidationException" => return GetHITError::Validation(error_message.to_string()),
_ => {}
}
}
return GetHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetHITError {
fn from(err: serde_json::error::Error) -> GetHITError {
GetHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetHITError {
fn from(err: CredentialsError) -> GetHITError {
GetHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetHITError {
fn from(err: HttpDispatchError) -> GetHITError {
GetHITError::HttpDispatch(err)
}
}
impl From<io::Error> for GetHITError {
fn from(err: io::Error) -> GetHITError {
GetHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetHITError {
fn description(&self) -> &str {
match *self {
GetHITError::RequestError(ref cause) => cause,
GetHITError::ServiceFault(ref cause) => cause,
GetHITError::Validation(ref cause) => cause,
GetHITError::Credentials(ref err) => err.description(),
GetHITError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
GetHITError::ParseError(ref cause) => cause,
GetHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetQualificationScoreError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetQualificationScoreError {
pub fn from_response(res: BufferedHttpResponse) -> GetQualificationScoreError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return GetQualificationScoreError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return GetQualificationScoreError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return GetQualificationScoreError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetQualificationScoreError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetQualificationScoreError {
fn from(err: serde_json::error::Error) -> GetQualificationScoreError {
GetQualificationScoreError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetQualificationScoreError {
fn from(err: CredentialsError) -> GetQualificationScoreError {
GetQualificationScoreError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetQualificationScoreError {
fn from(err: HttpDispatchError) -> GetQualificationScoreError {
GetQualificationScoreError::HttpDispatch(err)
}
}
impl From<io::Error> for GetQualificationScoreError {
fn from(err: io::Error) -> GetQualificationScoreError {
GetQualificationScoreError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetQualificationScoreError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetQualificationScoreError {
fn description(&self) -> &str {
match *self {
GetQualificationScoreError::RequestError(ref cause) => cause,
GetQualificationScoreError::ServiceFault(ref cause) => cause,
GetQualificationScoreError::Validation(ref cause) => cause,
GetQualificationScoreError::Credentials(ref err) => err.description(),
GetQualificationScoreError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetQualificationScoreError::ParseError(ref cause) => cause,
GetQualificationScoreError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum GetQualificationTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl GetQualificationTypeError {
pub fn from_response(res: BufferedHttpResponse) -> GetQualificationTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return GetQualificationTypeError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return GetQualificationTypeError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return GetQualificationTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return GetQualificationTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for GetQualificationTypeError {
fn from(err: serde_json::error::Error) -> GetQualificationTypeError {
GetQualificationTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for GetQualificationTypeError {
fn from(err: CredentialsError) -> GetQualificationTypeError {
GetQualificationTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for GetQualificationTypeError {
fn from(err: HttpDispatchError) -> GetQualificationTypeError {
GetQualificationTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for GetQualificationTypeError {
fn from(err: io::Error) -> GetQualificationTypeError {
GetQualificationTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for GetQualificationTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for GetQualificationTypeError {
fn description(&self) -> &str {
match *self {
GetQualificationTypeError::RequestError(ref cause) => cause,
GetQualificationTypeError::ServiceFault(ref cause) => cause,
GetQualificationTypeError::Validation(ref cause) => cause,
GetQualificationTypeError::Credentials(ref err) => err.description(),
GetQualificationTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
GetQualificationTypeError::ParseError(ref cause) => cause,
GetQualificationTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListAssignmentsForHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListAssignmentsForHITError {
pub fn from_response(res: BufferedHttpResponse) -> ListAssignmentsForHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListAssignmentsForHITError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ListAssignmentsForHITError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ListAssignmentsForHITError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListAssignmentsForHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListAssignmentsForHITError {
fn from(err: serde_json::error::Error) -> ListAssignmentsForHITError {
ListAssignmentsForHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListAssignmentsForHITError {
fn from(err: CredentialsError) -> ListAssignmentsForHITError {
ListAssignmentsForHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListAssignmentsForHITError {
fn from(err: HttpDispatchError) -> ListAssignmentsForHITError {
ListAssignmentsForHITError::HttpDispatch(err)
}
}
impl From<io::Error> for ListAssignmentsForHITError {
fn from(err: io::Error) -> ListAssignmentsForHITError {
ListAssignmentsForHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListAssignmentsForHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListAssignmentsForHITError {
fn description(&self) -> &str {
match *self {
ListAssignmentsForHITError::RequestError(ref cause) => cause,
ListAssignmentsForHITError::ServiceFault(ref cause) => cause,
ListAssignmentsForHITError::Validation(ref cause) => cause,
ListAssignmentsForHITError::Credentials(ref err) => err.description(),
ListAssignmentsForHITError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListAssignmentsForHITError::ParseError(ref cause) => cause,
ListAssignmentsForHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListBonusPaymentsError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListBonusPaymentsError {
pub fn from_response(res: BufferedHttpResponse) -> ListBonusPaymentsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListBonusPaymentsError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ListBonusPaymentsError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ListBonusPaymentsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListBonusPaymentsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListBonusPaymentsError {
fn from(err: serde_json::error::Error) -> ListBonusPaymentsError {
ListBonusPaymentsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListBonusPaymentsError {
fn from(err: CredentialsError) -> ListBonusPaymentsError {
ListBonusPaymentsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListBonusPaymentsError {
fn from(err: HttpDispatchError) -> ListBonusPaymentsError {
ListBonusPaymentsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListBonusPaymentsError {
fn from(err: io::Error) -> ListBonusPaymentsError {
ListBonusPaymentsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListBonusPaymentsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListBonusPaymentsError {
fn description(&self) -> &str {
match *self {
ListBonusPaymentsError::RequestError(ref cause) => cause,
ListBonusPaymentsError::ServiceFault(ref cause) => cause,
ListBonusPaymentsError::Validation(ref cause) => cause,
ListBonusPaymentsError::Credentials(ref err) => err.description(),
ListBonusPaymentsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListBonusPaymentsError::ParseError(ref cause) => cause,
ListBonusPaymentsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListHITsError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListHITsError {
pub fn from_response(res: BufferedHttpResponse) -> ListHITsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => return ListHITsError::RequestError(String::from(error_message)),
"ServiceFault" => return ListHITsError::ServiceFault(String::from(error_message)),
"ValidationException" => {
return ListHITsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListHITsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListHITsError {
fn from(err: serde_json::error::Error) -> ListHITsError {
ListHITsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListHITsError {
fn from(err: CredentialsError) -> ListHITsError {
ListHITsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListHITsError {
fn from(err: HttpDispatchError) -> ListHITsError {
ListHITsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListHITsError {
fn from(err: io::Error) -> ListHITsError {
ListHITsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListHITsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListHITsError {
fn description(&self) -> &str {
match *self {
ListHITsError::RequestError(ref cause) => cause,
ListHITsError::ServiceFault(ref cause) => cause,
ListHITsError::Validation(ref cause) => cause,
ListHITsError::Credentials(ref err) => err.description(),
ListHITsError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListHITsError::ParseError(ref cause) => cause,
ListHITsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListHITsForQualificationTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListHITsForQualificationTypeError {
pub fn from_response(res: BufferedHttpResponse) -> ListHITsForQualificationTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListHITsForQualificationTypeError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return ListHITsForQualificationTypeError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return ListHITsForQualificationTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListHITsForQualificationTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListHITsForQualificationTypeError {
fn from(err: serde_json::error::Error) -> ListHITsForQualificationTypeError {
ListHITsForQualificationTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListHITsForQualificationTypeError {
fn from(err: CredentialsError) -> ListHITsForQualificationTypeError {
ListHITsForQualificationTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListHITsForQualificationTypeError {
fn from(err: HttpDispatchError) -> ListHITsForQualificationTypeError {
ListHITsForQualificationTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for ListHITsForQualificationTypeError {
fn from(err: io::Error) -> ListHITsForQualificationTypeError {
ListHITsForQualificationTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListHITsForQualificationTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListHITsForQualificationTypeError {
fn description(&self) -> &str {
match *self {
ListHITsForQualificationTypeError::RequestError(ref cause) => cause,
ListHITsForQualificationTypeError::ServiceFault(ref cause) => cause,
ListHITsForQualificationTypeError::Validation(ref cause) => cause,
ListHITsForQualificationTypeError::Credentials(ref err) => err.description(),
ListHITsForQualificationTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListHITsForQualificationTypeError::ParseError(ref cause) => cause,
ListHITsForQualificationTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListQualificationRequestsError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListQualificationRequestsError {
pub fn from_response(res: BufferedHttpResponse) -> ListQualificationRequestsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListQualificationRequestsError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ListQualificationRequestsError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ListQualificationRequestsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListQualificationRequestsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListQualificationRequestsError {
fn from(err: serde_json::error::Error) -> ListQualificationRequestsError {
ListQualificationRequestsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListQualificationRequestsError {
fn from(err: CredentialsError) -> ListQualificationRequestsError {
ListQualificationRequestsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListQualificationRequestsError {
fn from(err: HttpDispatchError) -> ListQualificationRequestsError {
ListQualificationRequestsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListQualificationRequestsError {
fn from(err: io::Error) -> ListQualificationRequestsError {
ListQualificationRequestsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListQualificationRequestsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListQualificationRequestsError {
fn description(&self) -> &str {
match *self {
ListQualificationRequestsError::RequestError(ref cause) => cause,
ListQualificationRequestsError::ServiceFault(ref cause) => cause,
ListQualificationRequestsError::Validation(ref cause) => cause,
ListQualificationRequestsError::Credentials(ref err) => err.description(),
ListQualificationRequestsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListQualificationRequestsError::ParseError(ref cause) => cause,
ListQualificationRequestsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListQualificationTypesError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListQualificationTypesError {
pub fn from_response(res: BufferedHttpResponse) -> ListQualificationTypesError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListQualificationTypesError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ListQualificationTypesError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ListQualificationTypesError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListQualificationTypesError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListQualificationTypesError {
fn from(err: serde_json::error::Error) -> ListQualificationTypesError {
ListQualificationTypesError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListQualificationTypesError {
fn from(err: CredentialsError) -> ListQualificationTypesError {
ListQualificationTypesError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListQualificationTypesError {
fn from(err: HttpDispatchError) -> ListQualificationTypesError {
ListQualificationTypesError::HttpDispatch(err)
}
}
impl From<io::Error> for ListQualificationTypesError {
fn from(err: io::Error) -> ListQualificationTypesError {
ListQualificationTypesError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListQualificationTypesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListQualificationTypesError {
fn description(&self) -> &str {
match *self {
ListQualificationTypesError::RequestError(ref cause) => cause,
ListQualificationTypesError::ServiceFault(ref cause) => cause,
ListQualificationTypesError::Validation(ref cause) => cause,
ListQualificationTypesError::Credentials(ref err) => err.description(),
ListQualificationTypesError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListQualificationTypesError::ParseError(ref cause) => cause,
ListQualificationTypesError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListReviewPolicyResultsForHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListReviewPolicyResultsForHITError {
pub fn from_response(res: BufferedHttpResponse) -> ListReviewPolicyResultsForHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListReviewPolicyResultsForHITError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return ListReviewPolicyResultsForHITError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return ListReviewPolicyResultsForHITError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListReviewPolicyResultsForHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListReviewPolicyResultsForHITError {
fn from(err: serde_json::error::Error) -> ListReviewPolicyResultsForHITError {
ListReviewPolicyResultsForHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListReviewPolicyResultsForHITError {
fn from(err: CredentialsError) -> ListReviewPolicyResultsForHITError {
ListReviewPolicyResultsForHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListReviewPolicyResultsForHITError {
fn from(err: HttpDispatchError) -> ListReviewPolicyResultsForHITError {
ListReviewPolicyResultsForHITError::HttpDispatch(err)
}
}
impl From<io::Error> for ListReviewPolicyResultsForHITError {
fn from(err: io::Error) -> ListReviewPolicyResultsForHITError {
ListReviewPolicyResultsForHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListReviewPolicyResultsForHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListReviewPolicyResultsForHITError {
fn description(&self) -> &str {
match *self {
ListReviewPolicyResultsForHITError::RequestError(ref cause) => cause,
ListReviewPolicyResultsForHITError::ServiceFault(ref cause) => cause,
ListReviewPolicyResultsForHITError::Validation(ref cause) => cause,
ListReviewPolicyResultsForHITError::Credentials(ref err) => err.description(),
ListReviewPolicyResultsForHITError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListReviewPolicyResultsForHITError::ParseError(ref cause) => cause,
ListReviewPolicyResultsForHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListReviewableHITsError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListReviewableHITsError {
pub fn from_response(res: BufferedHttpResponse) -> ListReviewableHITsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListReviewableHITsError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ListReviewableHITsError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ListReviewableHITsError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListReviewableHITsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListReviewableHITsError {
fn from(err: serde_json::error::Error) -> ListReviewableHITsError {
ListReviewableHITsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListReviewableHITsError {
fn from(err: CredentialsError) -> ListReviewableHITsError {
ListReviewableHITsError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListReviewableHITsError {
fn from(err: HttpDispatchError) -> ListReviewableHITsError {
ListReviewableHITsError::HttpDispatch(err)
}
}
impl From<io::Error> for ListReviewableHITsError {
fn from(err: io::Error) -> ListReviewableHITsError {
ListReviewableHITsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListReviewableHITsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListReviewableHITsError {
fn description(&self) -> &str {
match *self {
ListReviewableHITsError::RequestError(ref cause) => cause,
ListReviewableHITsError::ServiceFault(ref cause) => cause,
ListReviewableHITsError::Validation(ref cause) => cause,
ListReviewableHITsError::Credentials(ref err) => err.description(),
ListReviewableHITsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListReviewableHITsError::ParseError(ref cause) => cause,
ListReviewableHITsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListWorkerBlocksError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListWorkerBlocksError {
pub fn from_response(res: BufferedHttpResponse) -> ListWorkerBlocksError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListWorkerBlocksError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return ListWorkerBlocksError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return ListWorkerBlocksError::Validation(error_message.to_string());
}
_ => {}
}
}
return ListWorkerBlocksError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListWorkerBlocksError {
fn from(err: serde_json::error::Error) -> ListWorkerBlocksError {
ListWorkerBlocksError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListWorkerBlocksError {
fn from(err: CredentialsError) -> ListWorkerBlocksError {
ListWorkerBlocksError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListWorkerBlocksError {
fn from(err: HttpDispatchError) -> ListWorkerBlocksError {
ListWorkerBlocksError::HttpDispatch(err)
}
}
impl From<io::Error> for ListWorkerBlocksError {
fn from(err: io::Error) -> ListWorkerBlocksError {
ListWorkerBlocksError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListWorkerBlocksError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListWorkerBlocksError {
fn description(&self) -> &str {
match *self {
ListWorkerBlocksError::RequestError(ref cause) => cause,
ListWorkerBlocksError::ServiceFault(ref cause) => cause,
ListWorkerBlocksError::Validation(ref cause) => cause,
ListWorkerBlocksError::Credentials(ref err) => err.description(),
ListWorkerBlocksError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
ListWorkerBlocksError::ParseError(ref cause) => cause,
ListWorkerBlocksError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum ListWorkersWithQualificationTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl ListWorkersWithQualificationTypeError {
pub fn from_response(res: BufferedHttpResponse) -> ListWorkersWithQualificationTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return ListWorkersWithQualificationTypeError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return ListWorkersWithQualificationTypeError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return ListWorkersWithQualificationTypeError::Validation(
error_message.to_string(),
);
}
_ => {}
}
}
return ListWorkersWithQualificationTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for ListWorkersWithQualificationTypeError {
fn from(err: serde_json::error::Error) -> ListWorkersWithQualificationTypeError {
ListWorkersWithQualificationTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for ListWorkersWithQualificationTypeError {
fn from(err: CredentialsError) -> ListWorkersWithQualificationTypeError {
ListWorkersWithQualificationTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for ListWorkersWithQualificationTypeError {
fn from(err: HttpDispatchError) -> ListWorkersWithQualificationTypeError {
ListWorkersWithQualificationTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for ListWorkersWithQualificationTypeError {
fn from(err: io::Error) -> ListWorkersWithQualificationTypeError {
ListWorkersWithQualificationTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for ListWorkersWithQualificationTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for ListWorkersWithQualificationTypeError {
fn description(&self) -> &str {
match *self {
ListWorkersWithQualificationTypeError::RequestError(ref cause) => cause,
ListWorkersWithQualificationTypeError::ServiceFault(ref cause) => cause,
ListWorkersWithQualificationTypeError::Validation(ref cause) => cause,
ListWorkersWithQualificationTypeError::Credentials(ref err) => err.description(),
ListWorkersWithQualificationTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
ListWorkersWithQualificationTypeError::ParseError(ref cause) => cause,
ListWorkersWithQualificationTypeError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum NotifyWorkersError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl NotifyWorkersError {
pub fn from_response(res: BufferedHttpResponse) -> NotifyWorkersError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return NotifyWorkersError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return NotifyWorkersError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return NotifyWorkersError::Validation(error_message.to_string());
}
_ => {}
}
}
return NotifyWorkersError::Unknown(res);
}
}
impl From<serde_json::error::Error> for NotifyWorkersError {
fn from(err: serde_json::error::Error) -> NotifyWorkersError {
NotifyWorkersError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for NotifyWorkersError {
fn from(err: CredentialsError) -> NotifyWorkersError {
NotifyWorkersError::Credentials(err)
}
}
impl From<HttpDispatchError> for NotifyWorkersError {
fn from(err: HttpDispatchError) -> NotifyWorkersError {
NotifyWorkersError::HttpDispatch(err)
}
}
impl From<io::Error> for NotifyWorkersError {
fn from(err: io::Error) -> NotifyWorkersError {
NotifyWorkersError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for NotifyWorkersError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for NotifyWorkersError {
fn description(&self) -> &str {
match *self {
NotifyWorkersError::RequestError(ref cause) => cause,
NotifyWorkersError::ServiceFault(ref cause) => cause,
NotifyWorkersError::Validation(ref cause) => cause,
NotifyWorkersError::Credentials(ref err) => err.description(),
NotifyWorkersError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
NotifyWorkersError::ParseError(ref cause) => cause,
NotifyWorkersError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RejectAssignmentError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RejectAssignmentError {
pub fn from_response(res: BufferedHttpResponse) -> RejectAssignmentError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return RejectAssignmentError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return RejectAssignmentError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return RejectAssignmentError::Validation(error_message.to_string());
}
_ => {}
}
}
return RejectAssignmentError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RejectAssignmentError {
fn from(err: serde_json::error::Error) -> RejectAssignmentError {
RejectAssignmentError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RejectAssignmentError {
fn from(err: CredentialsError) -> RejectAssignmentError {
RejectAssignmentError::Credentials(err)
}
}
impl From<HttpDispatchError> for RejectAssignmentError {
fn from(err: HttpDispatchError) -> RejectAssignmentError {
RejectAssignmentError::HttpDispatch(err)
}
}
impl From<io::Error> for RejectAssignmentError {
fn from(err: io::Error) -> RejectAssignmentError {
RejectAssignmentError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RejectAssignmentError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RejectAssignmentError {
fn description(&self) -> &str {
match *self {
RejectAssignmentError::RequestError(ref cause) => cause,
RejectAssignmentError::ServiceFault(ref cause) => cause,
RejectAssignmentError::Validation(ref cause) => cause,
RejectAssignmentError::Credentials(ref err) => err.description(),
RejectAssignmentError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
RejectAssignmentError::ParseError(ref cause) => cause,
RejectAssignmentError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum RejectQualificationRequestError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl RejectQualificationRequestError {
pub fn from_response(res: BufferedHttpResponse) -> RejectQualificationRequestError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return RejectQualificationRequestError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return RejectQualificationRequestError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return RejectQualificationRequestError::Validation(error_message.to_string());
}
_ => {}
}
}
return RejectQualificationRequestError::Unknown(res);
}
}
impl From<serde_json::error::Error> for RejectQualificationRequestError {
fn from(err: serde_json::error::Error) -> RejectQualificationRequestError {
RejectQualificationRequestError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for RejectQualificationRequestError {
fn from(err: CredentialsError) -> RejectQualificationRequestError {
RejectQualificationRequestError::Credentials(err)
}
}
impl From<HttpDispatchError> for RejectQualificationRequestError {
fn from(err: HttpDispatchError) -> RejectQualificationRequestError {
RejectQualificationRequestError::HttpDispatch(err)
}
}
impl From<io::Error> for RejectQualificationRequestError {
fn from(err: io::Error) -> RejectQualificationRequestError {
RejectQualificationRequestError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for RejectQualificationRequestError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for RejectQualificationRequestError {
fn description(&self) -> &str {
match *self {
RejectQualificationRequestError::RequestError(ref cause) => cause,
RejectQualificationRequestError::ServiceFault(ref cause) => cause,
RejectQualificationRequestError::Validation(ref cause) => cause,
RejectQualificationRequestError::Credentials(ref err) => err.description(),
RejectQualificationRequestError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
RejectQualificationRequestError::ParseError(ref cause) => cause,
RejectQualificationRequestError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SendBonusError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SendBonusError {
pub fn from_response(res: BufferedHttpResponse) -> SendBonusError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => return SendBonusError::RequestError(String::from(error_message)),
"ServiceFault" => return SendBonusError::ServiceFault(String::from(error_message)),
"ValidationException" => {
return SendBonusError::Validation(error_message.to_string());
}
_ => {}
}
}
return SendBonusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SendBonusError {
fn from(err: serde_json::error::Error) -> SendBonusError {
SendBonusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SendBonusError {
fn from(err: CredentialsError) -> SendBonusError {
SendBonusError::Credentials(err)
}
}
impl From<HttpDispatchError> for SendBonusError {
fn from(err: HttpDispatchError) -> SendBonusError {
SendBonusError::HttpDispatch(err)
}
}
impl From<io::Error> for SendBonusError {
fn from(err: io::Error) -> SendBonusError {
SendBonusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SendBonusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SendBonusError {
fn description(&self) -> &str {
match *self {
SendBonusError::RequestError(ref cause) => cause,
SendBonusError::ServiceFault(ref cause) => cause,
SendBonusError::Validation(ref cause) => cause,
SendBonusError::Credentials(ref err) => err.description(),
SendBonusError::HttpDispatch(ref dispatch_error) => dispatch_error.description(),
SendBonusError::ParseError(ref cause) => cause,
SendBonusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum SendTestEventNotificationError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl SendTestEventNotificationError {
pub fn from_response(res: BufferedHttpResponse) -> SendTestEventNotificationError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return SendTestEventNotificationError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return SendTestEventNotificationError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return SendTestEventNotificationError::Validation(error_message.to_string());
}
_ => {}
}
}
return SendTestEventNotificationError::Unknown(res);
}
}
impl From<serde_json::error::Error> for SendTestEventNotificationError {
fn from(err: serde_json::error::Error) -> SendTestEventNotificationError {
SendTestEventNotificationError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for SendTestEventNotificationError {
fn from(err: CredentialsError) -> SendTestEventNotificationError {
SendTestEventNotificationError::Credentials(err)
}
}
impl From<HttpDispatchError> for SendTestEventNotificationError {
fn from(err: HttpDispatchError) -> SendTestEventNotificationError {
SendTestEventNotificationError::HttpDispatch(err)
}
}
impl From<io::Error> for SendTestEventNotificationError {
fn from(err: io::Error) -> SendTestEventNotificationError {
SendTestEventNotificationError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for SendTestEventNotificationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for SendTestEventNotificationError {
fn description(&self) -> &str {
match *self {
SendTestEventNotificationError::RequestError(ref cause) => cause,
SendTestEventNotificationError::ServiceFault(ref cause) => cause,
SendTestEventNotificationError::Validation(ref cause) => cause,
SendTestEventNotificationError::Credentials(ref err) => err.description(),
SendTestEventNotificationError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
SendTestEventNotificationError::ParseError(ref cause) => cause,
SendTestEventNotificationError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateExpirationForHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateExpirationForHITError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateExpirationForHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return UpdateExpirationForHITError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return UpdateExpirationForHITError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return UpdateExpirationForHITError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateExpirationForHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateExpirationForHITError {
fn from(err: serde_json::error::Error) -> UpdateExpirationForHITError {
UpdateExpirationForHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateExpirationForHITError {
fn from(err: CredentialsError) -> UpdateExpirationForHITError {
UpdateExpirationForHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateExpirationForHITError {
fn from(err: HttpDispatchError) -> UpdateExpirationForHITError {
UpdateExpirationForHITError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateExpirationForHITError {
fn from(err: io::Error) -> UpdateExpirationForHITError {
UpdateExpirationForHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateExpirationForHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateExpirationForHITError {
fn description(&self) -> &str {
match *self {
UpdateExpirationForHITError::RequestError(ref cause) => cause,
UpdateExpirationForHITError::ServiceFault(ref cause) => cause,
UpdateExpirationForHITError::Validation(ref cause) => cause,
UpdateExpirationForHITError::Credentials(ref err) => err.description(),
UpdateExpirationForHITError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateExpirationForHITError::ParseError(ref cause) => cause,
UpdateExpirationForHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateHITReviewStatusError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateHITReviewStatusError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateHITReviewStatusError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return UpdateHITReviewStatusError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return UpdateHITReviewStatusError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return UpdateHITReviewStatusError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateHITReviewStatusError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateHITReviewStatusError {
fn from(err: serde_json::error::Error) -> UpdateHITReviewStatusError {
UpdateHITReviewStatusError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateHITReviewStatusError {
fn from(err: CredentialsError) -> UpdateHITReviewStatusError {
UpdateHITReviewStatusError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateHITReviewStatusError {
fn from(err: HttpDispatchError) -> UpdateHITReviewStatusError {
UpdateHITReviewStatusError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateHITReviewStatusError {
fn from(err: io::Error) -> UpdateHITReviewStatusError {
UpdateHITReviewStatusError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateHITReviewStatusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateHITReviewStatusError {
fn description(&self) -> &str {
match *self {
UpdateHITReviewStatusError::RequestError(ref cause) => cause,
UpdateHITReviewStatusError::ServiceFault(ref cause) => cause,
UpdateHITReviewStatusError::Validation(ref cause) => cause,
UpdateHITReviewStatusError::Credentials(ref err) => err.description(),
UpdateHITReviewStatusError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateHITReviewStatusError::ParseError(ref cause) => cause,
UpdateHITReviewStatusError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateHITTypeOfHITError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateHITTypeOfHITError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateHITTypeOfHITError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return UpdateHITTypeOfHITError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return UpdateHITTypeOfHITError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return UpdateHITTypeOfHITError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateHITTypeOfHITError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateHITTypeOfHITError {
fn from(err: serde_json::error::Error) -> UpdateHITTypeOfHITError {
UpdateHITTypeOfHITError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateHITTypeOfHITError {
fn from(err: CredentialsError) -> UpdateHITTypeOfHITError {
UpdateHITTypeOfHITError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateHITTypeOfHITError {
fn from(err: HttpDispatchError) -> UpdateHITTypeOfHITError {
UpdateHITTypeOfHITError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateHITTypeOfHITError {
fn from(err: io::Error) -> UpdateHITTypeOfHITError {
UpdateHITTypeOfHITError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateHITTypeOfHITError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateHITTypeOfHITError {
fn description(&self) -> &str {
match *self {
UpdateHITTypeOfHITError::RequestError(ref cause) => cause,
UpdateHITTypeOfHITError::ServiceFault(ref cause) => cause,
UpdateHITTypeOfHITError::Validation(ref cause) => cause,
UpdateHITTypeOfHITError::Credentials(ref err) => err.description(),
UpdateHITTypeOfHITError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateHITTypeOfHITError::ParseError(ref cause) => cause,
UpdateHITTypeOfHITError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateNotificationSettingsError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateNotificationSettingsError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateNotificationSettingsError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return UpdateNotificationSettingsError::RequestError(String::from(
error_message,
));
}
"ServiceFault" => {
return UpdateNotificationSettingsError::ServiceFault(String::from(
error_message,
));
}
"ValidationException" => {
return UpdateNotificationSettingsError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateNotificationSettingsError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateNotificationSettingsError {
fn from(err: serde_json::error::Error) -> UpdateNotificationSettingsError {
UpdateNotificationSettingsError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateNotificationSettingsError {
fn from(err: CredentialsError) -> UpdateNotificationSettingsError {
UpdateNotificationSettingsError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateNotificationSettingsError {
fn from(err: HttpDispatchError) -> UpdateNotificationSettingsError {
UpdateNotificationSettingsError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateNotificationSettingsError {
fn from(err: io::Error) -> UpdateNotificationSettingsError {
UpdateNotificationSettingsError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateNotificationSettingsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateNotificationSettingsError {
fn description(&self) -> &str {
match *self {
UpdateNotificationSettingsError::RequestError(ref cause) => cause,
UpdateNotificationSettingsError::ServiceFault(ref cause) => cause,
UpdateNotificationSettingsError::Validation(ref cause) => cause,
UpdateNotificationSettingsError::Credentials(ref err) => err.description(),
UpdateNotificationSettingsError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateNotificationSettingsError::ParseError(ref cause) => cause,
UpdateNotificationSettingsError::Unknown(_) => "unknown error",
}
}
}
#[derive(Debug, PartialEq)]
pub enum UpdateQualificationTypeError {
RequestError(String),
ServiceFault(String),
HttpDispatch(HttpDispatchError),
Credentials(CredentialsError),
Validation(String),
ParseError(String),
Unknown(BufferedHttpResponse),
}
impl UpdateQualificationTypeError {
pub fn from_response(res: BufferedHttpResponse) -> UpdateQualificationTypeError {
if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
let raw_error_type = json
.get("__type")
.and_then(|e| e.as_str())
.unwrap_or("Unknown");
let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");
let pieces: Vec<&str> = raw_error_type.split("#").collect();
let error_type = pieces.last().expect("Expected error type");
match *error_type {
"RequestError" => {
return UpdateQualificationTypeError::RequestError(String::from(error_message));
}
"ServiceFault" => {
return UpdateQualificationTypeError::ServiceFault(String::from(error_message));
}
"ValidationException" => {
return UpdateQualificationTypeError::Validation(error_message.to_string());
}
_ => {}
}
}
return UpdateQualificationTypeError::Unknown(res);
}
}
impl From<serde_json::error::Error> for UpdateQualificationTypeError {
fn from(err: serde_json::error::Error) -> UpdateQualificationTypeError {
UpdateQualificationTypeError::ParseError(err.description().to_string())
}
}
impl From<CredentialsError> for UpdateQualificationTypeError {
fn from(err: CredentialsError) -> UpdateQualificationTypeError {
UpdateQualificationTypeError::Credentials(err)
}
}
impl From<HttpDispatchError> for UpdateQualificationTypeError {
fn from(err: HttpDispatchError) -> UpdateQualificationTypeError {
UpdateQualificationTypeError::HttpDispatch(err)
}
}
impl From<io::Error> for UpdateQualificationTypeError {
fn from(err: io::Error) -> UpdateQualificationTypeError {
UpdateQualificationTypeError::HttpDispatch(HttpDispatchError::from(err))
}
}
impl fmt::Display for UpdateQualificationTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.description())
}
}
impl Error for UpdateQualificationTypeError {
fn description(&self) -> &str {
match *self {
UpdateQualificationTypeError::RequestError(ref cause) => cause,
UpdateQualificationTypeError::ServiceFault(ref cause) => cause,
UpdateQualificationTypeError::Validation(ref cause) => cause,
UpdateQualificationTypeError::Credentials(ref err) => err.description(),
UpdateQualificationTypeError::HttpDispatch(ref dispatch_error) => {
dispatch_error.description()
}
UpdateQualificationTypeError::ParseError(ref cause) => cause,
UpdateQualificationTypeError::Unknown(_) => "unknown error",
}
}
}
pub trait MechanicalTurk {
fn accept_qualification_request(
&self,
input: AcceptQualificationRequestRequest,
) -> RusotoFuture<AcceptQualificationRequestResponse, AcceptQualificationRequestError>;
fn approve_assignment(
&self,
input: ApproveAssignmentRequest,
) -> RusotoFuture<ApproveAssignmentResponse, ApproveAssignmentError>;
fn associate_qualification_with_worker(
&self,
input: AssociateQualificationWithWorkerRequest,
) -> RusotoFuture<AssociateQualificationWithWorkerResponse, AssociateQualificationWithWorkerError>;
fn create_additional_assignments_for_hit(
&self,
input: CreateAdditionalAssignmentsForHITRequest,
) -> RusotoFuture<
CreateAdditionalAssignmentsForHITResponse,
CreateAdditionalAssignmentsForHITError,
>;
fn create_hit(
&self,
input: CreateHITRequest,
) -> RusotoFuture<CreateHITResponse, CreateHITError>;
fn create_hit_type(
&self,
input: CreateHITTypeRequest,
) -> RusotoFuture<CreateHITTypeResponse, CreateHITTypeError>;
fn create_hit_with_hit_type(
&self,
input: CreateHITWithHITTypeRequest,
) -> RusotoFuture<CreateHITWithHITTypeResponse, CreateHITWithHITTypeError>;
fn create_qualification_type(
&self,
input: CreateQualificationTypeRequest,
) -> RusotoFuture<CreateQualificationTypeResponse, CreateQualificationTypeError>;
fn create_worker_block(
&self,
input: CreateWorkerBlockRequest,
) -> RusotoFuture<CreateWorkerBlockResponse, CreateWorkerBlockError>;
fn delete_hit(
&self,
input: DeleteHITRequest,
) -> RusotoFuture<DeleteHITResponse, DeleteHITError>;
fn delete_qualification_type(
&self,
input: DeleteQualificationTypeRequest,
) -> RusotoFuture<DeleteQualificationTypeResponse, DeleteQualificationTypeError>;
fn delete_worker_block(
&self,
input: DeleteWorkerBlockRequest,
) -> RusotoFuture<DeleteWorkerBlockResponse, DeleteWorkerBlockError>;
fn disassociate_qualification_from_worker(
&self,
input: DisassociateQualificationFromWorkerRequest,
) -> RusotoFuture<
DisassociateQualificationFromWorkerResponse,
DisassociateQualificationFromWorkerError,
>;
fn get_account_balance(
&self,
) -> RusotoFuture<GetAccountBalanceResponse, GetAccountBalanceError>;
fn get_assignment(
&self,
input: GetAssignmentRequest,
) -> RusotoFuture<GetAssignmentResponse, GetAssignmentError>;
fn get_file_upload_url(
&self,
input: GetFileUploadURLRequest,
) -> RusotoFuture<GetFileUploadURLResponse, GetFileUploadURLError>;
fn get_hit(&self, input: GetHITRequest) -> RusotoFuture<GetHITResponse, GetHITError>;
fn get_qualification_score(
&self,
input: GetQualificationScoreRequest,
) -> RusotoFuture<GetQualificationScoreResponse, GetQualificationScoreError>;
fn get_qualification_type(
&self,
input: GetQualificationTypeRequest,
) -> RusotoFuture<GetQualificationTypeResponse, GetQualificationTypeError>;
fn list_assignments_for_hit(
&self,
input: ListAssignmentsForHITRequest,
) -> RusotoFuture<ListAssignmentsForHITResponse, ListAssignmentsForHITError>;
fn list_bonus_payments(
&self,
input: ListBonusPaymentsRequest,
) -> RusotoFuture<ListBonusPaymentsResponse, ListBonusPaymentsError>;
fn list_hi_ts(&self, input: ListHITsRequest) -> RusotoFuture<ListHITsResponse, ListHITsError>;
fn list_hi_ts_for_qualification_type(
&self,
input: ListHITsForQualificationTypeRequest,
) -> RusotoFuture<ListHITsForQualificationTypeResponse, ListHITsForQualificationTypeError>;
fn list_qualification_requests(
&self,
input: ListQualificationRequestsRequest,
) -> RusotoFuture<ListQualificationRequestsResponse, ListQualificationRequestsError>;
fn list_qualification_types(
&self,
input: ListQualificationTypesRequest,
) -> RusotoFuture<ListQualificationTypesResponse, ListQualificationTypesError>;
fn list_review_policy_results_for_hit(
&self,
input: ListReviewPolicyResultsForHITRequest,
) -> RusotoFuture<ListReviewPolicyResultsForHITResponse, ListReviewPolicyResultsForHITError>;
fn list_reviewable_hi_ts(
&self,
input: ListReviewableHITsRequest,
) -> RusotoFuture<ListReviewableHITsResponse, ListReviewableHITsError>;
fn list_worker_blocks(
&self,
input: ListWorkerBlocksRequest,
) -> RusotoFuture<ListWorkerBlocksResponse, ListWorkerBlocksError>;
fn list_workers_with_qualification_type(
&self,
input: ListWorkersWithQualificationTypeRequest,
) -> RusotoFuture<ListWorkersWithQualificationTypeResponse, ListWorkersWithQualificationTypeError>;
fn notify_workers(
&self,
input: NotifyWorkersRequest,
) -> RusotoFuture<NotifyWorkersResponse, NotifyWorkersError>;
fn reject_assignment(
&self,
input: RejectAssignmentRequest,
) -> RusotoFuture<RejectAssignmentResponse, RejectAssignmentError>;
fn reject_qualification_request(
&self,
input: RejectQualificationRequestRequest,
) -> RusotoFuture<RejectQualificationRequestResponse, RejectQualificationRequestError>;
fn send_bonus(
&self,
input: SendBonusRequest,
) -> RusotoFuture<SendBonusResponse, SendBonusError>;
fn send_test_event_notification(
&self,
input: SendTestEventNotificationRequest,
) -> RusotoFuture<SendTestEventNotificationResponse, SendTestEventNotificationError>;
fn update_expiration_for_hit(
&self,
input: UpdateExpirationForHITRequest,
) -> RusotoFuture<UpdateExpirationForHITResponse, UpdateExpirationForHITError>;
fn update_hit_review_status(
&self,
input: UpdateHITReviewStatusRequest,
) -> RusotoFuture<UpdateHITReviewStatusResponse, UpdateHITReviewStatusError>;
fn update_hit_type_of_hit(
&self,
input: UpdateHITTypeOfHITRequest,
) -> RusotoFuture<UpdateHITTypeOfHITResponse, UpdateHITTypeOfHITError>;
fn update_notification_settings(
&self,
input: UpdateNotificationSettingsRequest,
) -> RusotoFuture<UpdateNotificationSettingsResponse, UpdateNotificationSettingsError>;
fn update_qualification_type(
&self,
input: UpdateQualificationTypeRequest,
) -> RusotoFuture<UpdateQualificationTypeResponse, UpdateQualificationTypeError>;
}
#[derive(Clone)]
pub struct MechanicalTurkClient {
client: Client,
region: region::Region,
}
impl MechanicalTurkClient {
pub fn new(region: region::Region) -> MechanicalTurkClient {
MechanicalTurkClient {
client: Client::shared(),
region: region,
}
}
pub fn new_with<P, D>(
request_dispatcher: D,
credentials_provider: P,
region: region::Region,
) -> MechanicalTurkClient
where
P: ProvideAwsCredentials + Send + Sync + 'static,
P::Future: Send,
D: DispatchSignedRequest + Send + Sync + 'static,
D::Future: Send,
{
MechanicalTurkClient {
client: Client::new_with(credentials_provider, request_dispatcher),
region: region,
}
}
}
impl MechanicalTurk for MechanicalTurkClient {
fn accept_qualification_request(
&self,
input: AcceptQualificationRequestRequest,
) -> RusotoFuture<AcceptQualificationRequestResponse, AcceptQualificationRequestError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.AcceptQualificationRequest",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<AcceptQualificationRequestResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AcceptQualificationRequestError::from_response(response))
}))
}
})
}
fn approve_assignment(
&self,
input: ApproveAssignmentRequest,
) -> RusotoFuture<ApproveAssignmentResponse, ApproveAssignmentError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ApproveAssignment",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ApproveAssignmentResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ApproveAssignmentError::from_response(response))),
)
}
})
}
fn associate_qualification_with_worker(
&self,
input: AssociateQualificationWithWorkerRequest,
) -> RusotoFuture<AssociateQualificationWithWorkerResponse, AssociateQualificationWithWorkerError>
{
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.AssociateQualificationWithWorker",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<AssociateQualificationWithWorkerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(AssociateQualificationWithWorkerError::from_response(
response,
))
}))
}
})
}
fn create_additional_assignments_for_hit(
&self,
input: CreateAdditionalAssignmentsForHITRequest,
) -> RusotoFuture<
CreateAdditionalAssignmentsForHITResponse,
CreateAdditionalAssignmentsForHITError,
> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.CreateAdditionalAssignmentsForHIT",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateAdditionalAssignmentsForHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateAdditionalAssignmentsForHITError::from_response(
response,
))
}))
}
})
}
fn create_hit(
&self,
input: CreateHITRequest,
) -> RusotoFuture<CreateHITResponse, CreateHITError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "MTurkRequesterServiceV20170117.CreateHIT");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateHITError::from_response(response))),
)
}
})
}
fn create_hit_type(
&self,
input: CreateHITTypeRequest,
) -> RusotoFuture<CreateHITTypeResponse, CreateHITTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.CreateHITType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateHITTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateHITTypeError::from_response(response))),
)
}
})
}
fn create_hit_with_hit_type(
&self,
input: CreateHITWithHITTypeRequest,
) -> RusotoFuture<CreateHITWithHITTypeResponse, CreateHITWithHITTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.CreateHITWithHITType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateHITWithHITTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(CreateHITWithHITTypeError::from_response(response))
}),
)
}
})
}
fn create_qualification_type(
&self,
input: CreateQualificationTypeRequest,
) -> RusotoFuture<CreateQualificationTypeResponse, CreateQualificationTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.CreateQualificationType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateQualificationTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(CreateQualificationTypeError::from_response(response))
}))
}
})
}
fn create_worker_block(
&self,
input: CreateWorkerBlockRequest,
) -> RusotoFuture<CreateWorkerBlockResponse, CreateWorkerBlockError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.CreateWorkerBlock",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<CreateWorkerBlockResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(CreateWorkerBlockError::from_response(response))),
)
}
})
}
fn delete_hit(
&self,
input: DeleteHITRequest,
) -> RusotoFuture<DeleteHITResponse, DeleteHITError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "MTurkRequesterServiceV20170117.DeleteHIT");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteHITError::from_response(response))),
)
}
})
}
fn delete_qualification_type(
&self,
input: DeleteQualificationTypeRequest,
) -> RusotoFuture<DeleteQualificationTypeResponse, DeleteQualificationTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.DeleteQualificationType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteQualificationTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DeleteQualificationTypeError::from_response(response))
}))
}
})
}
fn delete_worker_block(
&self,
input: DeleteWorkerBlockRequest,
) -> RusotoFuture<DeleteWorkerBlockResponse, DeleteWorkerBlockError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.DeleteWorkerBlock",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DeleteWorkerBlockResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(DeleteWorkerBlockError::from_response(response))),
)
}
})
}
fn disassociate_qualification_from_worker(
&self,
input: DisassociateQualificationFromWorkerRequest,
) -> RusotoFuture<
DisassociateQualificationFromWorkerResponse,
DisassociateQualificationFromWorkerError,
> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.DisassociateQualificationFromWorker",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<DisassociateQualificationFromWorkerResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(DisassociateQualificationFromWorkerError::from_response(
response,
))
}))
}
})
}
fn get_account_balance(
&self,
) -> RusotoFuture<GetAccountBalanceResponse, GetAccountBalanceError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.GetAccountBalance",
);
request.set_payload(Some(b"{}".to_vec()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetAccountBalanceResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAccountBalanceError::from_response(response))),
)
}
})
}
fn get_assignment(
&self,
input: GetAssignmentRequest,
) -> RusotoFuture<GetAssignmentResponse, GetAssignmentError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.GetAssignment",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetAssignmentResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetAssignmentError::from_response(response))),
)
}
})
}
fn get_file_upload_url(
&self,
input: GetFileUploadURLRequest,
) -> RusotoFuture<GetFileUploadURLResponse, GetFileUploadURLError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.GetFileUploadURL",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetFileUploadURLResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetFileUploadURLError::from_response(response))),
)
}
})
}
fn get_hit(&self, input: GetHITRequest) -> RusotoFuture<GetHITResponse, GetHITError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "MTurkRequesterServiceV20170117.GetHIT");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(GetHITError::from_response(response))),
)
}
})
}
fn get_qualification_score(
&self,
input: GetQualificationScoreRequest,
) -> RusotoFuture<GetQualificationScoreResponse, GetQualificationScoreError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.GetQualificationScore",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetQualificationScoreResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetQualificationScoreError::from_response(response))
}),
)
}
})
}
fn get_qualification_type(
&self,
input: GetQualificationTypeRequest,
) -> RusotoFuture<GetQualificationTypeResponse, GetQualificationTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.GetQualificationType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<GetQualificationTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(GetQualificationTypeError::from_response(response))
}),
)
}
})
}
fn list_assignments_for_hit(
&self,
input: ListAssignmentsForHITRequest,
) -> RusotoFuture<ListAssignmentsForHITResponse, ListAssignmentsForHITError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListAssignmentsForHIT",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListAssignmentsForHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListAssignmentsForHITError::from_response(response))
}),
)
}
})
}
fn list_bonus_payments(
&self,
input: ListBonusPaymentsRequest,
) -> RusotoFuture<ListBonusPaymentsResponse, ListBonusPaymentsError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListBonusPayments",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListBonusPaymentsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListBonusPaymentsError::from_response(response))),
)
}
})
}
fn list_hi_ts(&self, input: ListHITsRequest) -> RusotoFuture<ListHITsResponse, ListHITsError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "MTurkRequesterServiceV20170117.ListHITs");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListHITsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListHITsError::from_response(response))),
)
}
})
}
fn list_hi_ts_for_qualification_type(
&self,
input: ListHITsForQualificationTypeRequest,
) -> RusotoFuture<ListHITsForQualificationTypeResponse, ListHITsForQualificationTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListHITsForQualificationType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListHITsForQualificationTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListHITsForQualificationTypeError::from_response(response))
}))
}
})
}
fn list_qualification_requests(
&self,
input: ListQualificationRequestsRequest,
) -> RusotoFuture<ListQualificationRequestsResponse, ListQualificationRequestsError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListQualificationRequests",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListQualificationRequestsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListQualificationRequestsError::from_response(response))
}))
}
})
}
fn list_qualification_types(
&self,
input: ListQualificationTypesRequest,
) -> RusotoFuture<ListQualificationTypesResponse, ListQualificationTypesError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListQualificationTypes",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListQualificationTypesResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(ListQualificationTypesError::from_response(response))
}),
)
}
})
}
fn list_review_policy_results_for_hit(
&self,
input: ListReviewPolicyResultsForHITRequest,
) -> RusotoFuture<ListReviewPolicyResultsForHITResponse, ListReviewPolicyResultsForHITError>
{
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListReviewPolicyResultsForHIT",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListReviewPolicyResultsForHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListReviewPolicyResultsForHITError::from_response(response))
}))
}
})
}
fn list_reviewable_hi_ts(
&self,
input: ListReviewableHITsRequest,
) -> RusotoFuture<ListReviewableHITsResponse, ListReviewableHITsError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListReviewableHITs",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListReviewableHITsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListReviewableHITsError::from_response(response))),
)
}
})
}
fn list_worker_blocks(
&self,
input: ListWorkerBlocksRequest,
) -> RusotoFuture<ListWorkerBlocksResponse, ListWorkerBlocksError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListWorkerBlocks",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListWorkerBlocksResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(ListWorkerBlocksError::from_response(response))),
)
}
})
}
fn list_workers_with_qualification_type(
&self,
input: ListWorkersWithQualificationTypeRequest,
) -> RusotoFuture<ListWorkersWithQualificationTypeResponse, ListWorkersWithQualificationTypeError>
{
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.ListWorkersWithQualificationType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<ListWorkersWithQualificationTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(ListWorkersWithQualificationTypeError::from_response(
response,
))
}))
}
})
}
fn notify_workers(
&self,
input: NotifyWorkersRequest,
) -> RusotoFuture<NotifyWorkersResponse, NotifyWorkersError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.NotifyWorkers",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<NotifyWorkersResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(NotifyWorkersError::from_response(response))),
)
}
})
}
fn reject_assignment(
&self,
input: RejectAssignmentRequest,
) -> RusotoFuture<RejectAssignmentResponse, RejectAssignmentError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.RejectAssignment",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<RejectAssignmentResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(RejectAssignmentError::from_response(response))),
)
}
})
}
fn reject_qualification_request(
&self,
input: RejectQualificationRequestRequest,
) -> RusotoFuture<RejectQualificationRequestResponse, RejectQualificationRequestError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.RejectQualificationRequest",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<RejectQualificationRequestResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(RejectQualificationRequestError::from_response(response))
}))
}
})
}
fn send_bonus(
&self,
input: SendBonusRequest,
) -> RusotoFuture<SendBonusResponse, SendBonusError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header("x-amz-target", "MTurkRequesterServiceV20170117.SendBonus");
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SendBonusResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(SendBonusError::from_response(response))),
)
}
})
}
fn send_test_event_notification(
&self,
input: SendTestEventNotificationRequest,
) -> RusotoFuture<SendTestEventNotificationResponse, SendTestEventNotificationError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.SendTestEventNotification",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<SendTestEventNotificationResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(SendTestEventNotificationError::from_response(response))
}))
}
})
}
fn update_expiration_for_hit(
&self,
input: UpdateExpirationForHITRequest,
) -> RusotoFuture<UpdateExpirationForHITResponse, UpdateExpirationForHITError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.UpdateExpirationForHIT",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateExpirationForHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateExpirationForHITError::from_response(response))
}),
)
}
})
}
fn update_hit_review_status(
&self,
input: UpdateHITReviewStatusRequest,
) -> RusotoFuture<UpdateHITReviewStatusResponse, UpdateHITReviewStatusError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.UpdateHITReviewStatus",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateHITReviewStatusResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response.buffer().from_err().and_then(|response| {
Err(UpdateHITReviewStatusError::from_response(response))
}),
)
}
})
}
fn update_hit_type_of_hit(
&self,
input: UpdateHITTypeOfHITRequest,
) -> RusotoFuture<UpdateHITTypeOfHITResponse, UpdateHITTypeOfHITError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.UpdateHITTypeOfHIT",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateHITTypeOfHITResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(
response
.buffer()
.from_err()
.and_then(|response| Err(UpdateHITTypeOfHITError::from_response(response))),
)
}
})
}
fn update_notification_settings(
&self,
input: UpdateNotificationSettingsRequest,
) -> RusotoFuture<UpdateNotificationSettingsResponse, UpdateNotificationSettingsError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.UpdateNotificationSettings",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateNotificationSettingsResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateNotificationSettingsError::from_response(response))
}))
}
})
}
fn update_qualification_type(
&self,
input: UpdateQualificationTypeRequest,
) -> RusotoFuture<UpdateQualificationTypeResponse, UpdateQualificationTypeError> {
let mut request = SignedRequest::new("POST", "mturk-requester", &self.region, "/");
request.set_content_type("application/x-amz-json-1.1".to_owned());
request.add_header(
"x-amz-target",
"MTurkRequesterServiceV20170117.UpdateQualificationType",
);
let encoded = serde_json::to_string(&input).unwrap();
request.set_payload(Some(encoded.into_bytes()));
self.client.sign_and_dispatch(request, |response| {
if response.status.is_success() {
Box::new(response.buffer().from_err().map(|response| {
let mut body = response.body;
if body.is_empty() || body == b"null" {
body = b"{}".to_vec();
}
serde_json::from_str::<UpdateQualificationTypeResponse>(
String::from_utf8_lossy(body.as_ref()).as_ref(),
)
.unwrap()
}))
} else {
Box::new(response.buffer().from_err().and_then(|response| {
Err(UpdateQualificationTypeError::from_response(response))
}))
}
})
}
}
#[cfg(test)]
mod protocol_tests {}