mturk

package
v0.0.0-...-860a04e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2013 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

This package is in an experimental state, and does not currently follow conventions and style of the rest of goamz or common Go conventions. It must be polished before it's considered a first-class package in goamz.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateHITResponse

type CreateHITResponse struct {
	RequestId string `xml:"OperationRequest>RequestId"`
	HIT       HIT
}

The wrapper data structure returned by CreateHIT http://goo.gl/PskcX

type Error

type Error struct {
	StatusCode int    // HTTP status code (200, 403, ...)
	Code       string // EC2 error code ("UnsupportedOperation", ...)
	Message    string // The human-oriented error message
	RequestId  string
}

Error encapsulates an error returned by MTurk.

func (*Error) Error

func (err *Error) Error() string

type ExternalQuestion

type ExternalQuestion struct {
	XMLName     xml.Name `xml:"http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd ExternalQuestion"`
	ExternalURL string
	FrameHeight int
}

Data structure holding the contents of an "external" question. http://goo.gl/NP8Aa

type HIT

type HIT struct {
	Request xmlRequest

	HITId                        string
	HITTypeId                    string
	CreationTime                 string
	Title                        string
	Description                  string
	Keywords                     string
	HITStatus                    string
	Reward                       Price
	LifetimeInSeconds            uint
	AssignmentDurationInSeconds  uint
	MaxAssignments               uint
	AutoApprovalDelayInSeconds   uint
	QualificationRequirement     QualificationRequirement
	Question                     ExternalQuestion
	RequesterAnnotation          string
	NumberofSimilarHITs          uint
	HITReviewStatus              string
	NumberOfAssignmentsPending   uint
	NumberOfAssignmentsAvailable uint
	NumberOfAssignmentsCompleted uint
}

The data structure representing a "human interface task" (HIT) Currently only supports "external" questions, because Go structs don't support union types. http://goo.gl/NP8Aa This type is returned, for example, from SearchHITs http://goo.gl/PskcX

type Locale

type Locale string

Really just a country string http://goo.gl/mU4uG

type MTurk

type MTurk struct {
	aws.Auth
	URL *url.URL
}

func New

func New(auth aws.Auth) *MTurk

func (*MTurk) CreateHIT

func (mt *MTurk) CreateHIT(title, description string, question ExternalQuestion, reward Price, assignmentDurationInSeconds, lifetimeInSeconds uint, keywords string, maxAssignments uint, qualificationRequirement *QualificationRequirement, requesterAnnotation string) (h *HIT, err error)

Corresponds to the "CreateHIT" operation of the Mechanical Turk API. http://goo.gl/cDBRc Currently only supports "external" questions (see "HIT" struct above). If "keywords", "maxAssignments", "qualificationRequirement" or "requesterAnnotation" are the zero value for their types, they will not be included in the request.

func (*MTurk) CreateHITOfType

func (mt *MTurk) CreateHITOfType(hitTypeId string, q ExternalQuestion, lifetimeInSeconds uint, maxAssignments uint, requesterAnnotation string) (h *HIT, err error)

Corresponds to the "CreateHIT" operation of the Mechanical Turk API, using an existing "hit type". http://goo.gl/cDBRc Currently only supports "external" questions (see "HIT" struct above). If "maxAssignments" or "requesterAnnotation" are the zero value for their types, they will not be included in the request.

func (*MTurk) SearchHITs

func (mt *MTurk) SearchHITs() (s *SearchHITsResult, err error)

Corresponds to "SearchHITs" operation of Mechanical Turk. http://goo.gl/PskcX Currenlty supports none of the optional parameters.

type Price

type Price struct {
	Amount         string
	CurrencyCode   string
	FormattedPrice string
}

Common price structure used in requests and responses http://goo.gl/tE4AV

type QualificationRequirement

type QualificationRequirement struct {
	QualificationTypeId string
	Comparator          string
	IntegerValue        int
	LocaleValue         Locale
	RequiredToPreview   string
}

Data structure used to specify requirements for the worker used in CreateHIT, for example http://goo.gl/LvRo9

type SearchHITsResponse

type SearchHITsResponse struct {
	RequestId        string `xml:"OperationRequest>RequestId"`
	SearchHITsResult SearchHITsResult
}

The wrapper data structure returned by SearchHITs http://goo.gl/PskcX

type SearchHITsResult

type SearchHITsResult struct {
	NumResults      uint
	PageNumber      uint
	TotalNumResults uint
	HITs            []HIT `xml:"HIT"`
}

The main data structure returned by SearchHITs http://goo.gl/PskcX

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL