Documentation ¶
Overview ¶
The rbxfetch package retrieves information about Roblox builds.
Index ¶
- func NewFilterFile(params iofl.Params, r io.ReadCloser) (f iofl.Filter, err error)
- func NewFilterIconScan(params iofl.Params, r io.ReadCloser) (f iofl.Filter, err error)
- func NewFilterURL(params iofl.Params, r io.ReadCloser) (f iofl.Filter, err error)
- func NewFilterZip(params iofl.Params, r io.ReadCloser) (f iofl.Filter, err error)
- type Build
- type CacheMode
- type Client
- func (client *Client) APIDump(guid string) (rc io.ReadCloser, err error)
- func (client *Client) Builds() (builds []Build, err error)
- func (client *Client) ClassImages(guid string) (rc io.ReadCloser, err error)
- func (client *Client) Config() Config
- func (client *Client) Latest() (guid string, err error)
- func (client *Client) Live() (guids []string, err error)
- func (client *Client) Method(method, guid string) (rc io.ReadCloser, err error)
- func (client *Client) ReflectionMetadata(guid string) (rc io.ReadCloser, err error)
- func (client *Client) SetConfig(config Config) error
- type Config
- type FilterFile
- type FilterIconScan
- type FilterURL
- type FilterZip
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFilterFile ¶
NewFilterFile is an iofl.NewFilter that returns a FilterFile.
func NewFilterIconScan ¶
NewFilterIconScan is an iofl.NewFilter that returns a FilterIconScan.
func NewFilterURL ¶
NewFilterURL is an iofl.NewFilter that returns a FilterURL.
func NewFilterZip ¶
NewFilterZip is an iofl.NewFilter that returns a FilterZip.
Types ¶
type Build ¶
Build represents information about a single Roblox build.
func (*Build) UnmarshalJSON ¶
type CacheMode ¶
type CacheMode int
CacheMode specifies how data is cached between calls.
const ( // Data is never cached. CacheNone CacheMode = iota // Data is cached in the temporary directory. CacheTemp // Data is cached in the user cache directory. If unavailable, the // temporary directory is used instead. CachePerm // Data is cached to a custom directory specified by CacheLocation. CacheCustom )
type Client ¶
type Client struct { // CacheMode specifies how to cache files. CacheMode CacheMode // CacheLocation specifies the path to store cached files, when CacheMode // is CacheCustom. CacheLocation string // Client is the HTTP client that performs requests. Client *http.Client // contains filtered or unexported fields }
Client is used to perform the fetching of information. It controls where data is retrieved from, and how the data is cached.
func NewClient ¶
func NewClient() *Client
NewClient returns a client with a default configuration and temporary caching. The Client is initialized with the following filters:
- url: FilterURL
- file: FilterFile
- zip: FilterZip
- iconscan: FilterIconScan
Using these filters, the following chains are specified:
- Latest: Fetches the GUID of the latest build.
- Live: Fetches the GUID of the latest live 32-bit Studio build.
- Live64: Fetches the GUID of the latest live 64-bit Studio build.
- Builds: Fetches a list of builds.
- APIDump: Fetches the API dump of a given GUID.
- ReflectionMetadata: Fetches the reflection metadata of a given GUID.
- ClassImages: Fetches the class icons of a given GUID.
- ExplorerIcons: Fetches the class icons of a given GUID, scanned from the Studio executable.
Finally, the following methods are specified:
- Builds: Builds
- Latest: Latest
- APIDump: APIDump
- ReflectionMetadata: ReflectionMetadata
- ClassImages: ClassImages, ExplorerIcons
- Live: Live64, Live
func (*Client) APIDump ¶
func (client *Client) APIDump(guid string) (rc io.ReadCloser, err error)
APIDump returns the API dump of the given GUID. Returns nil if no "APIDump" method is configured.
func (*Client) Builds ¶
Builds returns a list of available builds. Returns nil if no "Builds" method is configured.
The content of a chain is expected to be a histlog stream.
func (*Client) ClassImages ¶
func (client *Client) ClassImages(guid string) (rc io.ReadCloser, err error)
ClassImages returns the class explorer icons for the given GUID. Returns nil if no "ClassImages" method is configured.
func (*Client) Latest ¶
Latest returns the GUID of the latest build, which can be passed to other methods to fetch data corresponding to the latest version. Latest uses the result of the first chain that does not error. Returns an empty string if no "Latest" method is configured.
The content of a chain is expected to be a raw GUID.
func (*Client) Live ¶
Live returns the GUIDs of the current live builds, which can be passed to other methods to fetch data corresponding to current live versions. Live visits every configured chain, returning a list of GUIDs, or the first error that occurs. Returns an empty slice if no "Live" method is configured.
The content of a chain is expected to be a JSON string containing the GUID.
func (*Client) Method ¶ added in v0.4.0
func (client *Client) Method(method, guid string) (rc io.ReadCloser, err error)
Method runs the configured method for the given GUID. Returns nil if no such method is configured.
func (*Client) ReflectionMetadata ¶
func (client *Client) ReflectionMetadata(guid string) (rc io.ReadCloser, err error)
ReflectionMetadata returns the reflection metadata for the given GUID. Returns nil if no "ReflectionMetadata" method is configured.
type Config ¶
type Config struct { // Methods specifies the list of chains to be used consecutively for each // client method. The result of each chain in the list may be used, or the // result of the first chain that doesn't error. Methods map[string][]string iofl.Config }
Config is used to configure a Client.
type FilterFile ¶
FilterFile is an iofl.Filter that fetches from a file.
func (*FilterFile) Close ¶
func (f *FilterFile) Close() error
func (*FilterFile) SetGUID ¶
func (f *FilterFile) SetGUID(guid string)
func (*FilterFile) Source ¶
func (f *FilterFile) Source() io.ReadCloser
type FilterIconScan ¶
type FilterIconScan struct { Size int // contains filtered or unexported fields }
FilterIconScan is an iofl.Filter that scans for an icon sheet image from the source.
Because the source may contain multiple images, the following heuristic is used: the format of the image is PNG, the height of the image is Size, the width is a multiple of Size, and is the first widest such image.
func (*FilterIconScan) Close ¶
func (f *FilterIconScan) Close() error
func (*FilterIconScan) Source ¶
func (f *FilterIconScan) Source() io.ReadCloser
type FilterURL ¶
type FilterURL struct { URL string GUID string Client *http.Client CacheMode CacheMode CacheLocation string // contains filtered or unexported fields }
FilterURL is an iofl.Filter that fetches from a URL.
func (*FilterURL) Source ¶
func (f *FilterURL) Source() io.ReadCloser