Documentation
¶
Index ¶
- Variables
- func Do(req *http.Request) (*http.Response, error)
- func DoAndParse[T any](req *http.Request) (val T, err error)
- func NewAPIv2Request(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
- func NewWebRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
- func SetAuthHeader(req *http.Request, accessToken string)
- func SetDefaultHeaders(req *http.Request)
- type BatchResponse
- type Beatmap
- type BeatmapExtended
- type BeatmapSet
- type Client
- func (c *Client) DownloadReplay(ctx context.Context, accessToken string, scoreId int) ([]byte, error)
- func (c *Client) ExchangeToken(ctx context.Context, code, redirectUri string) (ExchangeTokenResponse, error)
- func (c *Client) GetClientAccessToken(ctx context.Context) (ClientToken, error)
- func (c *Client) GetMe(ctx context.Context, accessToken string) (UserExtended, error)
- func (c *Client) GetMultiRooms(ctx context.Context, accessToken string) ([]MultiRoom, error)
- func (c *Client) GetRankings(ctx context.Context, accessToken string, cursor *Cursor, opts ...RankingsOpts) (Rankings, error)
- func (c *Client) GetScore(ctx context.Context, accessToken string, scoreId int) (Score, error)
- func (c *Client) GetUser(ctx context.Context, accessToken string, userId int) (UserExtended, error)
- func (c *Client) GetUserScores(ctx context.Context, accessToken string, userId int, limit, offset int) ([]Score, error)
- func (c *Client) GetUsers(ctx context.Context, accessToken string, userIds []int) (BatchResponse, error)
- func (c *Client) TokenRefresh(ctx context.Context, refreshToken string) (ExchangeTokenResponse, error)
- type ClientToken
- type Covers
- type Cursor
- type ExchangeTokenResponse
- type MultiRoom
- type Rankings
- type RankingsOpts
- type Ruleset
- type Score
- type ScoreMod
- type ScoreStatistics
- type User
- type UserExtended
- type UserFromBatch
- type UserStatistics
- type UserStats
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = fmt.Errorf("resource not found")
)
Functions ¶
func NewAPIv2Request ¶
func NewWebRequest ¶
func SetAuthHeader ¶
func SetDefaultHeaders ¶
Types ¶
type BatchResponse ¶
type BatchResponse struct {
Users []UserFromBatch `json:"users"`
}
type BeatmapExtended ¶
type BeatmapSet ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DownloadReplay ¶
func (*Client) ExchangeToken ¶
func (*Client) GetClientAccessToken ¶
func (c *Client) GetClientAccessToken(ctx context.Context) (ClientToken, error)
func (*Client) GetMultiRooms ¶
func (*Client) GetRankings ¶
func (*Client) GetUserScores ¶
func (*Client) TokenRefresh ¶
type ClientToken ¶
type ExchangeTokenResponse ¶
type ExchangeTokenResponse struct {
// always "Bearer"
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
}
func (ExchangeTokenResponse) ExpiresAt ¶
func (r ExchangeTokenResponse) ExpiresAt() time.Time
type RankingsOpts ¶
type RankingsOpts struct {
Country *string
}
type Score ¶
type Score struct {
ID int `json:"id"`
PP float32 `json:"pp"`
Mods []ScoreMod `json:"mods"`
Accuracy float32 `json:"accuracy"`
BeatmapID int `json:"beatmap_id"`
HasReplay bool `json:"has_replay"`
ReplayLegacy bool `json:"replay"`
UserId int `json:"user_id"`
User User `json:"user"`
Statistics ScoreStatistics `json:"statistics"`
BeatmapSet BeatmapSet `json:"beatmapset"`
Beatmap BeatmapExtended `json:"beatmap"`
}
func (Score) ModsAcronyms ¶
type ScoreStatistics ¶
type User ¶
type User struct {
ID int `json:"id"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
CountryCode string `json:"country_code"`
IsActive bool `json:"is_active"`
IsBot bool `json:"is_bot"`
IsDeleted bool `json:"is_deleted"`
IsOnline bool `json:"is_online"`
IsSupporter bool `json:"is_supporter"`
LastVisit time.Time `json:"last_visit"`
Statistics UserStatistics `json:"statistics"`
}
type UserExtended ¶
type UserExtended struct {
User
// deprecated, use cover.url instead
CoverURL string `json:"cover_url"`
Discord string `json:"discord"`
HasSupported bool `json:"has_supported"`
Interests string `json:"interests"`
JoinDate time.Time `json:"join_date"`
Location *string `json:"location"`
MaxBlocks int `json:"max_blocks"`
MaxFriends int `json:"max_friends"`
Occupation *string `json:"occupation"`
Playmode string `json:"playmode"`
Playstyle []string `json:"playstyle"`
PostCount int `json:"post_count"`
ProfileHue *int `json:"profile_hue"`
// TODO: dont really care about these, maybe add them later if needed
ProfileOrder []string `json:"profile_order"`
Title *string `json:"title"`
TitleURL *string `json:"title_url"`
Twitter *string `json:"twitter"`
Website *string `json:"website"`
}
type UserFromBatch ¶
type UserFromBatch struct {
ID int `json:"id"`
Username string `json:"username"`
AvatarURL string `json:"avatar_url"`
CountryCode string `json:"country_code"`
IsActive bool `json:"is_active"`
IsBot bool `json:"is_bot"`
IsDeleted bool `json:"is_deleted"`
IsOnline bool `json:"is_online"`
IsSupporter bool `json:"is_supporter"`
LastVisit time.Time `json:"last_visit"`
StatisticsRulesets struct {
Standard UserStatistics `json:"osu"`
} `json:"statistics_rulesets"`
}
TODO
type UserStatistics ¶
Click to show internal directories.
Click to hide internal directories.