예제 #1
0
func CreateTranslationHIT(a *anaconda.TwitterApi, auth *aws.Auth, tweet anaconda.Tweet, title string, description string, displayName string, rewardAmount string, assignmentDuration int, lifetime time.Duration, keywords []string) (*mtwerk.CreateHITResponse, error) {
	const rewardCurrencyCode = "USD" // This is the only one supported for now by Amazon, anyway
	const responseGroup = "Minimal"
	const autoApprovalDelay = 0 // auto-approve immediately

	// Get the embedded tweet to render
	embed, err := a.GetOEmbedId(tweet.Id, nil)
	if err != nil {
		return nil, err
	}

	hq := mtwerk.HTMLQuestionContent{tweet.IdStr, title, description, "http://www.emojidick.com/emoji.png", tweet, embed}

	questionString, err := parseQuestionContent(hq)
	if err != nil {
		return nil, err
	}

	resp, err := mtwerk.CreateHIT(auth, title, description, questionString, rewardAmount, rewardCurrencyCode, assignmentDuration, lifetime, keywords, autoApprovalDelay, tweet.IdStr, tweet.IdStr, responseGroup)
	return resp, err
}