Change GET and SET to CamelCase

This commit is contained in:
Marc Di Luzio 2020-06-10 17:27:55 +01:00
parent 14c4e61660
commit 62d6213c1a
2 changed files with 10 additions and 10 deletions

View file

@ -11,7 +11,7 @@ import (
// Status queries the status of the server // Status queries the status of the server
func (s Server) Status() (r StatusResponse, err error) { func (s Server) Status() (r StatusResponse, err error) {
s.GET("status", &r) s.Get("status", &r)
return return
} }
@ -29,7 +29,7 @@ type StatusResponse struct {
// Register registers a user by name // Register registers a user by name
// Responds with a unique ID for that user to be used in future requests // Responds with a unique ID for that user to be used in future requests
func (s Server) Register(d RegisterData) (r RegisterResponse, err error) { func (s Server) Register(d RegisterData) (r RegisterResponse, err error) {
err = s.POST("register", d, &r) err = s.Post("register", d, &r)
return return
} }
@ -52,7 +52,7 @@ type RegisterResponse struct {
// Spawn spawns the rover for an account // Spawn spawns the rover for an account
// Responds with the position of said rover // Responds with the position of said rover
func (s Server) Spawn(account string, d SpawnData) (r SpawnResponse, err error) { func (s Server) Spawn(account string, d SpawnData) (r SpawnResponse, err error) {
err = s.POST(path.Join(account, "spawn"), d, &r) err = s.Post(path.Join(account, "spawn"), d, &r)
return return
} }
@ -75,7 +75,7 @@ type SpawnResponse struct {
// Command issues a set of commands from the user // Command issues a set of commands from the user
func (s Server) Command(account string, d CommandData) (r CommandResponse, err error) { func (s Server) Command(account string, d CommandData) (r CommandResponse, err error) {
err = s.POST(path.Join(account, "command"), d, &r) err = s.Post(path.Join(account, "command"), d, &r)
return return
} }
@ -95,7 +95,7 @@ type CommandResponse struct {
// Radar queries the current radar for the user // Radar queries the current radar for the user
func (s Server) Radar(account string) (r RadarResponse, err error) { func (s Server) Radar(account string) (r RadarResponse, err error) {
err = s.GET(path.Join(account, "radar"), &r) err = s.Get(path.Join(account, "radar"), &r)
return return
} }
@ -114,7 +114,7 @@ type RadarResponse struct {
// Rover queries the current state of the rover // Rover queries the current state of the rover
func (s Server) Rover(account string) (r RoverResponse, err error) { func (s Server) Rover(account string) (r RoverResponse, err error) {
err = s.GET(path.Join(account, "rover"), &r) err = s.Get(path.Join(account, "rover"), &r)
return return
} }

View file

@ -11,8 +11,8 @@ import (
// Server is a simple wrapper to a server path // Server is a simple wrapper to a server path
type Server string type Server string
// GET performs a GET request // Get performs a Get request
func (s Server) GET(path string, out interface{}) error { func (s Server) Get(path string, out interface{}) error {
u := url.URL{ u := url.URL{
Scheme: "http", Scheme: "http",
Host: string(s), Host: string(s),
@ -29,8 +29,8 @@ func (s Server) GET(path string, out interface{}) error {
} }
} }
// POST performs a POST request // Post performs a Post request
func (s Server) POST(path string, in, out interface{}) error { func (s Server) Post(path string, in, out interface{}) error {
u := url.URL{ u := url.URL{
Scheme: "http", Scheme: "http",
Host: string(s), Host: string(s),