rbxweb

package module
v0.0.0-...-379ef8e Latest Latest
Warning

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

Go to latest
Published: May 31, 2016 License: GPL-3.0 Imports: 8 Imported by: 6

README

GoDoc

rbxweb

rbxweb is a Go package that provides access to many of Roblox's web-based services.

Documentation

Overview

The rbxweb package provides an interface to many of ROBLOX's web-based services.

Index

Constants

This section is empty.

Variables

View Source
var ErrLoggedIn = errors.New("client is already logged in")

Functions

This section is empty.

Types

type Client

type Client struct {
	http.Client
	BaseDomain string
}

Client embeds a http.Client, and is used with every function that makes a request.

BaseDomain is the URL domain to which all requests will be sent. Subdomains are handled automatically as a part of API requests. Alternative domains, such as gametest, follow a scheme that makes switching domains easier:

BaseDomain:                  With subdomain:
roblox.com               --> www.roblox.com
gametest.robloxlabs.com  --> www.gametest.robloxlabs.com

func NewClient

func NewClient() *Client

func (*Client) AssertResp

func (client *Client) AssertResp(resp *http.Response, err error) error

AssertResp checks whether a HTTP response errored. Also errors if the response has a non-2XX status code.

func (*Client) DoRawPost

func (client *Client) DoRawPost(page string, params url.Values) (err error)

DoRawPost is a lower-level function that allows the user to perform a context-based HTML form POST for a given webpage. On Roblox, many older types of requests require a validation token, which is sent along with the page when viewing it. Many requests are also context-based. That is, manipulation of an item requires knowledge of how the item is displayed on the page.

When DoRawPost is called, a GET request is first sent to the page, then the validation tokens are parsed from the response and added as POST parameters automatically.

The values in `params` are used as the parameters for the POST request. If a value is empty, then the value is retrieved from the original GET response body, in the same way as the validation tokens. Values are retrieved by matching the key with the name attribute of any input tags found in the GET response body.

`page` must be a full URL, including query values, if required.

Whether the client needs to be logged in varies depending on the request.

func (*Client) GetSecureURL

func (client *Client) GetSecureURL(subdomain string, path string, query url.Values) (url string)

GetSecureURL is similar to GetURL, but it uses HTTPS instead of HTTP.

func (*Client) GetURL

func (client *Client) GetURL(subdomain string, path string, query url.Values) (url string)

GetURL constructs a URL using BaseDomain and the given arguments, with HTTP as the protocol.

If `subdomain` is not empty, then it is added as the subdomain before the base domain. `path` is the part of the URL that appears after the base domain. If `query` is not nil, then it is encoded into query parameters and added to the end of the URL.

func (*Client) Login

func (client *Client) Login(username string, password string) (err error)

Login logs the client into a user account on the website. This is neccessary for many API functions to properly execute.

func (*Client) Logout

func (client *Client) Logout() (err error)

Logout logs the client of out of the current user account.

Directories

Path Synopsis
Deals with services related to ROBLOX assets.
Deals with services related to ROBLOX assets.
Deals with services related to the ROBLOX catalog.
Deals with services related to the ROBLOX catalog.
Deals with services related to ROBLOX currency.
Deals with services related to ROBLOX currency.
Deals with services related to ROBLOX groups.
Deals with services related to ROBLOX groups.
Deals with services related to ROBLOX sets.
Deals with services related to ROBLOX sets.
Deals with services related to users.
Deals with services related to users.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL