71 lines
1.5 KiB
Go
71 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"net/url"
|
|
"strconv"
|
|
"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?tweet_mode=extended"
|
|
}
|
|
|
|
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},
|
|
"tweet_mode": {"extended"},
|
|
}
|
|
}
|
|
|
|
func DestroyParameters(id string) string {
|
|
return id + ".json?tweet_mode=extended"
|
|
}
|
|
|
|
func FollowingParameters(cursor int64) string {
|
|
return "&skip_status=true&include_user_entities=false&cursor=" + strconv.FormatInt(cursor, 10)
|
|
}
|
|
|
|
type FollowingResponse struct {
|
|
Users []StatusUser
|
|
Next_cursor int64
|
|
}
|