Skip to content

Commit

Permalink
Add tweet_mode parameter to search and show endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfowler committed Dec 8, 2017
1 parent 1b65536 commit 4c7be43
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 15 additions & 11 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import (
// SearchTweetsParams represents the query parameters for a /search/tweets.json
// request.
type SearchTweetsParams struct {
Query string
Geocode string
Lang string
Locale string
ResultType string
Count int
Until string
SinceID string
MaxID string
ExcludeEntities bool
Callback string
Query string
Geocode string
Lang string
Locale string
ResultType string
Count int
Until string
SinceID string
MaxID string
ExcludeEntities bool
ExtendedEntities bool
Callback string
}

type searchRes struct {
Expand Down Expand Up @@ -79,6 +80,9 @@ func searchTweetsToQuery(params SearchTweetsParams) url.Values {
if params.ExcludeEntities {
values.Set("include_entities", "false")
}
if params.ExtendedEntities {
values.Set("tweet_mode", "extended")
}
if params.Callback != "" {
values.Set("callback", params.Callback)
}
Expand Down
4 changes: 4 additions & 0 deletions statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ type ShowTweetParams struct {
TrimUser bool `json:"trim_user"`
IncludeMyRetweet bool `json:"include_my_retweet"`
ExcludeEntities bool `json:"exclude_entities"`
ExtendedTweet bool `json:"extended_tweet"`
}

// ShowTweet calls the Twitter /statuses/show/:id.json endpoint.
Expand All @@ -242,6 +243,9 @@ func showTweetToQuery(params ShowTweetParams) url.Values {
if params.ExcludeEntities {
values.Set("include_entities", "false")
}
if params.ExtendedTweet {
values.Set("tweet_mode", "extended")
}
return values
}

Expand Down

0 comments on commit 4c7be43

Please sign in to comment.