API Reference
UpgradeChat
- class upgradechat.UpgradeChat(client_id: str, client_secret: str, session: Optional[aiohttp.client.ClientSession] = None)
A wrapper around the UpgradeChat v1 API.
- __init__(client_id: str, client_secret: str, session: Optional[aiohttp.client.ClientSession] = None)
- async get_access_token() str
Get an access token from their Oauth endpoint.
- Returns
The aquired access token.
- Return type
- async get_orders(limit: int = 100, offset: int = 0, discord_id: Optional[int] = None, type: Optional[Union[upgradechat.models.UpgradeChatItemType, str]] = None) List[upgradechat.models.UpgradeChatOrder]
Get a list of order objects that adhere to the request parameters given.
- Parameters
- Returns
A list of purchases that the user has made.
- Return type
- Raises
UpgradeChatError – If the Upgrade.Chat API is down for any reason.
UpgradeChatOrder
- class upgradechat.UpgradeChatOrder(uuid: str, purchased_at: datetime.datetime, user: upgradechat.models.UpgradeChatUser, subtotal: float, discount: float, total: float, type: upgradechat.models.UpgradeChatItemType, is_subscription: bool, cancelled_at: datetime.datetime, order_items: List[upgradechat.models.UpgradeChatOrderItem], deleted: Optional[datetime.datetime] = None, payment_processor: Optional[upgradechat.models.UpgradeChatPaymentProcessor] = None, payment_processor_record_id: Optional[str] = None, coupon_code: Optional[str] = None, coupon: Optional[upgradechat.models.UpgradeChatCoupon] = None, **kwargs)
An order object from the UpgradeChat API.
- purchased_at
A timestamp of when the order was placed.
- Type
- user
The user who placed the order.
- Type
- coupon_code
The coupon code that was used with the order, if any.
- Type
string
- type
The type of item that was ordered.
- Type
- cancelled_at
The time when the order was cancelled
- Type
- order_items
A list of items that were included in the order.
- Type
- deleted
When the order was deleted.
- Type
datetime.datetime, optional
- payment_processor
The payment processor for the order.
- Type
UpgradeChatPaymentProcessor, optional
- classmethod from_api(data)
Makes an instance of the object using a response from the API.
UpgradeChatUser
UpgradeChatCouponType
UpgradeChatCouponDuration
UpgradeChatCoupon
UpgradeChatOrderItem
- class upgradechat.UpgradeChatOrderItem(price: float, quantity: int, interval: upgradechat.models.UpgradeChatInterval, interval_count: int, free_trial_length: int, is_time_limited: bool, product: dict, discord_roles: List[dict], product_types: List[upgradechat.models.UpgradeChatProductType], payment_processor: upgradechat.models.UpgradeChatPaymentProcessor, payment_processor_record_id: str, product_uuid: Optional[str] = None, **kwargs)
An order item from the UpgradeChat API.
- interval
The interval that the item is billed at.
- Type
- product_types
A list of product types that this order item is.
- Type
- payment_processor
The payment processor used to purchase this item.
- payment_processor_record_id
The record ID that the payment processor used for this purchase.
- Type
- classmethod from_api(data)
Makes an instance of the object using a response from the API.
UpgradeChatInterval
UpgradeChatProduct
- class upgradechat.UpgradeChatProduct(uuid: str, checkout_uri: str, name: str, account_id: int, price: float, interval: upgradechat.models.UpgradeChatInterval, interval_count: int, free_trial_length: int, description: str, image_link: str, variable_price: bool, is_time_limited: bool, limited_inventory: bool, available_stock: int, shippable: bool, paymentless_trial: bool, product_types: List[upgradechat.models.UpgradeChatProductType], created: datetime.datetime, updated: datetime.datetime, deleted: Optional[datetime.datetime] = None, **kwargs)
A product from the UpgradeChat API.
- interval
How often the product is billed at.
- Type
- product_types
The types attached to this product.
- Type
- created
When this product was created.
- Type
- updated
When this product was updated.
- Type
- deleted
When this product was deleted.
- Type
datetime.datetime, optional
- classmethod from_api(data)
Makes an instance of the object using a response from the API.
UpgradeChatItemType
UpgradeChatPaymentProcessor
UpgradeChatProductType
UpgradeChatError
- class upgradechat.UpgradeChatError