deck

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeckAPI added in v1.2.0

type DeckAPI struct {
	// contains filtered or unexported fields
}

DeckAPI A representation of the deck namespace for the MTGJSON API

func New added in v1.1.1

func New(baseUrl string, client *client.HTTPClient) *DeckAPI

New Create a new instance of the DeckAPI struct

func (*DeckAPI) AddCards added in v1.2.0

func (api *DeckAPI) AddCards(code string, cards *deckModel.DeckContentIds, owner string) (*apiModels.APIResponse, error)

AddCards Update the content ids in the deck model passed with new cards. This should probably validate cards in the future

func (*DeckAPI) BaseURL added in v1.2.0

func (api *DeckAPI) BaseURL() string

BaseURL - Returns the baseUrl with its associating endpoint attached to it, used for making HTTP requests

func (*DeckAPI) Client added in v1.2.0

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

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

func (*DeckAPI) DeleteDeck added in v1.2.0

func (api *DeckAPI) DeleteDeck(code string, owner string) (*apiModels.APIResponse, error)

DeleteDeck Remove a deck from the MongoDB database using the code passed in the parameter. Returns ErrNoDeck if the deck does not exist. Returns ErrDeckDeleteFailed if the deleted count does not equal 1

func (*DeckAPI) GetDeck added in v1.2.0

func (api *DeckAPI) GetDeck(code string, owner string) (*deckModel.Deck, error)

GetDeck Fetch a deck from the MongoDB database using the code passed in the parameter. Owner is the email address of the user that you want to assign to the deck. If the string is empty then it does not filter by user. Returns ErrNoDeck if the deck does not exist or cannot be located

func (*DeckAPI) GetDeckContents added in v1.2.0

func (api *DeckAPI) GetDeckContents(code string, owner string) (*deckModel.DeckContents, error)

GetDeckContents Update the 'contents' field of the deck passed in the parameter. This accepts a pointer and updates this in place to avoid having to copy large amounts of data

func (*DeckAPI) NewDeck added in v1.2.0

func (api *DeckAPI) NewDeck(deck *deckModel.Deck, owner string) (*apiModels.APIResponse, error)

NewDeck Insert a new deck in the form of a model into the MongoDB database. The deck model must have a valid name and deck code, additionally the deck cannot already exist under the same deck code. Owner is the email address of the owner you want to assign the deck to. If the string is empty, it will be assigned to the system user

func (*DeckAPI) RemoveCards added in v1.2.0

func (api *DeckAPI) RemoveCards(code string, cards *deckModel.DeckContentIds, owner string) (*apiModels.APIResponse, error)

Jump to

Keyboard shortcuts

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