Documentation ¶
Index ¶
- func RevalidateOAuthToken(clientSecret string, clientID string) (*oauthTokenResponse, error)
- type Achievement
- type Availability
- type Beatmap
- type BeatmapCompact
- type BeatmapScores
- type BeatmapUserScore
- type Beatmapset
- type BeatmapsetCompact
- type BeatmapsetDiscussion
- type BeatmapsetDiscussionPost
- type BeatmapsetDiscussionVote
- type Channel
- type ChatChannel
- type ChatMessage
- type Comment
- type CommentBundle
- type CommentableMeta
- type Country
- type Covers
- type CurrentUserAttributes
- type Cursor
- type Event
- type EventAchievement
- type EventBeatmap
- type EventBeatmapPlaycount
- type EventBeatmapset
- type EventBeatmapsetApprove
- type EventBeatmapsetDelete
- type EventBeatmapsetRevive
- type EventBeatmapsetUpdate
- type EventBeatmapsetUpload
- type EventRank
- type EventRankLost
- type EventType
- type EventUser
- type EventUserSupportAgain
- type EventUserSupportFirst
- type EventUserSupportGift
- type EventUsernameChange
- type Failtimes
- type ForumPost
- type ForumTopic
- type GameMod
- type GameMode
- type Giver
- type GosuClient
- func (c *GosuClient) DoRequest(method string, url string, params map[string]interface{}) ([]byte, error)
- func (c *GosuClient) GetBeatmap(beatmapID string) (*Beatmap, error)
- func (c *GosuClient) GetBeatmapScores(beatmapID string, params map[string]interface{}) (*BeatmapScores, error)
- func (c *GosuClient) GetUserBeatmapScore(beatmapID string, userID string, params map[string]interface{}) (*BeatmapUserScore, error)
- func (c *GosuClient) LookupBeatmap(data string, queryType string) (*Beatmap, error)
- type GradeCounts
- type Group
- type Hype
- type Kudosu
- type KudosuHistory
- type MultiplayerScore
- type MultiplayerScores
- type MultiplayerScoresAround
- type MultiplayerScoresCursor
- type MultiplayerScoresSort
- type Nominations
- type Notification
- type Post
- type ProfileBanner
- type ProfilePage
- type RankStatus
- type RankingType
- type Rankings
- type Score
- type ScoreCount
- type Spotlight
- type Spotlights
- type User
- type UserAccountHistory
- type UserBadge
- type UserCompact
- type UserCover
- type UserGroup
- type UserLevel
- type UserMonthlyPlaycount
- type UserStatistics
- type UserStatisticsRulesets
- type WikiPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RevalidateOAuthToken ¶
Types ¶
type Achievement ¶
type Achievement struct { }
type Availability ¶
type Beatmap ¶
type Beatmap struct { BeatmapCompact Accuracy float64 `json:"accuracy"` AR float64 `json:"ar"` BeatmapSetID int `json:"beatmapset_id"` BPM float64 `json:"bpm"` Convert bool `json:"convert"` CountCircles int `json:"count_circles"` CountSliders int `json:"count_sliders"` CountSpinners int `json:"count_spinners"` CS float64 `json:"cs"` DeletedAt time.Time `json:"deleted_at"` Drain float64 `json:"drain"` HitLength int `json:"hit_length"` IsScoreable bool `json:"is_scoreable"` LastUpdated time.Time `json:"last_updated"` ModeInt int `json:"mode_int"` PassCount int `json:"passcount"` PlayCount int `json:"playcount"` Ranked RankStatus `json:"ranked"` URL string `json:"url"` }
type BeatmapCompact ¶
type BeatmapCompact struct { DifficultyRating float64 `json:"difficulty_rating"` ID int `json:"id"` Mode string `json:"mode"` // TODO: make this compatible with enum (pain in the butt) Status string `json:"status"` TotalLength int `json:"total_length"` Version string `json:"version"` // Optional attributes Beatmapset BeatmapsetCompact `json:"beatmapset"` Checksum string `json:"checksum"` Failtimes Failtimes `json:"failtimes"` MaxCombo int `json:"max_combo"` }
type BeatmapScores ¶
type BeatmapScores struct { Scores []Score UserScore BeatmapUserScore }
type BeatmapUserScore ¶
type Beatmapset ¶
type Beatmapset struct { BeatmapsetCompact `json:"beatmapset_compact"` Availability BPM float64 `json:"bpm"` CanBeHyped bool `json:"can_be_hyped"` Creator string `json:"creator"` DiscussionEnabled bool `json:"discussion_enabled"` DiscussionLocked bool `json:"discussion_locked"` Hype Hype `json:"hype"` IsScoreable bool `json:"is_scoreable"` LastUpdated time.Time `json:"last_updated"` LegacyThreadURL string `json:"legacy_thread_url"` Ranked int `json:"ranked"` RankedDate time.Time `json:"ranked_date"` Source string `json:"source"` Storyboard bool `json:"storyboard"` SubmittedDate time.Time `json:"submitted_date"` Tags string `json:"tags"` }
type BeatmapsetCompact ¶
type BeatmapsetCompact struct { Artist string `json:"artist"` ArtistUnicode string `json:"artist_unicode"` Covers Covers `json:"covers"` Creator string `json:"creators"` FavoriteCount int `json:"favourite_count"` ID int `json:"id"` NSFW bool `json:"nsfw"` PlayCount int `json:"play_count"` PreviewURL string `json:"preview_url"` Source string `json:"source"` Status string `json:"status"` Title string `json:"title"` TitleUnicode string `json:"title_unicode"` UserID int `json:"user_id"` Video bool `json:"video"` // Optional attributes // FIXME: Actual Types for most of these fields are unspecified Beatmaps []Beatmap `json:"beatmaps"` Converts string `json:"converts"` CurrentUserAttributes string `json:"current_user_attributes"` Description string `json:"description"` Discussions string `json:"discussions"` Events string `json:"events"` Genre string `json:"genre"` HasFavorited bool `json:"has_favourited"` // always included Language string `json:"language"` Nominations Nominations `json:"nominations_summary"` Ratings [100]int `json:"ratings"` RecentFavorites string `json:"recent_favourites"` RelatedUsers string `json:"related_users"` User string `json:"user"` }
type BeatmapsetDiscussion ¶
type BeatmapsetDiscussion struct { Beatmap BeatmapCompact BeatmapID int Beatmapset BeatmapsetCompact BeatmapsetID int CanBeResolved bool CanGrantKudosu bool CreatedAt string CurrentUserAttributes CurrentUserAttributes DeletedAt time.Time DeletedByID int ID int KudosuDenied bool LastPostAt time.Time MessageType string // FIXME: originally a "MessageType" object, not in docs ParentID int Posts []BeatmapsetDiscussionPost Resolved bool StartingPost BeatmapsetDiscussionPost Timestamp time.Time UpdatedAt time.Time UserID int Votes []BeatmapsetDiscussionVote // FIXME: structure will change }
type ChatChannel ¶
type ChatChannel struct { ChannelID int Name string Description string Icon string // display icon for the channel ChannelType Channel // see channel types below FirstMessageID int // messageID of first message (only returned in presence responses) LastReadID int // messageID of last message read (only returned in presence responses) LastMessageID int // messageID of last known message (only returned in presence responses) RecentMessages []ChatMessage // up to 50 most recent messages Moderated bool // user can't send message when the value is true (only returned in presence responses) Users []int // array of userID that are in the channel (not included for PUBLIC channels) }
type ChatMessage ¶
type ChatMessage struct { MessageID int // unique Identifier for message SenderID int // userID of the sender ChannelID int // channelID of where the message was sent Timestamp time.Time // when the message was sent, ISO-8601 Content string // message content IsAction bool // was this an action i.e. /me dances Sender UserCompact // embeded UserCompact object to save additional api lookups }
type Comment ¶
type Comment struct { CommentableID int // ID of the object the comment is attached to CommentableType string // type of object the comment is attached to CreatedAt string // ISO 8601 date DeletedAt string // ISO 8601 date if the comment was deleted; null, otherwise EditedAt string // ISO 8601 date if the comment was edited; null, otherwise EditedByID int // user ID of the user that edited the post; null, otherwise ID int // the ID of the comment LegacyName string // username displayed on legacy comments Message string // markdown of the comment's content MessageHTML string // html version of the comment's content ParentID int // ID of the comment's parent Pinned bool // Pin status of the comment RepliesCount int // int of replies to the comment UpdatedAt string // ISO 8601 date UserID int // user ID of the poster VotesCount int // int of votes }
type CommentBundle ¶
type CommentBundle struct { CommentableMeta CommentableMeta // ID of the object the comment is attached to Comments []Comment // array of comments ordered according to sort; Cursor Cursor // no desc HasMore bool // If there are more comments or replies available HasMoreID int // no desc IncludedComments []Comment // related comments; e.g. parent comments and nested replies PinnedComments []Comment // pinned comments Sort string // one of the CommentSort types TopLevelCount int // num of comments at the top level. Not returned for replies. Total int // total num of comments. Not retuned for replies. UserFollow bool // is the current user watching the comment thread UserVotes []int // IDs of the comments in the bundle the current user has upvoted Users []UserCompact // array of users related to the comments }
type CommentableMeta ¶
type CurrentUserAttributes ¶
type EventAchievement ¶
type EventAchievement struct { Achievement Achievement User EventUser }
When user obtained an achievement.
type EventBeatmap ¶
type EventBeatmapPlaycount ¶
type EventBeatmapPlaycount struct { Beatmap EventBeatmap Count int }
When a beatmap has been played for certain number of times.
type EventBeatmapset ¶
type EventBeatmapsetApprove ¶
type EventBeatmapsetApprove struct { Approval RankStatus Beatmapset EventBeatmapset User EventUser // Beatmapset owner }
When a beatmapset changes state.
type EventBeatmapsetDelete ¶
type EventBeatmapsetDelete struct {
Beatmapset EventBeatmapset
}
When a beatmapset is deleted.
type EventBeatmapsetRevive ¶
type EventBeatmapsetRevive struct { Beatmapset EventBeatmapset User EventUser // Beatmapset owner }
When a beatmapset in graveyard state is updated.
type EventBeatmapsetUpdate ¶
type EventBeatmapsetUpdate struct { Beatmapset EventBeatmapset User EventUser // Beatmapset owner }
When a beatmapset is updated.
type EventBeatmapsetUpload ¶
type EventBeatmapsetUpload struct { Beatmapset EventBeatmap User EventUser // Beatmapset owner }
When a new beatmapset is uploaded.
type EventRank ¶
type EventRank struct { ScoreRank string Rank int Mode GameMode Beatmap EventBeatmap User EventUser }
When a user achieves a certain rank on a beatmap.
type EventRankLost ¶
type EventRankLost struct { Mode GameMode Beatmap EventBeatmap User EventUser }
When a user loses first place to another user.
type EventUserSupportAgain ¶
type EventUserSupportAgain struct {
User EventUser
}
When a user supports osu! for the second and onwards.
type EventUserSupportFirst ¶
type EventUserSupportFirst struct {
User EventUser
}
When a user becomes a supporter for the first time.
type EventUserSupportGift ¶
type EventUserSupportGift struct {
User EventUser
}
When a user is gifted a supporter tag by another user.
type EventUsernameChange ¶
type EventUsernameChange struct {
User EventUser // Includes previousUsername
}
When a user changes their username.
type ForumTopic ¶
type GameMod ¶
type GameMod int
const ( NoFail GameMod = 1 << iota Easy TouchDevice Hidden HardRock SuddenDeath DoubleTime Relax HalfTime Nightcore // Only set along with DoubleTime. i.e: NC only gives 576 Flashlight Autoplay SpunOut Relax2 // Autopilot Perfect // Only set along with SuddenDeath. i.e: PF only gives 16416 Key4 Key5 Key6 Key7 Key8 FadeIn Random Cinema Target Key9 KeyCoop Key1 Key3 Key2 ScoreV2 Mirror None = 0 KeyMod = Key1 | Key2 | Key3 | Key4 | Key5 | Key6 | Key7 | Key8 | Key9 | KeyCoop FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Relax2 | SpunOut | KeyMod ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn )
type GosuClient ¶
type GosuClient struct { Token string // contains filtered or unexported fields }
func CreateGosuClient ¶
func CreateGosuClient(clientSecret string, clientID string) (*GosuClient, error)
func (*GosuClient) DoRequest ¶
func (c *GosuClient) DoRequest(method string, url string, params map[string]interface{}) ([]byte, error)
Send a request to the Gosu client, given: `method`: "GET/POST" `url`: the HTTP request url, e.g. "beatmaps/lookup" `params`: the parameters, in map[string]interface{}{...} format
func (*GosuClient) GetBeatmap ¶
func (c *GosuClient) GetBeatmap(beatmapID string) (*Beatmap, error)
Returns a *Beatmap, given:
`beatmapID`: the ID of the beatmap
func (*GosuClient) GetBeatmapScores ¶
func (c *GosuClient) GetBeatmapScores(beatmapID string, params map[string]interface{}) (*BeatmapScores, error)
Returns a *BeatmapScores, given:
`beatmapID`: the ID of the beatmap `params`: `mode`: the gamemode to get scores for (string) `mods`: An array of matching mods `type`: Beatmap score ranking type
func (*GosuClient) GetUserBeatmapScore ¶
func (c *GosuClient) GetUserBeatmapScore(beatmapID string, userID string, params map[string]interface{}) (*BeatmapUserScore, error)
Returns a *BeatmapUserScore, given:
`beatmapID`: the ID of the beatmap `userID`: the user you want to get the score of `params`: `mode`: the gamemode to get scores for (string) `mods`: An array of matching mods
func (*GosuClient) LookupBeatmap ¶
func (c *GosuClient) LookupBeatmap(data string, queryType string) (*Beatmap, error)
Returns a *Beatmap, given data and query type (checksum, filename, or id)
type GradeCounts ¶
type Group ¶
type Group struct { ID int `json:"id"` Identifier string `json:"identifier"` // Unique string to identify the group. IsProbationary string `json:"is_probationary"` // Whether members of this group are considered probationary. HasPlaymodes bool `json:"has_playmodes"` // If this group associates GameModes with a user's membership, e.g. BN/NAT members Name string `json:"name"` ShortName string `json:"short_name"` // Short Name of the group for display. Description string `json:"description"` Color string `json:"colour"` }
type KudosuHistory ¶
type KudosuHistory struct { ID int Action string // Either give, reset, or revoke Amount int Model string // Object type which the exchange happened on (forum_post, etc) CreatedAt time.Time Giver Giver // Simple detail of the user who started the exchange. Post Post // Simple detail of the object for display. }
type MultiplayerScore ¶
type MultiplayerScore struct { ID int UserID int RoomID int PlaylistItemID int BeatmapID int Rank RankStatus TotalScore int Accuracy int MaxCombo int Mods []GameMod Statistics UserStatistics Passed bool Position int ScoresAround MultiplayerScoresAround // Scores around the specified score. User User }
type MultiplayerScores ¶
type MultiplayerScores struct { Cursor MultiplayerScoresCursor Params []string // not specified Scores []MultiplayerScore Total int UserScores MultiplayerScore }
type MultiplayerScoresAround ¶
type MultiplayerScoresAround struct { Higher *MultiplayerScores Lower *MultiplayerScores }
type MultiplayerScoresCursor ¶
type MultiplayerScoresSort ¶
type Nominations ¶
type Notification ¶
type ProfileBanner ¶
type ProfilePage ¶
type ProfilePage struct { Me string `json:"me"` RecentActivity string `json:"recent_activity"` Beatmaps string `json:"beatmaps"` Historical string `json:"historical"` Kudosu Kudosu `json:"kudosu"` TopRanks string `json:"top_ranks"` Medals string `json:"medals"` }
FIXME: unspecified types
type RankStatus ¶
type RankStatus int
const ( Graveyard RankStatus = iota - 2 WIP Pending Ranked Approved Qualified Loved )
type RankingType ¶
type RankingType int
const ( RankingSpotlight RankingType = iota RankingCountry RankingPerformance RankingScore )
type Rankings ¶
type Rankings struct { Beatmapsets []Beatmapset // The lis of beatmaps in the requested spotlight fo the given mode; only available if type is chart Cursor Cursor // A curso Ranking []UserStatistics // Score details ordered by rank in desending order Spotlight Spotlight // Spotlight details; only available iftype is chart Total int // An approximate count of ranks availl }
type Score ¶
type Score struct { ID int `json:"id"` BestID int `json:"best_id"` UserID int `json:"user_id"` Accuracy float64 `json:"accuracy"` Mods []string `json:"mods"` // TODO: add enum support Score int `json:"score"` MaxCombo int `json:"max_combo"` Perfect bool `json:"perfect"` Statistics ScoreCount `json:"statistics"` PP float64 `json:"pp"` Rank string `json:"rank"` // TODO: add enum support CreatedAt time.Time `json:"created_at"` Mode string `json:"mode"` ModeInt int `json:"mode_int"` Replay bool `json:"replay"` // Optional attributes Beatmap Beatmap `json:"beatmap"` Beatmapset Beatmapset `json:"beatmapset"` RankCountry int `json:"rank_country"` RankGlobal int `json:"rank_global"` Weight float64 `json:"weight"` User User `json:"user"` Match string `json:"match"` }
FIXME: Score struct has no type specifications
type ScoreCount ¶
type Spotlight ¶
type Spotlight struct { EndDate time.Time // The end date of the pot ID int // The ID of this spotl ModeSpecific int // If the spotlight has diferent mades specific to each Gam. ParticipantCount int // The number of users partcipaing in this spotlight. This is only shown when viewing a single spotligt. Name int //The Name of the spotliht StartDate time.Time // The starting date of he sph SpotlightType string // The type of spotligh }
type User ¶
type User struct { UserCompact CoverURL string `json:"cover_url"` // URL of profile cover Discord string `json:"discord"` // HasSupported bool `json:"has_supported"` // whether or not ever being a supporter in the past Interests string `json:"interests"` // JoinDate time.Time `json:"join_date"` // Kudosu Kudosu `json:"Kudosu"` // Location string `json:"location"` // MaxBlocks int `json:"max_blocks"` // maximum int of users allowed to be blocked MaxFriends int `json:"max_friends"` // maximum int of friends allowed to be added Occupation string `json:"occupation"` // Playmode GameMode `json:"playmode"` // Playstyle string `json:"playstyle"` // Device choices of the user. PostCount int `json:"post_count"` // int of forum posts ProfileOrder []ProfilePage `json:"profile_order"` // ordered array of sections in user profile page Title string `json:"title"` // user-specific title TitleURL string `json:"title_url"` // Twitter string `json:"twitter"` // Website string `json:"website"` // }
type UserAccountHistory ¶
type UserCompact ¶
type UserCompact struct { AvatarURL string `json:"avatar_url"` // URL of user's avatar CountryCode string `json:"country_code"` // two-letter code representing user's country DefaultGroup string `json:"default_group"` // Identifier of the default Group the user belongs to. ID int `json:"id"` // unique identifier for user IsActive bool `json:"is_active"` // has this account been active in the last x months? IsBot bool `json:"is_bot"` // is this a bot account? IsDeleted bool `json:"is_deleted"` // is the user currently online? (either on lazer or the new website) IsOnline bool `json:"is_online"` // IsSupporter bool `json:"is_supported"` // does this user have supporter? LastVisit time.Time `json:"last_visit"` // last access time. null if the user hides online presence PMFriendsOnly bool `json:"pm_friends_only"` // whether or not the user allows PM from other than friends ProfileColor string `json:"profile_colour"` // color of username/profile highlight, hex code (e.g. #333333) Username string `json:"username"` // user's display Name // Optional attributes AccountHistory []UserAccountHistory `json:"account_history"` ActiveTournamentBanner ProfileBanner `json:"active_tournament_banner"` Badges []UserBadge `json:"badges"` BeatmapsPlaycountCount int `json:"beatmap_playcounts_count"` Blocks string `json:"blocks"` // FIXME: Unspecified in docs Country Country `json:"country"` // FIXME: Unspecified in docs Cover UserCover `json:"cover"` // FIXME: Unspecified in docs FavoriteBeatmapsetCount int `json:"favourite_beatmapset_count"` FollowerCount int `json:"follower_count"` Friends []string `json:"friends"` // FIXME: Unspecified in docs GraveyardBeatmapsetCount int `json:"graveyard_beatmapset_count"` Groups []UserGroup `json:"groups"` IsAdmin bool `json:"is_admin"` IsBNG bool `json:"is_bng"` IsFullBN bool `json:"is_full_bn"` IsGMT bool `json:"is_gmt"` IsLimitedBN bool `json:"is_limited_bn"` IsModerator bool `json:"is_moderator"` IsNAT bool `json:"is_nat"` IsRestricted bool `json:"is_restricted"` IsSilenced bool `json:"is_silenced"` LovedBeatmapsetCount int `json:"loved_beatmapset_count"` MonthlyPlaycounts []UserMonthlyPlaycount `json:"monthly_playcounts"` Page string `json:"page "` // FIXME: Unspecified in docs PreviousUsernames []string `json:"previous_usernames"` // FIXME: Unspecified in docs RankedAndApprovedBeatmapsetCount int `json:"ranked_and_approved_beatmapset_count"` ReplaysWatchedCount int `json:"replays_watched_counts"` ScoresBestCount int `json:"scores_best_count"` ScoresFirstCount int `json:"scores_first_count"` ScoresRecentCount int `json:"scores_recent_count"` Statistics *UserStatistics `json:"statistics"` // FIXME: Unspecified in docs StatisticsRulesets UserStatisticsRulesets `json:"statistics_rulesets"` SupportLevel int `json:"support_level"` // FIXME: Unspecified in docs UnrankedBeatmapsetCount int `json:"unranked_beatmapset_count"` // FIXME: Unspecified in docs UnreadPMCount int `json:"unread_pm_count"` // FIXME: Unspecified in docs UserAchievements int `json:"user_achievements"` // FIXME: Unspecified in docs UserPreferences string `json:"user_preferences"` // FIXME: Unspecified in docs RankHistory string `json:"rank_history"` // FIXME: Unspecified in docs }
type UserGroup ¶
type UserGroup struct { ID int `json:"id"` // ID (of Group) Identifier string `json:"identifier"` // Unique string to identify the group. IsProbationary bool `json:"is_probationary"` // Whether members of this group are considered probationary. Name string `json:"name"` // ShortName string `json:"short_name"` // Short Name of the group for display. Description string `json:"description"` // Color string `json:"colour"` // Playmodes []string `json:"playmodes"` // GameModes which the member is responsible for, e.g. in the case of BN/NAT (only present when hasPlaymodes is set on Group) }
type UserMonthlyPlaycount ¶
type UserMonthlyPlaycount struct { }
type UserStatistics ¶
type UserStatistics struct { GradeCounts GradeCounts HitAccuracy int `json:"hit_accuracy"` // Hit accuracy percentage IsRanked bool `json:"is_ranked"` // Is actively ranked Level UserLevel `json:"level"` // MaxCombo int `json:"maximum_combo"` // Highest maximum combo. PlayCount int `json:"play_count"` // Number of maps played. PlayTime int `json:"play_time"` // Cumulative time played. PP int `json:"pp"` // Performance points GlobalRank int `json:"global_rank"` // Current rank according to pp. RankedScore int `json:"ranked_score"` // Current ranked score. ReplaysWatchedByOthers int `json:"replays_watched_by_others"` // Number of replays watched by other users. TotalHits int `json:"total_hits"` // Total int of hits. TotalScore int `json:"total_score"` // Total score. User *UserCompact `json:"user"` // The associated user. }
type UserStatisticsRulesets ¶
type UserStatisticsRulesets struct { }
type WikiPage ¶
type WikiPage struct { Layout string // The layout type for the page. Locale string // All lowercase BCP 47 language tag. Markdown string // Markdown content. Path string // Path of the article. Subtitle string // The article's subtitle. Tags []string // Associated tags for the article. Title string // The article's title. }