diff --git a/docs/ref/rest_adapter.md b/docs/ref/rest_adapter.md index 034ddde..9c277ef 100644 --- a/docs/ref/rest_adapter.md +++ b/docs/ref/rest_adapter.md @@ -6,4 +6,4 @@ These functions are meant for use in other parts of the module. You *probably* s If there's a feature missing from the main [ZiplineApi](zipline.md) class, you should open an [issue](https://coastalcommits.com/SeaswimmerTheFsh/PyZipline/issues) (or a [pull request](https://coastalcommits.com/SeaswimmerTheFsh/PyZipline/pulls)). /// -::: pyzipline.rest_adapter.RestAdapter +::: pyzipline.rest_adapter diff --git a/docs/ref/zipline.md b/docs/ref/zipline.md index 1bf0616..db5d07c 100644 --- a/docs/ref/zipline.md +++ b/docs/ref/zipline.md @@ -1,3 +1,3 @@ # ZiplineApi -::: pyzipline.zipline.ZiplineApi +::: pyzipline.zipline diff --git a/mkdocs.yml b/mkdocs.yml index b08a760..b7175a3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -36,6 +36,7 @@ plugins: docstring_options: ignore_imit_summary: true summary: true + show_root_toc_entry: false filters: - "!^___" diff --git a/pyzipline/models.py b/pyzipline/models.py index 5b407dd..1ca436d 100644 --- a/pyzipline/models.py +++ b/pyzipline/models.py @@ -1,16 +1,16 @@ """This is a list of all the models used in PyZipline. They are used to represent the data returned from the Zipline API.""" -from typing import List, Dict, Union +from typing import List, Dict, Optional, Union from datetime import datetime class Embed: """Embed object used for checking embeds - Args: - color (str): String of the embed's color - title (str): String of the embed's title - siteName (str): String of the embed's site name - description (str): String of the embed's description + Attributes: + color (Optional[str]): String of the embed's color + title (Optional[str]): String of the embed's title + siteName (Optional[str]): String of the embed's site name + description (Optional[str]): String of the embed's description """ def __init__( self, @@ -30,7 +30,7 @@ class Embed: class File: """File object used for uploading files to Zipline - Args: + Attributes: createdAt (datetime.datetime): Datetime object of when the file was created id (int): ID of the file mimetype (str): String of the file's mimetype @@ -81,7 +81,7 @@ class File: class Result: """Result returned from low-level RestAdapter - Args: + Attributes: success (bool): Boolean of whether the request was successful status_code (int): Standard HTTP Status code message (str = ''): Human readable result @@ -97,7 +97,7 @@ class Result: class Invite: """Invite object used for managing invites - Args: + Attributes: id (int): Integer ID of the invite code (str): String of the invite's code createdAt (datetime): Datetime object of when the invite was created @@ -127,14 +127,14 @@ class Invite: class OAuth: """OAuth object used for managing OAuth - Args: + Attributes: id (int): Integer ID of the OAuth provider (str): String of the OAuth's provider, one of 'DISCORD', 'GITHUB', 'GOOGLE' userId (int): Integer ID of the user who owns the OAuth providerId (str): String of the OAuth's provider ID username (str): String of the OAuth's connected account's username token (str): String of the OAuth's access token - refresh (str): String of the OAuth's refresh token + refresh (Optional[str]): String of the OAuth's refresh token """ def __init__( self, @@ -144,7 +144,7 @@ class OAuth: providerId: str, username: str, token: str, - refresh: str, + refresh: Optional[str], **kwargs ): self.id = id @@ -160,36 +160,36 @@ class OAuth: class User: """User object used for managing users - Args: + Attributes: id (int): Integer ID of the user uuid (str): String of the user's UUID username (str): String of the user's username - avatar (str): String of the user's avatar, base64 encoded + avatar (Optional[str]): String of the user's avatar, base64 encoded token (str): String of the user's token administrator (bool): Boolean of whether the user is an administrator superAdmin (bool): Boolean of whether the user is a super administrator systemTheme (str): String of the user's system theme embed (Embed): Embed object of the user's embed - totpSecret (str): String of the user's TOTP secret + totpSecret (Optional[str]): String of the user's TOTP secret domains (List[str]): List of Strings of the user's domains - oauth (List[OAuth] = None): (optional) List of OAuth objects - ratelimit (datetime = None): (optional) Datetime object of when the user's ratelimit expires + oauth (Optional[List[OAuth]] = None): (optional) List of OAuth objects + ratelimit (Optional[datetime] = None): (optional) Datetime object of when the user's ratelimit expires """ def __init__( self, id: int, uuid: str, username: str, - avatar: str, + avatar: Optional[str], token: str, administrator: bool, superAdmin: bool, systemTheme: str, embed: Embed, - totpSecret: str, + totpSecret: Optional[str], domains: List[str], - oauth: Union[List['OAuth'], None] = None, - ratelimit: [datetime, None] = None, + oauth: Optional[List['OAuth']] = [], + ratelimit: Optional[datetime] = None, **kwargs ): self.id = id @@ -200,9 +200,12 @@ class User: self.administrator = administrator self.superAdmin = superAdmin self.systemTheme = systemTheme - self.embed = embed + self.embed = Embed(**embed) self.totpSecret = totpSecret self.domains = domains self.oauth = oauth self.ratelimit = ratelimit self.__dict__.update(kwargs) + for oauth_entry in self.oauth: + OAuth(**oauth_entry) + self.oauth.append(oauth_entry)