From 708869ea93e3b3cd402e6b5c07b33168ab13ed66 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 3 Jul 2019 17:18:54 +0200 Subject: [PATCH] Include missing models in auto-generated API docs --- docs/api.rst | 83 ++++++++++++++++++++++++++++++++++++---------- docs/conf.py | 2 ++ fbchat/_client.py | 6 ++-- fbchat/_message.py | 10 +++--- 4 files changed, 75 insertions(+), 26 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 244e596..ba29e44 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -2,32 +2,79 @@ .. highlight:: python .. _api: +.. Note: we're using () to hide the __init__ method where relevant + Full API ======== If you are looking for information on a specific function, class, or method, this part of the documentation is for you. - -.. _api_client: - Client ------ -This is the main class of `fbchat`, which contains all the methods you use to interact with Facebook. -You can extend this class, and overwrite the events, to provide custom event handling (mainly used while listening) +.. autoclass:: Client -.. autoclass:: Client(email, password, user_agent=None, max_tries=5, session_cookies=None, logging_level=logging.INFO) - :members: +Threads +------- - -.. _api_models: - -Models ------- - -These models are used in various functions, both as inputs and return values. -A good tip is to write ``from fbchat.models import *`` at the start of your source, so you can use these models freely - -.. automodule:: fbchat.models - :members: +.. autoclass:: Thread() +.. autoclass:: ThreadType(Enum) + :undoc-members: +.. autoclass:: Page() +.. autoclass:: User() +.. autoclass:: Group() + +Messages +-------- + +.. autoclass:: Message +.. autoclass:: Mention +.. autoclass:: EmojiSize(Enum) + :undoc-members: +.. autoclass:: MessageReaction(Enum) + :undoc-members: + +Exceptions +---------- + +.. autoexception:: FBchatException() +.. autoexception:: FBchatFacebookError() +.. autoexception:: FBchatUserError() + +Attachments +----------- + +.. autoclass:: Attachment() +.. autoclass:: ShareAttachment() +.. autoclass:: Sticker() +.. autoclass:: LocationAttachment() +.. autoclass:: LiveLocationAttachment() +.. autoclass:: FileAttachment() +.. autoclass:: AudioAttachment() +.. autoclass:: ImageAttachment() +.. autoclass:: VideoAttachment() +.. autoclass:: ImageAttachment() + +Miscellaneous +------------- + +.. autoclass:: ThreadLocation(Enum) + :undoc-members: +.. autoclass:: ThreadColor(Enum) + :undoc-members: +.. autoclass:: ActiveStatus() +.. autoclass:: TypingStatus(Enum) + :undoc-members: + +.. autoclass:: QuickReply +.. autoclass:: QuickReplyText +.. autoclass:: QuickReplyLocation +.. autoclass:: QuickReplyPhoneNumber +.. autoclass:: QuickReplyEmail + +.. autoclass:: Poll +.. autoclass:: PollOption + +.. autoclass:: Plan +.. autoclass:: GuestStatus(Enum) :undoc-members: diff --git a/docs/conf.py b/docs/conf.py index 759bb0b..98c908a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -155,6 +155,8 @@ epub_exclude_files = ["search.html"] # -- Options for autodoc extension --------------------------------------- autoclass_content = "both" +autodoc_member_order = "bysource" +autodoc_default_options = {"members": True} # -- Options for intersphinx extension --------------------------------------- diff --git a/fbchat/_client.py b/fbchat/_client.py index ed671d0..31db216 100644 --- a/fbchat/_client.py +++ b/fbchat/_client.py @@ -31,7 +31,9 @@ ACONTEXT = { class Client(object): """A client for the Facebook Chat (Messenger). - See https://fbchat.readthedocs.io for complete documentation of the API. + This is the main class of `fbchat`, which contains all the methods you use to + interact with Facebook. You can extend this class, and overwrite the ``on`` methods, + to provide custom event handling (mainly useful while listening). """ listening = False @@ -64,7 +66,7 @@ class Client(object): session_cookies=None, logging_level=logging.INFO, ): - """Initializes and logs in the client + """Initialize and log in the client. :param email: Facebook `email`, `id` or `phone number` :param password: Facebook account password diff --git a/fbchat/_message.py b/fbchat/_message.py index ebc8a0d..3a67cbf 100644 --- a/fbchat/_message.py +++ b/fbchat/_message.py @@ -99,13 +99,11 @@ class Message(object): Returns a `Message` object, with the formatted string and relevant mentions. - ``` - >>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) - , ] emoji_size=None attachments=[]> + >>> Message.formatMentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) + , ] emoji_size=None attachments=[]> - >>> Message.formatMentions("Hey {p}! My name is {}", ("1234", "Michael"), p=("4321", "Peter")) - , ] emoji_size=None attachments=[]> - ``` + >>> Message.formatMentions("Hey {p}! My name is {}", ("1234", "Michael"), p=("4321", "Peter")) + , ] emoji_size=None attachments=[]> """ result = "" mentions = list()