mtwerk

package module
v0.0.0-...-d2ad545 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2013 License: LGPL-3.0 Imports: 15 Imported by: 1

README

#MTwerk
###A "fun" alternative to MTurk.

`mtwerk` provides some functions for interacting with the API for Amazon's Mechanical Turk. 

It builds off of code in [goamz](https://launchpad.net/goamz).

It is the "fun" alternative to `goamz/exp/mturk`, because unlike `exp/mturk`, it supports posting of a `Human Interface Task` that is not an `ExternalQuestion`. This means that you can post a task directly, without having to run a server to host the questions yourself.

###Naming
Credit for the naming of this library goes to a #go-nuts user [who insisted upon remaining unnamed in this README](https://botbot.me/freenode/go-nuts/msg/9133861/)

###License

`mtwerk` is licensed under version 3 of the Lesser GNU Public License (LGPLv3). It includes some code from [goamz](https://launchpad.net/goamz), which is released under the same license.

Documentation

Index

Constants

View Source
const (
	QUESTION_FORM_SCHEMA_URL = "http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd"
	HTML_QUESTION_SCHEMA_URL = "http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd"
	MAX_QUESTION_SIZE        = 65535 // Specified by Amazon
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnswerSpecification

type AnswerSpecification struct {
	FreeTextAnswer FreeTextAnswer `xml:"FreeTextAnswer"`
}

type Constraints

type Constraints struct {
	Length Length `xml:"Length"`
}

type CreateHITResponse

type CreateHITResponse struct {
	XMLName          xml.Name `xml:"CreateHITResponse"`
	OperationRequest struct {
		RequestId string
	}
	HIT struct {
		Request struct {
			IsValid bool
		}
		HITId     string
		HITTypeId string
	}
}

func CreateHIT

func CreateHIT(auth *aws.Auth, title string, description string, questionContentString, rewardAmount string, rewardCurrencyCode string, assignmentDuration int, lifetime time.Duration, keywords []string, autoApprovalDelay int, requesterAnnotation string, uniqueRequestToken string, responseGroup string) (*CreateHITResponse, error)

Create an HIT

type FreeTextAnswer

type FreeTextAnswer struct {
	Constraints             Constraints `xml:"Constraints"`
	DefaultText             string      `xml:"DefaultText"`
	NumberOfLinesSuggestion int         `xml:"NumberOfLinesSuggestion"`
}

type GetAssignmentsForHITResponse

type GetAssignmentsForHITResponse struct {
	XMLName                    xml.Name `xml:"GetAssignmentsForHITResponse"`
	OperationRequest           string
	RequestId                  string
	GetAssignmentsForHITResult GetAssignmentsForHITResult
}

func GetAssignmentsForHITOperation

func GetAssignmentsForHITOperation(auth *aws.Auth, hitID string) (*GetAssignmentsForHITResponse, error)

GetAssignmentsForHITOperation fetches the assignment details for the HIT with id hitID

func (GetAssignmentsForHITResponse) GetAnswer

GetAnswer will unmarshal the string Answer into a native Go struct (This cannot be done at the same time that the parent struct is unmarshaled)

func (GetAssignmentsForHITResponse) GetAnswerText

func (r GetAssignmentsForHITResponse) GetAnswerText() (result string, err error)

type GetAssignmentsForHITResult

type GetAssignmentsForHITResult struct {
	XMLName xml.Name `xml:"GetAssignmentsForHITResult"`
	Request struct {
		IsValid bool
	}
	NumResults      int
	TotalNumResults int
	PageNumber      int
	Assignment      struct {
		AssignmentId     string
		WorkerId         string
		HITId            string
		AssignmentStatus string
		AutoApprovalTime string
		AcceptTime       string
		SubmitTime       string
		ApprovalTime     string
		Answer           string
	}
}

type HIT

type HIT struct {
	HITId        string
	HITTYpeId    string
	CreationTime string
	HitStatus    string
}

type HTMLQuestion

type HTMLQuestion struct {
	XMLName     xml.Name            `xml:"HTMLQuestion"`
	Xmlns       string              `xml:"xmlns,attr"`
	HTMLContent HTMLQuestionContent `xml:"HTMLContent"`
	FrameHeight int                 `xml:"FrameHeight"`
}

func (HTMLQuestion) XML

func (hq HTMLQuestion) XML() string

type HTMLQuestionContent

type HTMLQuestionContent struct {
	AssignmentId string
	Title        string
	Description  string
	ImageUrl     string
	Tweet        anaconda.Tweet
	TweetEmbed   anaconda.OEmbed
}

type Length

type Length struct {
	MinLength int `xml:"minLength,attr"`
	MaxLength int `xml:"maxLength,attr"`
}

type Notification

type Notification struct {
	XMLName     xml.Name `xml:"Notification"`
	Destination string
	Transport   string
	Version     string
	EventType   string
}

type Question

type Question struct {
	QuestionIdentifier  string              `xml:"QuestionIdentifier"`
	DisplayName         string              `xml:"DisplayName"`
	IsRequired          bool                `xml:"IsRequired"`
	QuestionContent     QuestionContent     `xml:"QuestionContent"`
	AnswerSpecification AnswerSpecification `xml:"AnswerSpecification",omitempty`
}

type QuestionContent

type QuestionContent struct {
	Text string `xml:"Text"`
}

type QuestionForm

type QuestionForm struct {
	XMLName xml.Name `xml:"QuestionForm"`
	Xmlns   string   `xml:"xmlns,attr"`
	//Overview string   `xml:"Overview"`
	Question Question
}

func (QuestionForm) XML

func (qf QuestionForm) XML() string

type QuestionFormAnswers

type QuestionFormAnswers struct {
	XMLName xml.Name `xml:"QuestionFormAnswers"`
	Xmlns   string   `xml:"xmlns,attr"`
	Answer  struct {
		QuestionIdentifier string
		FreeText           string
	}
}

type ReceiveMessageResponse

type ReceiveMessageResponse struct {
	XMLName              xml.Name `xml:"ReceiveMessageResponse"`
	ReceiveMessageResult struct {
		Message struct {
			MessageId     string
			ReceiptHandle string
			MD5OfBody     string
			Body          string
			Attribute     []struct {
				Name  string
				Value string
			}
		}
	}
	ResponseMetadata struct {
		RequestId string
	}
}

type SearchHITsResponse

type SearchHITsResponse struct {
	XMLName xml.Name `xml:"SearchHITsResponse"`
	Request struct {
		IsValid bool
	}
	NumResults      int
	TotalNumResults int
	PageNumber      int
	HIT             []struct {
		HITId                        string
		HITTypeId                    string
		CreationTime                 string
		Title                        string
		Description                  string
		HITStatus                    string
		Expiration                   string
		NumberOfAssignmentsPending   string
		NumberOfAssignmentsAvailable string
		NumberOfAssignmentsCompleted string
	}
}

func SearchHIT

func SearchHIT(auth *aws.Auth, v url.Values) (*SearchHITsResponse, error)

type SetHITTypeNotificationResponse

type SetHITTypeNotificationResponse struct {
	XMLName xml.Name `xml:"SetHITTypeNotificationResponse"`
	Request struct {
		IsValid bool
	}
}

Jump to

Keyboard shortcuts

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