v1

package
v0.0.0-...-a462437 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package v1 implements the first version of the Ripple API.

first version of rippleapi this package is only here to clean up shit because user.go is a mess

Index

Constants

View Source
const (
	ClanClosed = iota
	ClanOpen
	ClanInviteOnly
	ClanRequestsOpen
)

Variables

View Source
var (
	Err500     = common.SimpleResponse(500, "An error occurred. Trying again may work. If it doesn't, yell at this Ripple instance admin and tell them to fix the API.")
	ErrBadJSON = common.SimpleResponse(400, "Your JSON for this request is invalid.")
)

Boilerplate errors

View Source
var SongNameRegex = regexp.MustCompile(`^(.+) - (.+) \[(.+)\]$`)

Functions

func BadgeMembersGET

func BadgeMembersGET(md common.MethodData) common.CodeMessager

BadgeMembersGET retrieves the people who have a certain badge.

func BadgesGET

func BadgesGET(md common.MethodData) common.CodeMessager

BadgesGET retrieves all the badges on this ripple instance.

func BeatmapGET

func BeatmapGET(md common.MethodData) common.CodeMessager

BeatmapGET retrieves a beatmap.

func BlogPostsGET

func BlogPostsGET(md common.MethodData) common.CodeMessager

BlogPostsGET retrieves the latest blog posts on the Ripple blog.

func ClanGenerateInvitePOST

func ClanGenerateInvitePOST(md common.MethodData) common.CodeMessager

func ClanJoinPOST

func ClanJoinPOST(md common.MethodData) common.CodeMessager

func ClanKickPOST

func ClanKickPOST(md common.MethodData) common.CodeMessager

func ClanLeaderboardGET

func ClanLeaderboardGET(md common.MethodData) common.CodeMessager

func ClanLeavePOST

func ClanLeavePOST(md common.MethodData) common.CodeMessager

func ClanMembersGET

func ClanMembersGET(md common.MethodData) common.CodeMessager

ClanMembersGET retrieves the people who are in a certain clan.

func ClanSettingsPOST

func ClanSettingsPOST(md common.MethodData) common.CodeMessager

func ClanStatsGET

func ClanStatsGET(md common.MethodData) common.CodeMessager

func ClanTransferOwnershipPOST

func ClanTransferOwnershipPOST(md common.MethodData) common.CodeMessager

func ClansFirstPlaceRankingGET

func ClansFirstPlaceRankingGET(md common.MethodData) common.CodeMessager

func ClansGET

func ClansGET(md common.MethodData) common.CodeMessager

clansGET retrieves all the clans on this ripple instance.

func CountriesGET

func CountriesGET(md common.MethodData) common.CodeMessager

func DiscordCallbackGET

func DiscordCallbackGET(md common.MethodData) common.CodeMessager

func ErrMissingField

func ErrMissingField(missingFields ...string) common.CodeMessager

ErrMissingField generates a response to a request when some fields in the JSON are missing.

func FollowersGET

func FollowersGET(md common.MethodData) common.CodeMessager

func FriendsAddPOST

func FriendsAddPOST(md common.MethodData) common.CodeMessager

FriendsAddPOST adds an user to the friends.

func FriendsDelPOST

func FriendsDelPOST(md common.MethodData) common.CodeMessager

FriendsDelPOST deletes an user's friend.

func FriendsGET

func FriendsGET(md common.MethodData) common.CodeMessager

FriendsGET is the API request handler for GET /friends. It retrieves an user's friends, and whether the friendship is mutual or not.

func FriendsWithGET

func FriendsWithGET(md common.MethodData) common.CodeMessager

FriendsWithGET checks the current user is friends with the one passed in the request path.

func Handle404

func Handle404(c *fasthttp.RequestCtx)

Handle404 handles requests with no implemented handlers.

func HealthGET

func HealthGET(md common.MethodData) common.CodeMessager

func HypotheticalRankGET

func HypotheticalRankGET(md common.MethodData) common.CodeMessager

func LeaderboardGET

func LeaderboardGET(md common.MethodData) common.CodeMessager

LeaderboardGET gets the leaderboard.

func LoadAchievementsEvery

func LoadAchievementsEvery(db *sqlx.DB, d time.Duration)

LoadAchievementsEvery reloads the achievements in the database every given amount of time.

func MatchGET

func MatchGET(md common.MethodData) common.CodeMessager

func PingGET

PingGET is a message to check with the API that we are logged in, and know what are our privileges.

func ResolveInviteGET

func ResolveInviteGET(md common.MethodData) common.CodeMessager

func ScoreGET

func ScoreGET(md common.MethodData) common.CodeMessager

func ScoresGET

func ScoresGET(md common.MethodData) common.CodeMessager

ScoresGET retrieves the top scores for a certain beatmap.

func ScoresPinAddPOST

func ScoresPinAddPOST(md common.MethodData) common.CodeMessager

func ScoresPinDelPOST

func ScoresPinDelPOST(md common.MethodData) common.CodeMessager

func SurpriseMeGET

func SurpriseMeGET(md common.MethodData) common.CodeMessager

SurpriseMeGET generates cute cats.

... Yes.

func TBadgeMembersGET

func TBadgeMembersGET(md common.MethodData) common.CodeMessager

BadgeMembersGET retrieves the people who have a certain badge.

func TBadgesGET

func TBadgesGET(md common.MethodData) common.CodeMessager

BadgesGET retrieves all the badges on this ripple instance.

func TokenGET

func TokenGET(md common.MethodData) common.CodeMessager

TokenGET retrieves a list listing all the user's public tokens.

func TokenSelfDeletePOST

func TokenSelfDeletePOST(md common.MethodData) common.CodeMessager

TokenSelfDeletePOST deletes the token the user is connecting with.

func TokenSelfGET

func TokenSelfGET(md common.MethodData) common.CodeMessager

TokenSelfGET retrieves information about the token the user is connecting with.

func UserAchievementsGET

func UserAchievementsGET(md common.MethodData) common.CodeMessager

UserAchievementsGET handles requests for retrieving the achievements of a given user.

func UserFirstGET

func UserFirstGET(md common.MethodData) common.CodeMessager

func UserFullGET

func UserFullGET(md common.MethodData) common.CodeMessager

UserFullGET gets all of an user's information, with one exception: their userpage.

func UserGradesGET

func UserGradesGET(md common.MethodData) common.CodeMessager

func UserLookupGET

func UserLookupGET(md common.MethodData) common.CodeMessager

UserLookupGET does a quick lookup of users beginning with the passed querystring value name.

func UserMostPlayedBeatmapsGET

func UserMostPlayedBeatmapsGET(md common.MethodData) common.CodeMessager

func UserScoresBestGET

func UserScoresBestGET(md common.MethodData) common.CodeMessager

UserScoresBestGET retrieves the best scores of an user, sorted by PP if mode is standard and sorted by ranked score otherwise.

func UserScoresPinnedGET

func UserScoresPinnedGET(md common.MethodData) common.CodeMessager

UserScoresPinnedGET retrieves an user's pinned scores.

func UserScoresRecentGET

func UserScoresRecentGET(md common.MethodData) common.CodeMessager

UserScoresRecentGET retrieves an user's latest scores.

func UserSelfGET

func UserSelfGET(md common.MethodData) common.CodeMessager

UserSelfGET is a shortcut for /users/id/self. (/users/self)

func UserSelfUserpagePOST

func UserSelfUserpagePOST(md common.MethodData) common.CodeMessager

UserSelfUserpagePOST allows to change the current user's userpage.

func UserUserpageGET

func UserUserpageGET(md common.MethodData) common.CodeMessager

UserUserpageGET gets an user's userpage, as in the customisable thing.

func UserWhatsTheIDGET

func UserWhatsTheIDGET(md common.MethodData) common.CodeMessager

UserWhatsTheIDGET is an API request that only returns an user's ID.

func UsersGET

func UsersGET(md common.MethodData) common.CodeMessager

UsersGET is the API handler for GET /users

func UsersSelfDonorInfoGET

func UsersSelfDonorInfoGET(md common.MethodData) common.CodeMessager

UsersSelfDonorInfoGET returns information about the users' donor status

func UsersSelfFavouriteModeGET

func UsersSelfFavouriteModeGET(md common.MethodData) common.CodeMessager

UsersSelfFavouriteModeGET gets the current user's favourite mode

func UsersSelfSettingsGET

func UsersSelfSettingsGET(md common.MethodData) common.CodeMessager

UsersSelfSettingsGET allows to get "sensitive" information about the current user.

func UsersSelfSettingsPOST

func UsersSelfSettingsPOST(md common.MethodData) common.CodeMessager

UsersSelfSettingsPOST allows to modify information about the current user.

Types

type Achievement

type Achievement struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
}

Achievement represents an achievement in the database.

type Clan

type Clan struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Tag         string `json:"tag"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
	Owner       int    `json:"owner"`
	Status      int    `json:"status"`
}

type Country

type Country struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

type GameBeatmap

type GameBeatmap struct {
	Id           int    `json:"id"`
	BeatmapsetId int    `json:"beatmapset_id"`
	Artist       string `json:"artist"`
	Title        string `json:"title"`
	Version      string `json:"version"`
}

type JsonList

type JsonList []int

func (*JsonList) Scan

func (jl *JsonList) Scan(val interface{}) error

func (*JsonList) Value

func (jl *JsonList) Value() (driver.Value, error)

type Match

type Match struct {
	Id        int        `json:"id"`
	Name      string     `json:"name"`
	StartTime time.Time  `json:"start_time"`
	EndTime   *time.Time `json:"end_time"`
}

type MatchEvent

type MatchEvent struct {
	Id        int        `json:"id"`
	Type      string     `json:"type"`
	Timestamp time.Time  `json:"timestamp"`
	User      *MatchUser `json:"user"`
	Game      *MatchGame `json:"game"`
}

type MatchGame

type MatchGame struct {
	Id          int          `json:"id"`
	Beatmap     GameBeatmap  `json:"beatmap"`
	Mode        int          `json:"mode"`
	Mods        *int         `json:"mods"`
	ScoringType int          `json:"scoring_type"`
	TeamType    int          `json:"team_type"`
	StartTime   time.Time    `json:"start_time"`
	EndTime     *time.Time   `json:"end_time"`
	Scores      []MatchScore `json:"scores"`
}

type MatchScore

type MatchScore struct {
	Id        int       `json:"id"`
	User      MatchUser `json:"user"`
	Score     int64     `json:"score"`
	MaxCombo  int       `json:"max_combo"`
	Mods      int       `json:"mods"`
	Mode      int       `json:"mode"`
	Count300  int       `json:"count_300"`
	Count100  int       `json:"count_100"`
	Count50   int       `json:"count_50"`
	CountGeki int       `json:"count_geki"`
	CountKatu int       `json:"count_katu"`
	CountMiss int       `json:"count_miss"`
	Timestamp time.Time `json:"timestamp"`
	Accuracy  float64   `json:"accuracy"`
	Passed    bool      `json:"passed"`
	Team      int       `json:"team"`
}

type MatchUser

type MatchUser struct {
	Id       int     `json:"id"`
	Username string  `json:"username"`
	Country  *string `json:"country"`
}

type MultiCount

type MultiCount struct {
	common.ResponseBase
	Countries []Country `json:"countries"`
}

type Score

type Score struct {
	ID         string               `json:"id,int64"`
	BeatmapMD5 string               `json:"beatmap_md5"`
	Score      int64                `json:"score"`
	MaxCombo   int                  `json:"max_combo"`
	FullCombo  bool                 `json:"full_combo"`
	Mods       int                  `json:"mods"`
	Count300   int                  `json:"count_300"`
	Count100   int                  `json:"count_100"`
	Count50    int                  `json:"count_50"`
	CountGeki  int                  `json:"count_geki"`
	CountKatu  int                  `json:"count_katu"`
	CountMiss  int                  `json:"count_miss"`
	Time       common.UnixTimestamp `json:"time"`
	PlayMode   int                  `json:"play_mode"`
	Accuracy   float64              `json:"accuracy"`
	PP         float32              `json:"pp"`
	Rank       string               `json:"rank"`
	Completed  int                  `json:"completed"`
	Pinned     bool                 `json:"pinned"`
	UserID     int                  `json:"user_id"`
}

Score is a score done on Ripple.

type SingleClanResponse

type SingleClanResponse struct {
	common.ResponseBase
	Clan `json:"clan"`
}

type TbadgeMembersData

type TbadgeMembersData struct {
	common.ResponseBase
	Members []userData `json:"members"`
}

type TmultiBadgeData

type TmultiBadgeData struct {
	common.ResponseBase
	Badges []TsingleBadge `json:"tbadges"`
}

type TsingleBadge

type TsingleBadge struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name"`
	Icon string `json:"icon"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL