Updated entities and json structs for API v2.6.0

Added missing fields to various structs and sorted them in the same order as
the original mastodon API documentation does. This should make it easier to
compare go-mastodon's structs with the original documentation.
This commit is contained in:
Christian Muehlhaeuser 2018-11-24 06:46:49 +01:00 committed by mattn
parent 3daf61de23
commit 4def10a243
4 changed files with 70 additions and 41 deletions

View File

@ -141,7 +141,11 @@ type Relationship struct {
FollowedBy bool `json:"followed_by"` FollowedBy bool `json:"followed_by"`
Blocking bool `json:"blocking"` Blocking bool `json:"blocking"`
Muting bool `json:"muting"` Muting bool `json:"muting"`
MutingNotifications bool `json:"muting_notifications"`
Requested bool `json:"requested"` Requested bool `json:"requested"`
DomainBlocking bool `json:"domain_blocking"`
ShowingReblogs bool `json:"showing_reblogs"`
Endorsed bool `json:"endorsed"`
} }
// AccountFollow follow the account. // AccountFollow follow the account.

View File

@ -12,9 +12,11 @@ type Instance struct {
Description string `json:"description"` Description string `json:"description"`
EMail string `json:"email"` EMail string `json:"email"`
Version string `json:"version,omitempty"` Version string `json:"version,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"`
URLs map[string]string `json:"urls,omitempty"` URLs map[string]string `json:"urls,omitempty"`
Stats *InstanceStats `json:"stats,omitempty"` Stats *InstanceStats `json:"stats,omitempty"`
Thumbnail string `json:"thumbnail,omitempty"` Languages []string `json:"languages"`
ContactAccount *Account `json:"account"`
} }
// InstanceStats hold information for mastodon instance stats. // InstanceStats hold information for mastodon instance stats.

View File

@ -213,6 +213,14 @@ type Mention struct {
type Tag struct { type Tag struct {
Name string `json:"name"` Name string `json:"name"`
URL string `json:"url"` URL string `json:"url"`
History []History `json:"history"`
}
// History hold information for history.
type History struct {
Day string `json:"day"`
Uses int64 `json:"uses"`
Accounts int64 `json:"accounts"`
} }
// Attachment hold information for attachment. // Attachment hold information for attachment.
@ -223,13 +231,15 @@ type Attachment struct {
RemoteURL string `json:"remote_url"` RemoteURL string `json:"remote_url"`
PreviewURL string `json:"preview_url"` PreviewURL string `json:"preview_url"`
TextURL string `json:"text_url"` TextURL string `json:"text_url"`
Description string `json:"description"`
} }
// Emoji hold information for CustomEmoji. // Emoji hold information for CustomEmoji.
type Emoji struct { type Emoji struct {
ShortCode string `json:"shortcode"` ShortCode string `json:"shortcode"`
URL string `json:"url"`
StaticURL string `json:"static_url"` StaticURL string `json:"static_url"`
URL string `json:"url"`
VisibleInPicker bool `json:"visible_in_picker"`
} }
// Results hold information for search result. // Results hold information for search result.

View File

@ -11,26 +11,31 @@ import (
// Status is struct to hold status. // Status is struct to hold status.
type Status struct { type Status struct {
ID ID `json:"id"` ID ID `json:"id"`
CreatedAt time.Time `json:"created_at"` URI string `json:"uri"`
URL string `json:"url"`
Account Account `json:"account"`
InReplyToID interface{} `json:"in_reply_to_id"` InReplyToID interface{} `json:"in_reply_to_id"`
InReplyToAccountID interface{} `json:"in_reply_to_account_id"` InReplyToAccountID interface{} `json:"in_reply_to_account_id"`
Reblog *Status `json:"reblog"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
Emojis []Emoji `json:"emojis"`
RepliesCount int64 `json:"replies_count"`
ReblogsCount int64 `json:"reblogs_count"`
FavouritesCount int64 `json:"favourites_count"`
Reblogged interface{} `json:"reblogged"`
Favourited interface{} `json:"favourited"`
Muted interface{} `json:"muted"`
Sensitive bool `json:"sensitive"` Sensitive bool `json:"sensitive"`
SpoilerText string `json:"spoiler_text"` SpoilerText string `json:"spoiler_text"`
Visibility string `json:"visibility"` Visibility string `json:"visibility"`
Application Application `json:"application"`
Account Account `json:"account"`
MediaAttachments []Attachment `json:"media_attachments"` MediaAttachments []Attachment `json:"media_attachments"`
Emojis []Emoji `json:"emojis"`
Mentions []Mention `json:"mentions"` Mentions []Mention `json:"mentions"`
Tags []Tag `json:"tags"` Tags []Tag `json:"tags"`
URI string `json:"uri"` Card *Card `json:"card"`
Content string `json:"content"` Application Application `json:"application"`
URL string `json:"url"` Language string `json:"language"`
ReblogsCount int64 `json:"reblogs_count"` Pinned interface{} `json:"pinned"`
FavouritesCount int64 `json:"favourites_count"`
Reblog *Status `json:"reblog"`
Favourited interface{} `json:"favourited"`
Reblogged interface{} `json:"reblogged"`
} }
// Context hold information for mastodon context. // Context hold information for mastodon context.
@ -45,6 +50,14 @@ type Card struct {
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
Image string `json:"image"` Image string `json:"image"`
Type string `json:"type"`
AuthorName string `json:"author_name"`
AuthorURL string `json:"author_url"`
ProviderName string `json:"provider_name"`
ProviderURL string `json:"provider_url"`
HTML string `json:"html"`
Width int64 `json:"width"`
Height int64 `json:"height"`
} }
// GetFavourites return the favorite list of the current user. // GetFavourites return the favorite list of the current user.