Exemple #1
0
// SearchQualificationTypes searches for Qualification types using the specified
// search query, and returns a list of Qualification types.
func (client amtClient) SearchQualificationTypes(
	query, sortProperty string, sortAscending bool,
	pageSize, pageNumber int, mustBeRequestable, mustBeOwnedByCaller bool) (
	amtgen.TxsdSearchQualificationTypesResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdSearchQualificationTypes
		args     amtgen.TSearchQualificationTypesRequest
		response amtgen.TxsdSearchQualificationTypesResponse
	)
	args.Query = xsdt.String(query)
	args.SortProperty = amtgen.TSearchQualificationTypesSortProperty(sortProperty)
	if sortAscending {
		args.SortDirection = amtgen.TSortDirection("Ascending")
	} else {
		args.SortDirection = amtgen.TSortDirection("Descending")
	}
	args.PageSize = xsdt.Int(pageSize)
	args.PageNumber = xsdt.Int(pageNumber)
	args.MustBeRequestable = xsdt.Boolean(mustBeRequestable)
	args.MustBeOwnedByCaller = xsdt.Boolean(mustBeOwnedByCaller)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("SearchQualificationTypes", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Exemple #2
0
// GetReviewResultsForHIT retrieves the computed results and the actions taken
// in the course of executing your Review Policies during a CreateHIT operation.
func (client amtClient) GetReviewResultsForHIT(hitId string,
	policyLevels []string,
	retrieveActions, retrieveResults bool,
	pageSize, pageNumber int) (amtgen.TxsdGetReviewResultsForHITResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdGetReviewResultsForHIT
		args     amtgen.TGetReviewResultsForHITRequest
		response amtgen.TxsdGetReviewResultsForHITResponse
	)
	args.HITId = xsdt.String(hitId)
	for _, level := range policyLevels {
		args.PolicyLevels = append(args.PolicyLevels,
			amtgen.TReviewPolicyLevel(level))
	}
	args.RetrieveActions = xsdt.Boolean(retrieveActions)
	args.RetrieveResults = xsdt.Boolean(retrieveResults)
	args.PageSize = xsdt.Int(pageSize)
	args.PageNumber = xsdt.Int(pageNumber)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("GetReviewResultsForHIT", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Exemple #3
0
// CreateQualificationType creates a new Qualification type.
func (client amtClient) CreateQualificationType(name, description string,
	keywords []string, retryDelayInSeconds int,
	qualificationTypeStatus, test, answerKey string,
	testDurationInSeconds int, autoGranted bool,
	autoGrantedValue int) (amtgen.TxsdCreateQualificationTypeResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdCreateQualificationType
		args     amtgen.TCreateQualificationTypeRequest
		response amtgen.TxsdCreateQualificationTypeResponse
	)
	args.Name = xsdt.String(name)
	args.Description = xsdt.String(description)
	args.Keywords = xsdt.String(strings.Join(keywords, ","))
	args.RetryDelayInSeconds = xsdt.Long(retryDelayInSeconds)
	args.QualificationTypeStatus = amtgen.TQualificationTypeStatus(
		qualificationTypeStatus)
	args.Test = xsdt.String(test)
	args.AnswerKey = xsdt.String(answerKey)
	args.TestDurationInSeconds = xsdt.Long(testDurationInSeconds)
	args.AutoGranted = xsdt.Boolean(autoGranted)
	args.AutoGrantedValue = xsdt.Int(autoGrantedValue)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("CreateQualificationType", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Exemple #4
0
// Add a new Question item, to be populated by subsequent content-adding method
// calls.
func (question *QuestionForm) AddQuestion(questionIdentifier,
	displayName string, isRequired bool) {

	qq := &questionform.TxsdQuestionFormSequenceChoiceQuestion{}
	qq.QuestionIdentifier = xsdt.String(questionIdentifier)
	qq.DisplayName = xsdt.String(displayName)
	qq.IsRequired = xsdt.Boolean(isRequired)

	question.Questions = append(question.Questions, qq)
	question.addedOverviewNext = append(question.addedOverviewNext, false)
}
Exemple #5
0
// SetHITAsReviewing updates the status of a HIT. If the status is Reviewable,
// this operation updates the status to Reviewing, or reverts a Reviewing HIT
// back to the Reviewable status.
func (client amtClient) SetHITAsReviewing(hitID string, revert bool) (
	amtgen.TxsdSetHITAsReviewingResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdSetHITAsReviewing
		args     amtgen.TSetHITAsReviewingRequest
		response amtgen.TxsdSetHITAsReviewingResponse
	)
	args.HITId = xsdt.String(hitID)
	args.Revert = xsdt.Boolean(revert)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("SetHITAsReviewing", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Exemple #6
0
// SetHITTypeNotification creates, updates, disables or re-enables notifications
// for a HIT type.
func (client amtClient) SetHITTypeNotification(hitTypeID string,
	notification *amtgen.TNotificationSpecification, active bool) (
	amtgen.TxsdSetHITTypeNotificationResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdSetHITTypeNotification
		args     amtgen.TSetHITTypeNotificationRequest
		response amtgen.TxsdSetHITTypeNotificationResponse
	)
	args.HITTypeId = xsdt.String(hitTypeID)
	args.Notification = notification
	args.Active = xsdt.Boolean(active)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("SetHITTypeNotification", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Exemple #7
0
// AssignQualification gives a Worker a Qualification.
func (client amtClient) AssignQualification(qualificationTypeId,
	workerId string, integerValue int, sendNotification bool) (
	amtgen.TxsdAssignQualificationResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdAssignQualification
		args     amtgen.TAssignQualificationRequest
		response amtgen.TxsdAssignQualificationResponse
	)
	args.QualificationTypeId = xsdt.String(qualificationTypeId)
	args.WorkerId = xsdt.String(workerId)
	args.IntegerValue = xsdt.Int(integerValue)
	args.SendNotification = xsdt.Boolean(sendNotification)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("AssignQualification", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}