docs: changing some stuff around
Some checks failed
Pylint / Pylint (3.12) (push) Failing after 37s

This commit is contained in:
Seaswimmer 2023-12-21 15:34:04 -05:00
parent b6893d5077
commit 48523895e9
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE
2 changed files with 50 additions and 36 deletions

View file

@ -7,19 +7,19 @@ class File:
"""File object used for uploading files to Zipline """File object used for uploading files to Zipline
Attributes: 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 id (int): ID of the file
mimetype (str): String of the file's mimetype mimetype (str): String of the file's mimetype
views (int): Integer of the number of views the file has views (int): Integer of the number of views the file has
name (str): String of the file's name name (str): String of the file's name
size (int): Integer of the file's size in bytes size (int): Integer of the file's size in bytes
favorite (bool): Boolean of whether the file is favorited 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 url (Optional[str]): String of the file's URL
maxViews (Optional[int]): Integer of the file's maximum number of views max_views (Optional[int]): Integer of the file's maximum number of views
expiredAt (Optional[datetime]): Datetime object of when the file will expire expired_at (Optional[datetime]): Datetime object of when the file will expire
thumbnail (Optional[str]): String of the file's thumbnail URL 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__( def __init__(
self, self,
@ -38,19 +38,19 @@ class File:
folderId: int = None, folderId: int = None,
**kwargs **kwargs
): ):
self.createdAt = createdAt self.created_at = createdAt
self.id = id self.id = id
self.mimetype = mimetype self.mimetype = mimetype
self.views = views self.views = views
self.name = name self.name = name
self.size = size self.size = size
self.favorite = favorite self.favorite = favorite
self.originalName = originalName self.original_name = originalName
self.url = url self.url = url
self.maxViews = maxViews self.max_views = maxViews
self.expiredAt = expiredAt self.expired_at = expiredAt
self.thumbnail = thumbnail self.thumbnail = thumbnail
self.folderId = folderId self.folder_id = folderId
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
def __str__(self): def __str__(self):
@ -82,10 +82,10 @@ class Invite:
Attributes: Attributes:
id (int): Integer ID of the invite id (int): Integer ID of the invite
code (str): String of the invite's code code (str): String of the invite's code
createdAt (datetime): Datetime object of when the invite was created created_at (datetime): Datetime object of when the invite was created
expiredAt (datetime): Datetime object of when the invite will expire expired_at (datetime): Datetime object of when the invite will expire
used (bool): Boolean of whether the invite has been used 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__( def __init__(
self, self,
@ -99,10 +99,10 @@ class Invite:
): ):
self.id = id self.id = id
self.code = code self.code = code
self.createdAt = createdAt self.created_at = createdAt
self.expiredAt = expiredAt self.expired_at = expiredAt
self.used = used self.used = used
self.createdById = createdById self.created_by_id = createdById
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
def __str__(self): def __str__(self):
@ -199,8 +199,8 @@ class OAuth:
Attributes: Attributes:
id (int): Integer ID of the OAuth id (int): Integer ID of the OAuth
provider (str): String of the OAuth's provider, one of 'DISCORD', 'GITHUB', 'GOOGLE' provider (str): String of the OAuth's provider, one of 'DISCORD', 'GITHUB', 'GOOGLE'
userId (int): Integer ID of the user who owns the OAuth user_id (int): Integer ID of the user who owns the OAuth
oauthId (str): String of the OAuth's provider ID oauth_id (str): String of the OAuth's provider ID
username (str): String of the OAuth's connected account's username username (str): String of the OAuth's connected account's username
token (str): String of the OAuth's access token token (str): String of the OAuth's access token
refresh (Optional[str]): String of the OAuth's refresh token refresh (Optional[str]): String of the OAuth's refresh token
@ -218,8 +218,8 @@ class OAuth:
): ):
self.id = id self.id = id
self.provider = provider self.provider = provider
self.oauthId = oauthId self.oauth_id = oauthId
self.providerId = providerId self.provider_id = providerId
self.username = username self.username = username
self.token = token self.token = token
self.refresh = refresh self.refresh = refresh
@ -230,7 +230,12 @@ class OAuth:
class User: 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: Attributes:
id (int): Integer ID of the user id (int): Integer ID of the user
@ -239,10 +244,10 @@ class User:
avatar (Optional[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 token (str): String of the user's token
administrator (bool): Boolean of whether the user is an administrator administrator (bool): Boolean of whether the user is an administrator
superAdmin (bool): Boolean of whether the user is a super administrator super_admin (bool): Boolean of whether the user is a super administrator
systemTheme (str): String of the user's system theme system_theme (str): String of the user's system theme
embed (Embed): Embed object of the user's embed 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 domains (List[str]): List of Strings of the user's domains
oauth (Optional[List[OAuth]]): List of [OAuth](.#pyzipline.models.OAuth) objects oauth (Optional[List[OAuth]]): List of [OAuth](.#pyzipline.models.OAuth) objects
ratelimit (Optional[datetime]): Datetime object of when the user's ratelimit expires ratelimit (Optional[datetime]): Datetime object of when the user's ratelimit expires
@ -270,10 +275,10 @@ class User:
self.avatar = avatar self.avatar = avatar
self.token = token self.token = token
self.administrator = administrator self.administrator = administrator
self.superAdmin = superAdmin self.super_admin = superAdmin
self.systemTheme = systemTheme self.system_theme = systemTheme
self.embed = self.Embed(**embed) self.embed = self.Embed(**embed)
self.totpSecret = totpSecret self.totp_secret = totpSecret
self.domains = domains self.domains = domains
self.oauth = oauth self.oauth = oauth
self.ratelimit = ratelimit self.ratelimit = ratelimit
@ -288,12 +293,12 @@ class User:
return self.username return self.username
class Embed: class Embed:
"""Embed object used for checking embeds """Object containing a user's embed settings
Attributes: Attributes:
color (Optional[str]): String of the embed's color color (Optional[str]): String of the embed's color
title (Optional[str]): String of the embed's title 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 description (Optional[str]): String of the embed's description
""" """
def __init__( def __init__(
@ -306,7 +311,7 @@ class User:
): ):
self.color = color self.color = color
self.title = title self.title = title
self.siteName = siteName self.site_name = siteName
self.description = description self.description = description
self.__dict__.update(kwargs) self.__dict__.update(kwargs)
@ -316,11 +321,11 @@ class User:
return self.title return self.title
class Version: class Version:
"""Version object containing the current, stable, and upstream versions of Zipline """Object containing the current, stable, and upstream versions of Zipline
Attributes: Attributes:
isUpstream (bool): Boolean of whether the current version is upstream is_upstream (bool): Boolean of whether the current version is upstream (`trunk` branch)
updateToType (str): String of the type of update available, one of 'stable' or 'upstream' update_to_type (str): String of the type of update available, one of 'stable' or 'upstream'
stable (str): String of the stable version stable (str): String of the stable version
upstream (str): String of the upstream version upstream (str): String of the upstream version
current (str): String of the current version current (str): String of the current version
@ -331,8 +336,8 @@ class Version:
updateToType: str, updateToType: str,
versions: {dict} versions: {dict}
): ):
self.isUpstream = isUpstream self.is_upstream = isUpstream
self.updateToType = updateToType self.update_to_type = updateToType
self._versions = versions self._versions = versions
self.stable = self._versions['stable'] self.stable = self._versions['stable']
self.upstream = self._versions['upstream'] self.upstream = self._versions['upstream']

View file

@ -31,6 +31,15 @@ class ZiplineApi:
def register_user(self, username: str, password: str, invite: str = None, admin: bool = False) -> User: def register_user(self, username: str, password: str, invite: str = None, admin: bool = False) -> User:
"""Register a new 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: Args:
username (str): Username to register username (str): Username to register
password (str): Password for the new user password (str): Password for the new user
@ -79,7 +88,7 @@ class ZiplineApi:
Args: Args:
username (str): Username to check 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: Raises:
FeatureDisabledError: Raised when registration or invites are disabled on the Zipline instance FeatureDisabledError: Raised when registration or invites are disabled on the Zipline instance