From 48523895e94471c6e947b5faa5313e7bf14f7a83 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 21 Dec 2023 15:34:04 -0500 Subject: [PATCH] docs: changing some stuff around --- pyzipline/models.py | 75 +++++++++++++++++++++++--------------------- pyzipline/zipline.py | 11 ++++++- 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/pyzipline/models.py b/pyzipline/models.py index e4d81c6..2ea1870 100644 --- a/pyzipline/models.py +++ b/pyzipline/models.py @@ -7,19 +7,19 @@ class File: """File object used for uploading files to Zipline Attributes: - createdAt (datetime.datetime): Datetime object of when the file was created + created_at (datetime.datetime): Datetime object of when the file was created id (int): ID of the file mimetype (str): String of the file's mimetype views (int): Integer of the number of views the file has name (str): String of the file's name size (int): Integer of the file's size in bytes favorite (bool): Boolean of whether the file is favorited - originalName (Optional[str]): String of the file's original name + original_name (Optional[str]): String of the file's original name url (Optional[str]): String of the file's URL - maxViews (Optional[int]): Integer of the file's maximum number of views - expiredAt (Optional[datetime]): Datetime object of when the file will expire + max_views (Optional[int]): Integer of the file's maximum number of views + expired_at (Optional[datetime]): Datetime object of when the file will expire thumbnail (Optional[str]): String of the file's thumbnail URL - folderId (Optional[int]): Integer of the file's folder ID + folder_id (Optional[int]): Integer of the file's folder ID """ def __init__( self, @@ -38,19 +38,19 @@ class File: folderId: int = None, **kwargs ): - self.createdAt = createdAt + self.created_at = createdAt self.id = id self.mimetype = mimetype self.views = views self.name = name self.size = size self.favorite = favorite - self.originalName = originalName + self.original_name = originalName self.url = url - self.maxViews = maxViews - self.expiredAt = expiredAt + self.max_views = maxViews + self.expired_at = expiredAt self.thumbnail = thumbnail - self.folderId = folderId + self.folder_id = folderId self.__dict__.update(kwargs) def __str__(self): @@ -82,10 +82,10 @@ class Invite: 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 - expiredAt (datetime): Datetime object of when the invite will expire + created_at (datetime): Datetime object of when the invite was created + expired_at (datetime): Datetime object of when the invite will expire used (bool): Boolean of whether the invite has been used - createdById (int): Integer ID of the user who created the invite + created_by_id (int): Integer ID of the user who created the invite """ def __init__( self, @@ -99,10 +99,10 @@ class Invite: ): self.id = id self.code = code - self.createdAt = createdAt - self.expiredAt = expiredAt + self.created_at = createdAt + self.expired_at = expiredAt self.used = used - self.createdById = createdById + self.created_by_id = createdById self.__dict__.update(kwargs) def __str__(self): @@ -199,8 +199,8 @@ class OAuth: 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 - oauthId (str): String of the OAuth's provider ID + user_id (int): Integer ID of the user who owns the OAuth + oauth_id (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 (Optional[str]): String of the OAuth's refresh token @@ -218,8 +218,8 @@ class OAuth: ): self.id = id self.provider = provider - self.oauthId = oauthId - self.providerId = providerId + self.oauth_id = oauthId + self.provider_id = providerId self.username = username self.token = token self.refresh = refresh @@ -230,7 +230,12 @@ class OAuth: class User: - """User object used for managing users + """Object containing user information + + /// admonition | Contains Sensitive Information + type: danger + Please be mindful of how you use/store this object, as it contains sensitive information such as the user's token and OAuth/TOTP information. + /// Attributes: id (int): Integer ID of the user @@ -239,10 +244,10 @@ class User: 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 + super_admin (bool): Boolean of whether the user is a super administrator + system_theme (str): String of the user's system theme embed (Embed): Embed object of the user's embed - totpSecret (Optional[str]): String of the user's TOTP secret + totp_secret (Optional[str]): String of the user's TOTP secret domains (List[str]): List of Strings of the user's domains oauth (Optional[List[OAuth]]): List of [OAuth](.#pyzipline.models.OAuth) objects ratelimit (Optional[datetime]): Datetime object of when the user's ratelimit expires @@ -270,10 +275,10 @@ class User: self.avatar = avatar self.token = token self.administrator = administrator - self.superAdmin = superAdmin - self.systemTheme = systemTheme + self.super_admin = superAdmin + self.system_theme = systemTheme self.embed = self.Embed(**embed) - self.totpSecret = totpSecret + self.totp_secret = totpSecret self.domains = domains self.oauth = oauth self.ratelimit = ratelimit @@ -288,12 +293,12 @@ class User: return self.username class Embed: - """Embed object used for checking embeds + """Object containing a user's embed settings 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 + site_name (Optional[str]): String of the embed's site name description (Optional[str]): String of the embed's description """ def __init__( @@ -306,7 +311,7 @@ class User: ): self.color = color self.title = title - self.siteName = siteName + self.site_name = siteName self.description = description self.__dict__.update(kwargs) @@ -316,11 +321,11 @@ class User: return self.title class Version: - """Version object containing the current, stable, and upstream versions of Zipline + """Object containing the current, stable, and upstream versions of Zipline Attributes: - isUpstream (bool): Boolean of whether the current version is upstream - updateToType (str): String of the type of update available, one of 'stable' or 'upstream' + is_upstream (bool): Boolean of whether the current version is upstream (`trunk` branch) + update_to_type (str): String of the type of update available, one of 'stable' or 'upstream' stable (str): String of the stable version upstream (str): String of the upstream version current (str): String of the current version @@ -331,8 +336,8 @@ class Version: updateToType: str, versions: {dict} ): - self.isUpstream = isUpstream - self.updateToType = updateToType + self.is_upstream = isUpstream + self.update_to_type = updateToType self._versions = versions self.stable = self._versions['stable'] self.upstream = self._versions['upstream'] diff --git a/pyzipline/zipline.py b/pyzipline/zipline.py index 12ae460..d20d79e 100644 --- a/pyzipline/zipline.py +++ b/pyzipline/zipline.py @@ -31,6 +31,15 @@ class ZiplineApi: def register_user(self, username: str, password: str, invite: str = None, admin: bool = False) -> User: """Register a new user + /// admonition | Requires Authentication + type: warning + /// + + /// admonition | Conditionally Requires Administrator + type: danger + The authenticated user must be an Administrator to use the `admin` parameter or register a user when registration is disabled. + /// + Args: username (str): Username to register password (str): Password for the new user @@ -79,7 +88,7 @@ class ZiplineApi: Args: username (str): Username to check - invite (str = None): Invite code to use, only required if registration without invites is disabled + invite (str): Invite code to use, only required if registration without invites is disabled Raises: FeatureDisabledError: Raised when registration or invites are disabled on the Zipline instance