feta/jsonapis.go

155 lines
5.9 KiB
Go

package feta
import "time"
import "fmt"
// thank fuck for https://mholt.github.io/json-to-go/ otherwise
// this would have been a giant pain in the dick
type mastodonIndexResponse struct {
Instances []struct {
ID string `json:"_id"`
AddedAt time.Time `json:"addedAt"`
Name string `json:"name"`
Downchecks int `json:"downchecks"`
Upchecks int `json:"upchecks"`
HTTPSRank interface{} `json:"https_rank"`
HTTPSScore int `json:"https_score"`
ObsRank string `json:"obs_rank"`
ObsScore int `json:"obs_score"`
Ipv6 bool `json:"ipv6"`
Up bool `json:"up"`
Users int `json:"users"`
Statuses string `json:"statuses"`
Connections int `json:"connections"`
OpenRegistrations bool `json:"openRegistrations"`
Uptime float64 `json:"uptime"`
Version string `json:"version"`
VersionScore int `json:"version_score"`
UpdatedAt time.Time `json:"updatedAt"`
CheckedAt time.Time `json:"checkedAt"`
Dead bool `json:"dead"`
ObsDate time.Time `json:"obs_date"`
Second60 int `json:"second60"`
Second int `json:"second"`
ActiveUserCount interface{} `json:"active_user_count,omitempty"`
FirstUserCreatedAt interface{} `json:"first_user_created_at,omitempty"`
Thumbnail string `json:"thumbnail"`
ApUpdatedAt time.Time `json:"apUpdatedAt"`
Second5 int `json:"second5"`
RawVersion string `json:"raw_version"`
ActivityPrevw struct {
Statuses int `json:"statuses"`
Logins int `json:"logins"`
Registrations int `json:"registrations"`
} `json:"activity_prevw,omitempty"`
Mastodon bool `json:"mastodon"`
UptimeStr string `json:"uptime_str"`
Score int `json:"score"`
ScoreStr string `json:"score_str"`
} `json:"instances"`
}
type pleromaIndexResponse []struct {
Domain string `json:"domain"`
Title string `json:"title"`
Thumbnail string `json:"thumbnail"`
Registration bool `json:"registration"`
Chat bool `json:"chat"`
Gopher bool `json:"gopher"`
WhoToFollow bool `json:"who_to_follow"`
MediaProxy bool `json:"media_proxy"`
ScopeOptions bool `json:"scope_options"`
AccountActivationRequired bool `json:"account_activation_required"`
TextLimit int `json:"text_limit"`
}
type nodeInfoVersionTwoSchema struct {
Version string `json:"version"`
Software struct {
Name string `json:"name"`
Version string `json:"version"`
} `json:"software"`
Protocols []string `json:"protocols"`
Usage struct {
Users struct {
Total int `json:"total"`
ActiveMonth int `json:"activeMonth"`
ActiveHalfyear int `json:"activeHalfyear"`
} `json:"users"`
LocalPosts int `json:"localPosts"`
} `json:"usage"`
OpenRegistrations bool `json:"openRegistrations"`
}
type nodeInfoWellKnownResponse struct {
Links []struct {
Rel string `json:"rel"`
Href string `json:"href"`
} `json:"links"`
}
func (atl *apTootList) String() string {
return fmt.Sprintf("%+v", atl)
}
type apTootList []struct {
Account struct {
Acct string `json:"acct"`
Avatar string `json:"avatar"`
AvatarStatic string `json:"avatar_static"`
Bot bool `json:"bot"`
CreatedAt time.Time `json:"created_at"`
DisplayName string `json:"display_name"`
Fields []interface{} `json:"fields"`
FollowersCount int `json:"followers_count"`
FollowingCount int `json:"following_count"`
Header string `json:"header"`
HeaderStatic string `json:"header_static"`
ID string `json:"id"`
Locked bool `json:"locked"`
Note string `json:"note"`
Source struct {
Fields []interface{} `json:"fields"`
Note string `json:"note"`
Sensitive bool `json:"sensitive"`
} `json:"source"`
StatusesCount int `json:"statuses_count"`
URL string `json:"url"`
Username string `json:"username"`
} `json:"account"`
Application struct {
Name string `json:"name"`
Website interface{} `json:"website"`
} `json:"application"`
Bookmarked bool `json:"bookmarked"`
Card interface{} `json:"card"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
Favourited bool `json:"favourited"`
FavouritesCount int `json:"favourites_count"`
ID string `json:"id"`
InReplyToAccountID string `json:"in_reply_to_account_id"`
InReplyToID string `json:"in_reply_to_id"`
Language interface{} `json:"language"`
MediaAttachments []interface{} `json:"media_attachments"`
Mentions []struct {
Acct string `json:"acct"`
ID string `json:"id"`
URL string `json:"url"`
Username string `json:"username"`
} `json:"mentions"`
Muted bool `json:"muted"`
Pinned bool `json:"pinned"`
Poll interface{} `json:"poll"`
Reblog interface{} `json:"reblog"`
Reblogged bool `json:"reblogged"`
ReblogsCount int `json:"reblogs_count"`
RepliesCount int `json:"replies_count"`
Sensitive bool `json:"sensitive"`
SpoilerText string `json:"spoiler_text"`
Tags []interface{} `json:"tags"`
URI string `json:"uri"`
URL string `json:"url"`
Visibility string `json:"visibility"`
}