Rename quite a few methods

This commit is contained in:
Howl 2016-11-21 17:04:27 +01:00
parent 700170392a
commit 8dc5af9406
3 changed files with 8 additions and 6 deletions

View File

@ -90,7 +90,7 @@ func Start(conf common.Conf, dbO *sqlx.DB) *gin.Engine {
{ {
gv1.POST("/tokens", Method(v1.TokenNewPOST)) gv1.POST("/tokens", Method(v1.TokenNewPOST))
gv1.POST("/tokens/new", Method(v1.TokenNewPOST)) gv1.POST("/tokens/new", Method(v1.TokenNewPOST))
gv1.POST("/tokens/self/delete", Method(v1.TokenSelfDeleteGET)) gv1.POST("/tokens/self/delete", Method(v1.TokenSelfDeletePOST))
// Auth-free API endpoints (public data) // Auth-free API endpoints (public data)
gv1.GET("/ping", Method(v1.PingGET)) gv1.GET("/ping", Method(v1.PingGET))
@ -147,7 +147,7 @@ func Start(conf common.Conf, dbO *sqlx.DB) *gin.Engine {
gv1.GET("/meta/update", Method(v1.MetaUpdateGET, common.PrivilegeAPIMeta)) gv1.GET("/meta/update", Method(v1.MetaUpdateGET, common.PrivilegeAPIMeta))
// User Managing + meta // User Managing + meta
gv1.GET("/tokens/fix_privileges", Method(v1.TokenFixPrivilegesGET, gv1.POST("/tokens/fix_privileges", Method(v1.TokenFixPrivilegesPOST,
common.PrivilegeManageUser, common.PrivilegeAPIMeta)) common.PrivilegeManageUser, common.PrivilegeAPIMeta))
// in the new osu-web, the old endpoints are also in /v1 it seems. So /shrug // in the new osu-web, the old endpoints are also in /v1 it seems. So /shrug

View File

@ -1,5 +1,7 @@
// +build !windows // +build !windows
// TODO: Make all these methods POST
package v1 package v1
import ( import (

View File

@ -131,8 +131,8 @@ func TokenNewPOST(md common.MethodData) common.CodeMessager {
return r return r
} }
// TokenSelfDeleteGET deletes the token the user is connecting with. // TokenSelfDeletePOST deletes the token the user is connecting with.
func TokenSelfDeleteGET(md common.MethodData) common.CodeMessager { func TokenSelfDeletePOST(md common.MethodData) common.CodeMessager {
if md.ID() == 0 { if md.ID() == 0 {
return common.SimpleResponse(400, "How should we delete your token if you haven't even given us one?!") return common.SimpleResponse(400, "How should we delete your token if you haven't even given us one?!")
} }
@ -199,9 +199,9 @@ func TokenSelfGET(md common.MethodData) common.CodeMessager {
return r return r
} }
// TokenFixPrivilegesGET fixes the privileges on the token of the given user, // TokenFixPrivilegesPOST fixes the privileges on the token of the given user,
// or of all the users if no user is given. // or of all the users if no user is given.
func TokenFixPrivilegesGET(md common.MethodData) common.CodeMessager { func TokenFixPrivilegesPOST(md common.MethodData) common.CodeMessager {
id := common.Int(md.Query("id")) id := common.Int(md.Query("id"))
if md.Query("id") == "self" { if md.Query("id") == "self" {
id = md.ID() id = md.ID()