Documentation
¶
Index ¶
- Constants
- Variables
- type ClientRequest
- func (r ClientRequest) Auth(token string) ClientRequest
- func (r ClientRequest) Delete(path string) ClientRequest
- func (r ClientRequest) Do() (*ClientResponse, error)
- func (r ClientRequest) Get(path string) ClientRequest
- func (r ClientRequest) Head(path string) ClientRequest
- func (r ClientRequest) Header(key string, value string) ClientRequest
- func (r ClientRequest) Json(json any) ClientRequest
- func (r ClientRequest) Method(method string) ClientRequest
- func (r ClientRequest) Patch(path string) ClientRequest
- func (r ClientRequest) Path(path string) ClientRequest
- func (r ClientRequest) Post(path string) ClientRequest
- func (r ClientRequest) Put(path string) ClientRequest
- type ClientResponse
Constants ¶
View Source
const ( APIUrl = "https://spider.infinitybots.gg" StagingAPIUrl = "https://spider-staging.infinitybots.gg" )
Variables ¶
View Source
var ClientURL = APIUrl
Functions ¶
This section is empty.
Types ¶
type ClientRequest ¶
type ClientRequest struct {
// contains filtered or unexported fields
}
A request to the API
func (ClientRequest) Auth ¶
func (r ClientRequest) Auth(token string) ClientRequest
Sets the authorization header
func (ClientRequest) Delete ¶
func (r ClientRequest) Delete(path string) ClientRequest
Sets the method to DELETE
func (ClientRequest) Get ¶
func (r ClientRequest) Get(path string) ClientRequest
Sets the method to GET
func (ClientRequest) Head ¶
func (r ClientRequest) Head(path string) ClientRequest
Sets the method to HEAD
func (ClientRequest) Header ¶
func (r ClientRequest) Header(key string, value string) ClientRequest
Sets a header
func (ClientRequest) Json ¶
func (r ClientRequest) Json(json any) ClientRequest
Sets the body of the request
func (ClientRequest) Method ¶
func (r ClientRequest) Method(method string) ClientRequest
Sets the method of the request
func (ClientRequest) Patch ¶
func (r ClientRequest) Patch(path string) ClientRequest
Sets the method to PATCH
func (ClientRequest) Path ¶
func (r ClientRequest) Path(path string) ClientRequest
Sets the path of the request
func (ClientRequest) Post ¶
func (r ClientRequest) Post(path string) ClientRequest
Sets the method to POST
func (ClientRequest) Put ¶
func (r ClientRequest) Put(path string) ClientRequest
Sets the method to PUT
type ClientResponse ¶
A response from the API
func (ClientResponse) Body ¶
func (c ClientResponse) Body() ([]byte, error)
Returns the response body
func (ClientResponse) BodyOk ¶
func (c ClientResponse) BodyOk() ([]byte, error)
Returns the response body if the response is OK otherwise returns error
func (ClientResponse) IsMaint ¶
func (c ClientResponse) IsMaint() bool
Returns true if the response is a maintenance response (502, 503, 408)
func (ClientResponse) Json ¶
func (c ClientResponse) Json(v any) error
Unmarshals the response body into the given struct
func (ClientResponse) JsonOk ¶
func (c ClientResponse) JsonOk(v any) error
Unmarshals response body if response is OK otherwise returns error
func (ClientResponse) RetryAfter ¶
func (c ClientResponse) RetryAfter() string
Returns the retry after header. Is a string
Click to show internal directories.
Click to hide internal directories.