Documentation
¶
Overview ¶
Package rbxweb provides API routines to interact with Roblox's web API.
Index ¶
- Variables
- type Client
- func (c *Client) BareDo(req *http.Request) (*http.Response, error)
- func (c *Client) Do(req *http.Request, v any) (*http.Response, error)
- func (c *Client) Execute(method, service, path string, body any, v any) error
- func (c *Client) NewRequest(method, service, path string, body any) (*http.Request, error)
- type ErrorResponse
- type ErrorsResponse
- type Services
- type StatusError
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadStatus = errors.New("bad status") ErrNoData = errors.New("no data") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { http.Client BaseDomain string Security string Token string Services // contains filtered or unexported fields }
Client embeds an http.Client, used to make Roblox API requests.
BaseDomain is the URL domain used to execute calls to, in case an alternative domain is given.
func (*Client) BareDo ¶
BareDo will execute the given HTTP request, leaving the response body to be read by the user. If any error occurs, the respose body will be closed. If a API error response is available, it will be returned as ErrorsResponse or string for undocumented APIs, otherwise, a StatusError will be returned.
If Roblox set a ROBLOSECURITY cookie or a X-CSRF-TOKEN header, it will always be used in future requests.
func (*Client) Do ¶
Do will perform the given HTTP request on the client, and will write the response body as necessary to v, if non-nil. In any case, the response will always be returned as it is with a resulting error, if any. The response body of the HTTP request is always going to be closed.
func (*Client) Execute ¶
Executes creates a new Request with NewRequest and the given parameters and immediately executes it with Do, which unmarshals the response body to v, if any.
func (*Client) NewRequest ¶
NewRequest returns a new http.Request, with a path that will be relative to the BaseDomain of the client, and a service - which can be empty, to indicate the microservice to use. If body is specified, it will be interepreted as JSON encoded and will be added to the request body.
type ErrorResponse ¶
type ErrorResponse struct { Code int `json:"code"` Message string `json:"message"` Field string `json:"field,omitempty"` }
ErrorResponse implements the error response model of the API.
func (ErrorResponse) Error ¶
func (err ErrorResponse) Error() string
Error implements the error interface.
type ErrorsResponse ¶
type ErrorsResponse struct {
Errors []ErrorResponse `json:"errors,omitempty"`
}
errorsResponse implements the errors response model of the API.
func (ErrorsResponse) Error ¶
func (errs ErrorsResponse) Error() string
Error implemements the error interface.
func (ErrorsResponse) Unwrap ¶
func (errs ErrorsResponse) Unwrap() error
Unwrap implements the Unwrap interface by returning the first error in the list.
type Services ¶
type Services struct { ThumbnailsV1 *thumbnails.ThumbnailsServiceV1 UsersV1 *users.UsersServiceV1 AuthTokenV1 *token.AuthTokenServiceV1 AuthV1 *auth.AuthServiceV1 ClientSettingsV1 *clientsettings.ClientSettingsServiceV1 GamesV1 *games.GamesServiceV1 LegacyV1 *legacy.LegacyServiceV1 }
Services is the list of implemented Roblox Web APIs
type StatusError ¶
type StatusError struct {
StatusCode int
}
StatusError represents an unexpected HTTP error, in the case that a ErrorResponse was unable to be parsed.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
services
|
|
auth
clientsettings selectively implements the 'auth' Roblox Web API.
|
clientsettings selectively implements the 'auth' Roblox Web API. |
clientsettings
clientsettings selectively implements the 'clientsettings' Roblox Web API.
|
clientsettings selectively implements the 'clientsettings' Roblox Web API. |
games
games selectively implements the 'games' Roblox Web API.
|
games selectively implements the 'games' Roblox Web API. |
legacy
package legacy selectively implements undocumented legacy Roblox Web APIs
|
package legacy selectively implements undocumented legacy Roblox Web APIs |
thumbnails
thumbnails selectively implements the 'thumbnails' Roblox Web API.
|
thumbnails selectively implements the 'thumbnails' Roblox Web API. |
token
token partially implements the undocumented auth-token-service API.
|
token partially implements the undocumented auth-token-service API. |
universes
Package universes implements types for interfacing with Roblox Universes.
|
Package universes implements types for interfacing with Roblox Universes. |
users
clientsettings selectively implements the 'users' Roblox Web API.
|
clientsettings selectively implements the 'users' Roblox Web API. |