Documentation
¶
Index ¶
- type SetAPI
- func (api *SetAPI) AddCards(code string, cards []string, owner string) (*apiModels.APIResponse, error)
- func (api *SetAPI) BaseURL() string
- func (api *SetAPI) Client() *client.HTTPClient
- func (api *SetAPI) DeleteSet(code string, owner string) (*apiModels.APIResponse, error)
- func (api *SetAPI) GetSet(code string, owner string) (*setModel.Set, error)
- func (api *SetAPI) GetSetContents(code string, owner string) (*[]*cardModel.CardSet, error)
- func (api *SetAPI) IndexSets(limit int) (*[]*setModel.Set, error)
- func (api *SetAPI) NewSet(set *setModel.Set, owner string) (*apiModels.APIResponse, error)
- func (api *SetAPI) RemoveCards(code string, cards []string, owner string) (*apiModels.APIResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SetAPI ¶ added in v1.2.0
type SetAPI struct {
// contains filtered or unexported fields
}
SetAPI A representation of the set namespace for the MTGJSON API
func New ¶
func New(baseUrl string, client *client.HTTPClient) *SetAPI
New Create a new instance of the SetAPI struct
func (*SetAPI) AddCards ¶ added in v1.2.0
func (api *SetAPI) AddCards(code string, cards []string, owner string) (*apiModels.APIResponse, error)
AddCards Add an instance of a card to a set
func (*SetAPI) BaseURL ¶ added in v1.2.0
BaseURL - Returns the baseUrl with its associating endpoint attached to it, used for making HTTP requests
func (*SetAPI) Client ¶ added in v1.2.0
func (api *SetAPI) Client() *client.HTTPClient
Client - Returns a pointer to the client.HTTPClient structure that is used for HTTP requests
func (*SetAPI) DeleteSet ¶ added in v1.2.0
DeleteSet Remove a set from the MongoDB database using the code passed in the parameter. Returns ErrNoSet if the set does not exist. Returns ErrSetDeleteFailed if the deleted count does not equal 1
func (*SetAPI) GetSet ¶ added in v1.2.0
GetSet Takes a single string representing a set code and returns a set model for the set. Returns ErrNoSet if the set does not exist, or cannot be located
func (*SetAPI) GetSetContents ¶ added in v1.2.0
GetSetContents Return a list of CardSet models representing the contents of a specific set
func (*SetAPI) IndexSets ¶ added in v1.2.0
IndexSets Returns all sets 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 (*SetAPI) NewSet ¶ added in v1.2.0
NewSet Insert a new set in the form of a model into the MongoDB database. The set model must have a valid name and set code, additionally the set cannot already exist under the same set code. Owner is the email address of the owner you want to assign the deck to. If the string is empty (i.e. == ""), it will be assigned to the system user
func (*SetAPI) RemoveCards ¶ added in v1.2.0
func (api *SetAPI) RemoveCards(code string, cards []string, owner string) (*apiModels.APIResponse, error)
RemoveCards Remove all instances of a card in a set