Example #1
0
// SearchHITs returns all of a Requester's HITs, on behalf of the Requester.
func (client amtClient) SearchHITs(sortProperty string, sortAscending bool,
	pageSize, pageNumber int) (
	amtgen.TxsdSearchHITsResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdSearchHITs
		args     amtgen.TSearchHITsRequest
		response amtgen.TxsdSearchHITsResponse
	)
	args.SortProperty = amtgen.TSearchHITsSortProperty(sortProperty)
	if sortAscending {
		args.SortDirection = amtgen.TSortDirection("Ascending")
	} else {
		args.SortDirection = amtgen.TSortDirection("Descending")
	}
	args.PageSize = xsdt.Int(pageSize)
	args.PageNumber = xsdt.Int(pageNumber)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("SearchHITs", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Example #2
0
// GetAssignmentsForHIT retrieves completed assignments for a HIT.
func (client amtClient) GetAssignmentsForHIT(hitId string,
	assignmentStatuses []string, sortProperty string, sortAscending bool,
	pageSize, pageNumber int) (
	amtgen.TxsdGetAssignmentsForHITResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdGetAssignmentsForHIT
		args     amtgen.TGetAssignmentsForHITRequest
		response amtgen.TxsdGetAssignmentsForHITResponse
	)
	args.HITId = xsdt.String(hitId)
	for _, status := range assignmentStatuses {
		args.AssignmentStatuses = append(args.AssignmentStatuses,
			amtgen.TAssignmentStatus(status))
	}
	args.SortProperty = amtgen.TGetAssignmentsForHITSortProperty(sortProperty)
	if sortAscending {
		args.SortDirection = amtgen.TSortDirection("Ascending")
	} else {
		args.SortDirection = amtgen.TSortDirection("Descending")
	}
	args.PageSize = xsdt.Int(pageSize)
	args.PageNumber = xsdt.Int(pageNumber)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("GetAssignmentsForHIT", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Example #3
0
// GetReviewableHITs retrieves the HITs with Status equal to Reviewable or
// Status equal to Reviewing that belong to the Requester calling the operation.
func (client amtClient) GetReviewableHITs(hitTypeId, status,
	sortProperty string, sortAscending bool,
	pageSize, pageNumber int) (amtgen.TxsdGetReviewableHITsResponse, error) {

	// Prepare the request
	var (
		request  amtgen.TxsdGetReviewableHITs
		args     amtgen.TGetReviewableHITsRequest
		response amtgen.TxsdGetReviewableHITsResponse
	)
	args.HITTypeId = xsdt.String(hitTypeId)
	args.Status = amtgen.TReviewableHITStatus(status)
	args.SortProperty = amtgen.TGetReviewableHITsSortProperty(sortProperty)
	if sortAscending {
		args.SortDirection = amtgen.TSortDirection("Ascending")
	} else {
		args.SortDirection = amtgen.TSortDirection("Descending")
	}
	args.PageSize = xsdt.Int(pageSize)
	args.PageNumber = xsdt.Int(pageNumber)
	request.Requests = append(request.Requests, &args)

	// Send the request
	req, err := client.signRequest("GetReviewableHITs", &request)
	if err == nil {
		err = client.sendRequest(req, &response)
	}
	return response, err
}
Example #4
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
}