csaw package¶
Submodules¶
csaw.authtoken module¶
- class csaw.authtoken.AuthToken(token)¶
Bases:
requests.auth.AuthBase
Class that handles authentications for http request.
csaw.csaw module¶
- class csaw.csaw.CSAW(token)¶
Bases:
object
CraftingStore.net API wrapper.
- create_giftcard(amount=15, packages=None, categories=None, applyTo=0)¶
Creates a giftcard.
- Parameters
amount – The amount of money on the giftcard.
packages – list of int ids of the CraftingStore packages that you want the giftcard to work with.
categories – list of int ids of the CraftingStore catagories that you want the giftcard to work with.
applyTo – 1 = applies to catagories, 2 = applies to packages, 0 = Whole Store. Defaults to 0.
- Returns
Returns a
csaw.giftcard.Giftcard
object that represents the giftcard.- Return type
- property get_communitygoals¶
Fetches the active community goals. (CraftingStore only supports active community goals.)
- Parameters
page – The desired page number. CraftingStore only allows you to access per page, 15 results on each page.
- Return type
list
- Returns
Returns a list of community goals.
- get_giftcard(card_id)¶
Returns a
csaw.giftcard.GiftCard
object representing a giftcard, that corresponds to a specific giftcard id.- Parameters
card_id – Id of the giftcard.
- Returns
returns a
csaw.giftcard.Giftcard
that represents a- Return type
- Raise
ValueError: The authentication token is invalid.
- property get_giftcards¶
Fetches payments by page.
- Parameters
page – The desired page number. CraftingStore only allows you to access per page, 15 results on each page.
json – bool. If enabled, it will create a json dict of the giftcards, if false will create a list of
csaw.giftcard.Giftcard
objects.
- Return type
list
- Returns
Returns a list of payment dictionaries as a result.
- property get_information¶
Returns a dictionary containing general information.
- Returns
- property get_payments¶
Fetches payments by page.
- Parameters
page – The desired page number. CraftingStore only allows you to access per page, 15 results on each page.
- Returns
Returns a list of payment dictionaries as a result.
- Return type
list
csaw.giftcard module¶
- class csaw.giftcard.Giftcard(auth, data)¶
Bases:
object
Class that represents a giftcard. Allows for easy accessing of a giftcard, and easy updating both locally and via the REST api.
- add_funds(increment: int)¶
Adds more money to the giftcard.
- Parameters
increment – The amount of money to add.
- Return type
- Returns
returns the
csaw.giftcard.Giftcard
object that was just updated with new funds.
- property amount¶
Fetches the giftcard’s initial amount of money. (The total that was on the card before any spending occurred.)
- Return type
int
- Returns
returns an int that corresponds with the giftcard’s initial amount.
- property amountRemaining¶
Fetches the giftcard’s remaining amount of money. (The total amount remaining on the card.)
- Return type
int
- Returns
returns an int that corresponds with the giftcards initial amount.
- property code¶
Fetches the giftcard’s redemption code.
- Return type
str
- Returns
returns a str that represents the redemption code for the giftcard.
- delete()¶
Deletes the
csaw.giftcard.Giftcard
and sends a delete request to CraftingStore.- Returns
- property id¶
Fetches the giftcard’s ID
- Return type
int
- Returns
returns an int that corresponds with the giftcard’s id.
- remove_funds(decrement: int)¶
Identical to
csaw.giftcard.Giftcard.add_funds()
, remove an amount of money from a giftcard.- Parameters
decrement – The amount of money to remove.
- Return type
- Returns
returns the
csaw.giftcard.Giftcard
object that was just updated with the new funds.