b5d843e4a6
* group code somewhat sanely in separate files * unify output of update endpoint requests and the rest as preparation for templates
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
func LookupParameters(ids []string) string {
|
|
return "&id=" + strings.Join(ids, ",")
|
|
}
|
|
|
|
func UpdateStatusRequest(status string, mediaIDs []ObjectID, previousStatusID ObjectID) url.Values {
|
|
r := map[string][]string{
|
|
"status": {status},
|
|
"tweet_mode": {"extended"},
|
|
}
|
|
if len(mediaIDs) > 0 {
|
|
ids := []string{}
|
|
for _, id := range mediaIDs {
|
|
ids = append(ids, string(id))
|
|
}
|
|
r["media_ids"] = []string{strings.Join(ids, ",")}
|
|
}
|
|
if len(previousStatusID) > 0 {
|
|
r["in_reply_to_status_id"] = []string{string(previousStatusID)}
|
|
r["auto_populate_reply_metadata"] = []string{"true"}
|
|
}
|
|
return r
|
|
}
|
|
|
|
func UserTimelineParameters(flags userTimelineFlags, screenName string) string {
|
|
s := "&screen_name=" + screenName
|
|
if flags.withReplies {
|
|
return s
|
|
} else {
|
|
return s + "&exclude_replies=true"
|
|
}
|
|
}
|
|
|
|
func RetweetParameters(id string) string {
|
|
return id + ".json"
|
|
}
|
|
|
|
func LikeRequest(id string) url.Values {
|
|
return map[string][]string{
|
|
"id": {id},
|
|
"tweet_mode": {"extended"},
|
|
}
|
|
}
|
|
|
|
func UnlikeRequest(id string) url.Values {
|
|
return map[string][]string{
|
|
"id": {id},
|
|
}
|
|
}
|
|
|
|
func DestroyParameters(id string) string {
|
|
return id + ".json"
|
|
}
|