tukui

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 5 Imported by: 2

README

Go Report Card License CI Status Test Coverage

Golang Client for tukui.org

Simple Golang client for the TukUI API to fetch the hosted addons. Supports both classic and retail addons.

Install

go get github.com/unly/go-tukui

How to Use

Create a new client for the TukUI API. Optionally, you can pass a pointer to a http.Client. Otherwise the default client is used.

client := tukui.NewClient(nil)

Query for a specific addon using its ID, e.g. 3.

addon, resp, err := client.ClassicAddons.GetAddon(3)

Or query all available addons.

addons, resp, err := client.ClassicAddons.GetAddons()

For the TukUI and the ElvUI there are dedicated functions. In the case of TukUI there is;

tukui, resp, err := client.ClassicAddons.GetTukUI()

and respectively:

elvui, resp, err := client.ClassicAddons.GetElvUI()

All API queries return the Addon struct.

License

Licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addon

type Addon struct {
	// ID number of addon
	Id *string `json:"id,omitempty"`
	// the title of addon
	Name *string `json:"name,omitempty"`
	// a condensed description of addon for small area
	SmallDesc *string `json:"small_desc,omitempty"`
	// the author username
	Author *string `json:"author,omitempty"`
	// latest version of the addon uploaded on our network
	Version *string `json:"version,omitempty"`
	// a screenshot url of the addon
	ScreenshotUrl *string `json:"screenshot_url,omitempty"`
	// URL to download the .zip file
	URL *string `json:"url,omitempty"`
	// the main category where the addon is located
	Category *string `json:"category,omitempty"`
	// the total number of downloads of this addon
	Downloads *string `json:"downloads,omitempty"`
	// the last time the addon was updated
	LastUpdate *string `json:"lastupdate,omitempty"`
	// which World of Warcraft patch this addon is compatible with
	Patch *string `json:"patch,omitempty"`
	// url of the addon if an user want to visit his official download web page on our website
	WebUrl *string `json:"web_url,omitempty"`
	// when the addon was downloaded for the last time
	LastDownload *string `json:"last_download,omitempty"`
	// a donate url if the addon author accept donations
	DonateUrl *string `json:"donate_url,omitempty"`
}

An Addon is the basic return of the HTTP call. It contains the fields specified by the API. Pointers to strings can be nil.

type AddonClient

type AddonClient interface {
	// GetAddon returns the Addon for the given ID. The ID is a positive number.
	// For non existing IDs the function will return an error.
	GetAddon(id int) (Addon, *http.Response, error)
	// GetAddons returns a slice of all Addons available.
	GetAddons() ([]Addon, *http.Response, error)
	// GetTukUI returns the Addon for the main TukUI
	GetTukUI() (Addon, *http.Response, error)
	// GetElvUI returns the Addon for the main ElvUI
	GetElvUI() (Addon, *http.Response, error)
}

AddonClient is a set of functions that can be queried from the TukUI.org API

type Client

type Client struct {
	RetailAddons  AddonClient
	ClassicAddons AddonClient
	// contains filtered or unexported fields
}

The Client is a simple http client to access the TukUI.org API. Addons can be accessed either by the RetailAddons or ClassicAddons field.

func NewClient

func NewClient(client *http.Client) *Client

NewClient creates a new Client struct and returns a pointer to it. Optionnaly you can pass a pointer to a http.Client to be used. Alternatively, http.DefaultClient is used.

Jump to

Keyboard shortcuts

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