diff --git a/example_test.go b/example_test.go index 0c8f1f9..89476b7 100644 --- a/example_test.go +++ b/example_test.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - anaconda "." + "github.com/ChimeraCoder/anaconda" ) // Initialize an client library for a given user. diff --git a/oembed_test.go b/oembed_test.go index a3cf89b..8032929 100644 --- a/oembed_test.go +++ b/oembed_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - anaconda "." + "github.com/ChimeraCoder/anaconda" ) func TestOEmbed(t *testing.T) { diff --git a/streaming.go b/streaming.go index ae62649..68a4197 100644 --- a/streaming.go +++ b/streaming.go @@ -19,6 +19,17 @@ const ( // messages +type DirectMessageDeletionNotice struct { + Id int64 `json:"id"` + IdStr string `json:"id_str"` + UserId int64 `json:"user_id"` +} +type directMessageDeletionNotice struct { + Delete *struct { + DirectMessage *DirectMessageDeletionNotice `json:"direct_message"` + } `json:"delete"` +} + type StatusDeletionNotice struct { Id int64 `json:"id"` IdStr string `json:"id_str"` @@ -171,6 +182,8 @@ func jsonToKnownType(j []byte) interface{} { // TODO: DRY if o := new(Tweet); jsonAsStruct(j, "/source", &o) { return *o + } else if o := new(directMessageDeletionNotice); jsonAsStruct(j, "/delete/direct_message", &o) { + return *o.Delete.DirectMessage } else if o := new(statusDeletionNotice); jsonAsStruct(j, "/delete", &o) { return *o.Delete.Status } else if o := new(locationDeletionNotice); jsonAsStruct(j, "/scrub_geo", &o) { diff --git a/tweet.go b/tweet.go index 65f26c9..883cb3c 100644 --- a/tweet.go +++ b/tweet.go @@ -24,6 +24,7 @@ type Tweet struct { Lang string `json:"lang"` Place Place `json:"place"` PossiblySensitive bool `json:"possibly_sensitive"` + QuotedStatus *Tweet `json:"quoted_status"` RetweetCount int `json:"retweet_count"` Retweeted bool `json:"retweeted"` RetweetedStatus *Tweet `json:"retweeted_status"` diff --git a/twitter_test.go b/twitter_test.go index 999e002..fb66ffa 100644 --- a/twitter_test.go +++ b/twitter_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - anaconda "." + "github.com/ChimeraCoder/anaconda" ) var CONSUMER_KEY = os.Getenv("CONSUMER_KEY") @@ -201,10 +201,9 @@ func Test_GetTweet(t *testing.T) { expectedEntities := anaconda.Entities{Hashtags: []struct { Indices []int Text string - }{struct { - Indices []int - Text string - }{Indices: []int{86, 93}, Text: "golang"}}, Urls: []struct { + }{ + + {Indices: []int{86, 93}, Text: "golang"}}, Urls: []struct { Indices []int Url string Display_url string @@ -215,7 +214,7 @@ func Test_GetTweet(t *testing.T) { Screen_name string Id int64 Id_str string - }{}, Media: []anaconda.EntityMedia{anaconda.EntityMedia{ + }{}, Media: []anaconda.EntityMedia{{ Id: 303777106628841472, Id_str: "303777106628841472", Media_url: "http://pbs.twimg.com/media/BDc7q0OCEAAoe2C.jpg",