From ecdc7f30739acf70c3cdbb11cea13cbd0b691a36 Mon Sep 17 00:00:00 2001 From: Andrei Date: Sat, 25 Feb 2017 14:25:51 -0800 Subject: [PATCH] Start working on cleaning up docs --- disco/api/client.py | 14 ++++++++------ disco/types/invite.py | 2 +- docs/api.rst | 22 ++++++++++++++++++++++ docs/conf.py | 11 +++++++++-- docs/theme/static/style.css | 13 +++++++++++++ docs/theme/theme.conf | 4 ++++ 6 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 docs/theme/static/style.css create mode 100644 docs/theme/theme.conf diff --git a/disco/api/client.py b/disco/api/client.py index c0f90ea..bf4f515 100644 --- a/disco/api/client.py +++ b/disco/api/client.py @@ -24,23 +24,25 @@ def optional(**kwargs): class APIClient(LoggingClass): """ - An abstraction over a :class:`disco.api.http.HTTPClient`, which composes - requests from provided data, and fits models with the returned data. The APIClient - is the only path to the API used within models/other interfaces, and it's - the recommended path for all third-party users/implementations. + An abstraction over Discord's HTTP REST API, which supports composing requests + from provided data, and fits returned data into discos types and models. + + The APIClient is built upon the :class:`disco.api.http.HTTPClient`, and is + the intended path for any HTTP REST requests. Most methods of this class are + abstracted further within the various models and datatypes disco supports. Args ---- token : str The Discord authentication token (without prefixes) to be used for all HTTP requests. - client : Optional[:class:`disco.client.Client`] + client : :class:`disco.client.Client`, optional The Disco client this APIClient is a member of. This is used when constructing and fitting models from response data. Attributes ---------- - client : Optional[:class:`disco.client.Client`] + client : :class:`disco.client.Client`, optional The Disco client this APIClient is a member of. http : :class:`disco.http.HTTPClient` The HTTPClient this APIClient uses for all requests. diff --git a/disco/types/invite.py b/disco/types/invite.py index 0cc4852..1ba61f1 100644 --- a/disco/types/invite.py +++ b/disco/types/invite.py @@ -1,4 +1,4 @@ -from disco.types.base import SlottedModel, Field, datetime +from disco.types.base import SlottedModel, Field, datetime from disco.types.user import User from disco.types.guild import Guild from disco.types.channel import Channel diff --git a/docs/api.rst b/docs/api.rst index c090248..677781d 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -109,6 +109,8 @@ Command Argument Parser Gateway API ----------- +The Gateway API is Discord's real-time websocket based API. Disco includes various functionality for creating and maintaining a persistant/real-time connection over this API. + GatewayClient ~~~~~~~~~~~~~ @@ -121,10 +123,26 @@ Gateway Events .. automodule:: disco.gateway.events :members: +Sharding +~~~~~~~~ + +Sharding allows users to improve the performance of their application, and support over 2,500 guilds per account. Disco has native support for sharding, which allows you to transparently communicate between running shards. + +.. autoclass:: disco.gateway.sharder.ShardHelper + :members: + +.. autoclass:: disco.gateway.sharder.AutoSharder + :members: + +.. autoclass:: disco.gateway.ipc.GIPCProxy + :members: + REST API -------- +Disco includes a module which handles all interactions with Discord's HTTP-based REST API. This module has support for various required functions of the API, such as ratelimit headers/backoff, error handling, and type conversions. + APIClient ~~~~~~~~~ @@ -132,6 +150,10 @@ APIClient :members: :undoc-members: +.. autoclass:: disco.api.client.Routes + :members: + :undoc-members: + HTTP Utilities ~~~~~~~~~~~~~~ .. autoclass:: disco.api.http.APIException diff --git a/docs/conf.py b/docs/conf.py index 4af5f21..a83a05c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,7 +33,9 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.viewcode', - 'sphinx.ext.napoleon' + 'sphinx.ext.napoleon', + 'sphinx.ext.autosummary', + 'numpydoc' ] # Add any paths that contain templates here, relative to this directory. @@ -124,7 +126,9 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +# html_theme = 'sphinx_rtd_theme' +html_theme = 'theme' +html_theme_path = ['.'] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -341,3 +345,6 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. # # texinfo_no_detailmenu = False + +numpydoc_show_class_members = False +numpydoc_show_inherited_class_members = False diff --git a/docs/theme/static/style.css b/docs/theme/static/style.css new file mode 100644 index 0000000..77fd0e3 --- /dev/null +++ b/docs/theme/static/style.css @@ -0,0 +1,13 @@ +@import url("css/theme.css"); /* make sure to sync this with the base theme's css filename */ + +.body { + color: #2C2F33; +} + +.wy-side-nav-search { + background-color: #7289DA; +} + +.wy-nav-content { + max-width: 1200px; +} diff --git a/docs/theme/theme.conf b/docs/theme/theme.conf new file mode 100644 index 0000000..8513d19 --- /dev/null +++ b/docs/theme/theme.conf @@ -0,0 +1,4 @@ +[theme] +inherit = sphinx_rtd_theme +stylesheet = style.css +pygments_style = pygments.css