api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: Unlicense Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MtgjsonAPI added in v1.2.0

type MtgjsonAPI struct {

	// Card - A pointer to the CardAPI namespace, used for making HTTP requests to the /card endpoint
	Card *card.CardAPI

	// Deck - A pointer to the DeckAPI namespace, used for making HTTP requests to the /deck endpoint
	Deck *deck.DeckAPI

	// Set - A pointer to the SetAPI namespace, used for making HTTP requests to the /set endpoint
	Set *set.SetAPI

	// Auth - A pointer to the AuthAPI namespace, used for making HTTP requests to the /login and /register endpoints
	Auth *auth.AuthAPI

	// User - A pointer to the UserAPI namespace, used for making HTTP requests to the /user endpoint
	User *user.UserAPI
	// contains filtered or unexported fields
}

MtgjsonAPI - A representation of the MTGJSON API and all of its routes

func FromConfig added in v1.2.0

func FromConfig() *MtgjsonAPI

FromConfig - Construct a new MtgjsonAPI structure using viper config values

func New

func New(hostname string, port int, useSSL bool) *MtgjsonAPI

New - Construct a new MtgjsonAPI structure using a hostname and port. If useSSL is set to true then the protocol will be switched to HTTPS

func (*MtgjsonAPI) Client added in v1.2.0

func (api *MtgjsonAPI) Client() *client.HTTPClient

Client - Returns a pointer to the client.HTTPClient structure that is used for HTTP requests

func (*MtgjsonAPI) SetEmailPasswordAuth added in v1.2.0

func (api *MtgjsonAPI) SetEmailPasswordAuth(email string, password string) error

SetEmailPasswordAuth - Fetches a token for the client.HTTPClient to use in authenticated requests

type Namespace added in v1.2.0

type Namespace interface {
	// Client - A function that returns a pointer to the HTTP client used for the namespace
	Client() *client.HTTPClient

	// BaseURL - A function that returns the base URL used in HTTP requests
	BaseURL() string
}

Namespace - An interface that all API namespaces (Card, Deck, User, etc.) implement

Jump to

Keyboard shortcuts

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