Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ func (a TwitterApi) GetSelf(v url.Values) (u User, err error) {
a.queryQueue <- query{a.baseUrl + "/account/verify_credentials.json", v, &u, _GET, response_ch}
return u, (<-response_ch).err
}

// AccountUpdateProfileBanner updates the profile banner of the authenticated user
// with the given encoded image data.
// For some more options, see https://dev.twitter.com/rest/reference/post/account/update_profile_banner
func (a TwitterApi) AccountUpdateProfileBanner(base64String string, v url.Values) error {
v = cleanValues(v)
v.Set("banner", base64String)

var emptyResponse interface{}

response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/account/update_profile_banner.json", v, &emptyResponse, _POST, response_ch}
return (<-response_ch).err
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"errors":[{"code":144,"message":"No status found with that ID."}]}
{"errors":[{"code":144,"message":"No status found with that ID."}]}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"created_at":"Fri Jun 03 03:06:43 +0000 2016","id":738567564641599489,"id_str":"738567564641599489","text":"Well, this has certainly come a long way! https:\/\/t.co\/QomzRzwcti","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[],"urls":[{"url":"https:\/\/t.co\/QomzRzwcti","expanded_url":"https:\/\/twitter.com\/chimeracoder\/status\/284377451625340928","display_url":"twitter.com\/chimeracoder\/s\u2026","indices":[42,65]}]},"source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":182675886,"id_str":"182675886","name":"Aditya Mukerjee","screen_name":"chimeracoder","location":"New York, NY","description":"Risk engineer at @stripe. Linux dev, statistician. Writing lots of Go. Alum of @recursecenter, @cornell_tech, @columbia","url":"https:\/\/t.co\/6PwvHXBN5Y","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/6PwvHXBN5Y","expanded_url":"https:\/\/adityamukerjee.net","display_url":"adityamukerjee.net","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":3061,"friends_count":914,"listed_count":172,"created_at":"Wed Aug 25 03:49:41 +0000 2010","favourites_count":5193,"utc_offset":-14400,"time_zone":"Eastern Time (US & Canada)","geo_enabled":false,"verified":false,"statuses_count":9559,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"quoted_status_id":284377451625340928,"quoted_status_id_str":"284377451625340928","quoted_status":{"created_at":"Thu Dec 27 19:17:22 +0000 2012","id":284377451625340928,"id_str":"284377451625340928","text":"Just created gojson - a simple tool for turning JSON data into Go structs! http:\/\/t.co\/QM6k9AUV #golang","truncated":false,"entities":{"hashtags":[{"text":"golang","indices":[96,103]}],"symbols":[],"user_mentions":[],"urls":[{"url":"http:\/\/t.co\/QM6k9AUV","expanded_url":"http:\/\/bit.ly\/UbfXOC","display_url":"bit.ly\/UbfXOC","indices":[75,95]}]},"source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":182675886,"id_str":"182675886","name":"Aditya Mukerjee","screen_name":"chimeracoder","location":"New York, NY","description":"Risk engineer at @stripe. Linux dev, statistician. Writing lots of Go. Alum of @recursecenter, @cornell_tech, @columbia","url":"https:\/\/t.co\/6PwvHXBN5Y","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/6PwvHXBN5Y","expanded_url":"https:\/\/adityamukerjee.net","display_url":"adityamukerjee.net","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":3061,"friends_count":914,"listed_count":172,"created_at":"Wed Aug 25 03:49:41 +0000 2010","favourites_count":5193,"utc_offset":-14400,"time_zone":"Eastern Time (US & Canada)","geo_enabled":false,"verified":false,"statuses_count":9559,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":2,"favorited":false,"retweeted":false,"possibly_sensitive":false,"possibly_sensitive_appealable":false,"lang":"en"},"is_quote_status":true,"retweet_count":0,"favorite_count":1,"favorited":false,"retweeted":false,"possibly_sensitive":false,"possibly_sensitive_appealable":false,"lang":"en"}
{"created_at":"Fri Jun 03 03:06:43 +0000 2016","id":738567564641599489,"id_str":"738567564641599489","text":"Well, this has certainly come a long way! https:\/\/t.co\/QomzRzwcti","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[],"urls":[{"url":"https:\/\/t.co\/QomzRzwcti","expanded_url":"https:\/\/twitter.com\/chimeracoder\/status\/284377451625340928","display_url":"twitter.com\/chimeracoder\/s\u2026","indices":[42,65]}]},"source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":182675886,"id_str":"182675886","name":"Aditya Mukerjee","screen_name":"chimeracoder","location":"New York, NY","description":"Risk engineer at @stripe. Linux dev, statistician. Writing lots of Go. Alum of @recursecenter, @cornell_tech, @columbia","url":"https:\/\/t.co\/6PwvHXBN5Y","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/6PwvHXBN5Y","expanded_url":"https:\/\/adityamukerjee.net","display_url":"adityamukerjee.net","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":3061,"friends_count":914,"listed_count":172,"created_at":"Wed Aug 25 03:49:41 +0000 2010","favourites_count":5193,"utc_offset":-14400,"time_zone":"Eastern Time (US & Canada)","geo_enabled":false,"verified":false,"statuses_count":9559,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"quoted_status_id":284377451625340928,"quoted_status_id_str":"284377451625340928","quoted_status":{"created_at":"Thu Dec 27 19:17:22 +0000 2012","id":284377451625340928,"id_str":"284377451625340928","text":"Just created gojson - a simple tool for turning JSON data into Go structs! http:\/\/t.co\/QM6k9AUV #golang","truncated":false,"entities":{"hashtags":[{"text":"golang","indices":[96,103]}],"symbols":[],"user_mentions":[],"urls":[{"url":"http:\/\/t.co\/QM6k9AUV","expanded_url":"http:\/\/bit.ly\/UbfXOC","display_url":"bit.ly\/UbfXOC","indices":[75,95]}]},"source":"\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":182675886,"id_str":"182675886","name":"Aditya Mukerjee","screen_name":"chimeracoder","location":"New York, NY","description":"Risk engineer at @stripe. Linux dev, statistician. Writing lots of Go. Alum of @recursecenter, @cornell_tech, @columbia","url":"https:\/\/t.co\/6PwvHXBN5Y","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/6PwvHXBN5Y","expanded_url":"https:\/\/adityamukerjee.net","display_url":"adityamukerjee.net","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":3061,"friends_count":914,"listed_count":172,"created_at":"Wed Aug 25 03:49:41 +0000 2010","favourites_count":5193,"utc_offset":-14400,"time_zone":"Eastern Time (US & Canada)","geo_enabled":false,"verified":false,"statuses_count":9559,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1807988313\/230348_1870593437981_1035450059_32104665_3285049_n_cropped_normal.jpg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":2,"favorited":false,"retweeted":false,"possibly_sensitive":false,"possibly_sensitive_appealable":false,"lang":"en"},"is_quote_status":true,"retweet_count":0,"favorite_count":1,"favorited":false,"retweeted":false,"possibly_sensitive":false,"possibly_sensitive_appealable":false,"lang":"en"}
4 changes: 2 additions & 2 deletions twitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func init() {
sourceFilename := filename

r.ParseForm()
specific := sourceFilename + "?" + r.Form.Encode()
specific := sourceFilename + "_" + r.Form.Encode()
_, err := os.Stat(specific)
if err == nil {
sourceFilename = specific
Expand All @@ -88,7 +88,7 @@ func init() {
defer f.Close()

// TODO not a hack
if sourceFilename == "json/statuses/show.json?id=404409873170841600" {
if sourceFilename == "json/statuses/show.json_id=404409873170841600" {
bts, err := ioutil.ReadAll(f)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down