v1

package
v0.0.0-...-ed857cc Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: AGPL-3.0 Imports: 33 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
)
View Source
const SapUserQuery = `` /* 523-byte string literal not displayed */
View Source
const SlbUserQuery = `` /* 502-byte string literal not displayed */
View Source
const SrxUserQuery = `` /* 523-byte string literal not displayed */

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 BeatmapRankRequestsStatusGET

func BeatmapRankRequestsStatusGET(md common.MethodData) common.CodeMessager

BeatmapRankRequestsStatusGET gets the current status for beatmap ranking requests.

func BeatmapRankRequestsSubmitPOST

func BeatmapRankRequestsSubmitPOST(md common.MethodData) common.CodeMessager

BeatmapRankRequestsSubmitPOST submits a new beatmap for ranking approval.

func BeatmapRankedFrozenFullGET

func BeatmapRankedFrozenFullGET(md common.MethodData) common.CodeMessager

BeatmapRankedFrozenFullGET retrieves all beatmaps with a certain ranked_status_freezed

func BeatmapSetStatusPOST

func BeatmapSetStatusPOST(md common.MethodData) common.CodeMessager

BeatmapSetStatusPOST changes the ranked status of a beatmap, and whether the beatmap ranked status is frozen. Or freezed. Freezed best meme 2k16

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 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 ErrMissingField

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

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

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 MetaRestartGET

func MetaRestartGET(md common.MethodData) common.CodeMessager

MetaRestartGET restarts the API with Zero Downtime™.

func MetaUpSinceGET

func MetaUpSinceGET(md common.MethodData) common.CodeMessager

MetaUpSinceGET retrieves the moment the API application was started. Mainly used to get if the API was restarted.

func MetaUpdateGET

func MetaUpdateGET(md common.MethodData) common.CodeMessager

MetaUpdateGET updates the API to the latest version, and restarts it.

func PingGET

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

func RAPLogPOST

func RAPLogPOST(md common.MethodData) common.CodeMessager

RAPLogPOST creates a new entry in the RAP logs

func ResolveInviteGET

func ResolveInviteGET(md common.MethodData) common.CodeMessager

func SLeaderboardGET

func SLeaderboardGET(md common.MethodData) common.CodeMessager

LeaderboardGET gets the leaderboard.

func S_position

func S_position(r *redis.Client, key string, user int) *int

func SapcountryPosition

func SapcountryPosition(r *redis.Client, mode string, user int, country string) *int

func SautoboardPosition

func SautoboardPosition(r *redis.Client, mode string, user int) *int

func ScoreGET

func ScoreGET(md common.MethodData) common.CodeMessager

func ScoreReportPOST

func ScoreReportPOST(md common.MethodData) common.CodeMessager

ScoreReportPOST creates a new report for a score

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 ScountryPosition

func ScountryPosition(r *redis.Client, mode string, user int, country string) *int

func SleaderboardPosition

func SleaderboardPosition(r *redis.Client, mode string, user int) *int

func SrelaxboardPosition

func SrelaxboardPosition(r *redis.Client, mode string, user int) *int

func SrxcountryPosition

func SrxcountryPosition(r *redis.Client, mode string, user int, country string) *int

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 TokenFixPrivilegesPOST

func TokenFixPrivilegesPOST(md common.MethodData) common.CodeMessager

TokenFixPrivilegesPOST fixes the privileges on the token of the given user, or of all the users if no user is given.

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 UserEditPOST

func UserEditPOST(md common.MethodData) common.CodeMessager

UserEditPOST allows to edit an user's information.

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 UserLookupGET

func UserLookupGET(md common.MethodData) common.CodeMessager

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

func UserManageSetAllowedPOST

func UserManageSetAllowedPOST(md common.MethodData) common.CodeMessager

UserManageSetAllowedPOST allows to set the allowed status of an user.

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 UserUnweightedPerformanceGET

func UserUnweightedPerformanceGET(md common.MethodData) common.CodeMessager

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.

func WipeUserPOST

func WipeUserPOST(md common.MethodData) common.CodeMessager

WipeUserPOST wipes an user's scores.

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"`
}

Score is a score done on Ripple.

type SingleClanResponse

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

type SleaderboardResponse

type SleaderboardResponse struct {
	common.ResponseBase
	Users []SleaderboardUser `json:"users"`
}

type SleaderboardUser

type SleaderboardUser struct {
	ChosenMode    modeData `json:"chosen_mode"`
	PlayStyle     int      `json:"play_style"`
	FavouriteMode int      `json:"favourite_mode"`
	// contains filtered or unexported fields
}

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