wfwiki

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wfwiki provides a client for the Warframe Fandom Wiki's module data.

Usage:

import "github.com/obowersa/wfwiki/pkg/modquery"

Construct a new WFWiki client, then use the services on the client to access different representations of the data

client := newWFWiki()

//Get formatted data for a weapon
res, _ := client.GetStats("weapon", "Reaper Prime")

Rate Limiting

MediaWiki/Fandom asks for a rate limit of 1 request per second. We achieve this by using the internal/handler library in this code base. By default a request is processed once per second, with a buffer of up to 10 requests.

TODO: Expose rate limiting errors to the client so they can be handled appropriately

Lua Tables

MediaWiki/Fandom's module/data pages are lua tables. When querying the API a JSON string is returned which holds the lua code. We parse this table through an embedded lua VM and convert it to JSON before unmarshalling the resulting []byte object into a struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WFWiki

type WFWiki struct {
	Wiki *mwmod.Wiki
}

WFWiki wraps the underlying Wiki client

func NewWFWiki

func NewWFWiki() WFWiki

NewWFWiki creates a new WFWIki struct with the underlying Wiki initialised with the default datasource handler

func (*WFWiki) GetStats

func (w *WFWiki) GetStats(mod string, query string) (string, error)

GetStats returns an opinionated set of results for a given module

Jump to

Keyboard shortcuts

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