-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package twitter2 | ||
|
||
import "time" | ||
|
||
type Tweet struct { | ||
ID string | ||
Text string | ||
CreatedAt time.Time | ||
User *User | ||
Lang string | ||
QuotedStatus *Tweet | ||
InReplyToUserName string | ||
Entities []Entities | ||
} | ||
|
||
type User struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
UserName string `json:"username"` | ||
Description string `json:"description"` | ||
ProfileImageURL string `json:"profile_image_url"` | ||
} | ||
|
||
type Entities struct { | ||
// 使われてない | ||
// Annotations []any `json:"annotations"` | ||
// 使われていない | ||
// Cashtags []any `json:"cashtags"` | ||
|
||
Hashtags []EntitiesHashTag `json:"hashtags"` | ||
Mentions []EntitiesMention `json:"mentions"` | ||
URLs []EntitiesURL `json:"urls"` | ||
} | ||
|
||
type EntitiesHashTag struct { | ||
Start int `json:"start"` | ||
End int `json:"end"` | ||
Tag string `json:"tag"` | ||
} | ||
|
||
type EntitiesMention struct { | ||
Start int `json:"start"` | ||
End int `json:"end"` | ||
UserName string `json:"username"` | ||
} | ||
|
||
type EntitiesURL struct { | ||
Start int `json:"start"` | ||
End int `json:"end"` | ||
URL string `json:"url"` | ||
ExpandedURL string `json:"expaneded_url"` | ||
DisplayURL string `json:"display_url"` | ||
UnwoundURL string `json:"unwound_url"` | ||
} | ||
|
||
type responseRecentSearch struct { | ||
Data []responseTweet `json:"data"` | ||
Includes struct { | ||
Users []*User `json:"users"` | ||
Tweets []*responseTweet `json:"tweets"` | ||
} `json:"includes"` | ||
} | ||
|
||
type responseTweet struct { | ||
ID string `json:"id"` | ||
Text string `json:"text"` | ||
CreatedAt time.Time `json:"created_at"` | ||
AuthorID string `json:"author_id"` | ||
Lang string `json:"lang"` | ||
Entities Entities `json:"entites"` | ||
ReferencedTweets []referencedTweet `json:"referenced_tweets"` | ||
InReplyToUserID string `json:"in_reply_to_user_id"` | ||
} | ||
|
||
type referencedTweet struct { | ||
Type referencedTweetType `json:"type"` | ||
ID string `json:"id"` | ||
} | ||
|
||
type referencedTweetType string | ||
|
||
const ( | ||
typeRetweeted referencedTweetType = "retweeted" | ||
typeQuoted referencedTweetType = "quoted" | ||
typeRepliedTo referencedTweetType = "replied_to" | ||
) |