card

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 CardAPI added in v1.2.0

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

CardAPI A representation of the card namespace for the MTGJSON API

func New added in v1.1.1

func New(baseURL string, client *client.HTTPClient) *CardAPI

New Create a new instance of the CardAPI struct

func (*CardAPI) BaseURL added in v1.2.0

func (api *CardAPI) BaseURL() string

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

func (*CardAPI) Client added in v1.2.0

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

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

func (*CardAPI) DeleteCard added in v1.2.0

func (api *CardAPI) DeleteCard(uuid string, owner string) (*apiModels.APIResponse, error)

DeleteCard Remove a card from the MongoDB database. The UUID passed in the parameter must be a valid MTGJSONv4 ID. ErrNoCard will be returned if no card exists under the passed UUID, and ErrCardDeleteFailed will be returned if the deleted count does not equal 1

func (*CardAPI) GetCard added in v1.2.0

func (api *CardAPI) GetCard(uuid string, owner string) (*cardModel.CardSet, error)

GetCard Takes a single string representing an MTGJSONv4 UUID and return a card model for it

func (*CardAPI) IndexCards added in v1.2.0

func (api *CardAPI) IndexCards() (*[]*cardModel.CardSet, error)

IndexCards Returns all cards in the database unmarshalled as card models. The limit parameter will be passed directly to the database query to limit the number of models returned

func (*CardAPI) NewCard added in v1.2.0

func (api *CardAPI) NewCard(card *cardModel.CardSet, owner string) (*apiModels.APIResponse, error)

NewCard Insert a new card in the form of a model into the MongoDB database. The card model must have a valid name and MTGJSONv4 ID, additionally, the card cannot already exist under the same ID

Jump to

Keyboard shortcuts

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