Skip to content

Commit 8acc325

Browse files
doc: Add comprehensive documentation for API client usage
This commit includes new documentation files covering usage examples for DRF, Async, and Sync clients, as well as configuration for Sphinx and ReadTheDocs. It enhances usability by detailing use-case scenarios and integrates module-level references in the documentation.
1 parent 4cf4226 commit 8acc325

27 files changed

+1532
-34
lines changed

.readthedocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
4+
sphinx:
5+
configuration: docs/source/conf.py
6+
7+
build:
8+
os: "ubuntu-22.04"
9+
tools:
10+
python: "3.10"
11+
12+
python:
13+
install:
14+
- method: pip
15+
path: .
16+
- requirements: requirements.txt

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import sys
2+
import os
3+
import django
4+
5+
6+
sys.path.insert(0, os.path.abspath('../../'))
7+
print(sys.path)
8+
# Set the environment variable for Django settings to the new settings file
9+
os.environ['DJANGO_SETTINGS_MODULE'] = 'monobank_api_client.drf_mono.sphinx_settings'
10+
11+
# Initialize Django
12+
django.setup()
13+
# -- General configuration ---------------------------------------------------
14+
extensions = [
15+
'sphinx.ext.autodoc',
16+
'sphinx.ext.napoleon',
17+
'sphinx.ext.viewcode',
18+
]
19+
project = 'Python-monobank-api-client Library'
20+
copyright = '2024, Onix-Systems'
21+
author = 'Onix-Systems'
22+
release = '1.0'
23+
24+
templates_path = ['_templates']
25+
26+
exclude_patterns = []
27+
28+
# -- Options for HTML output -------------------------------------------------
29+
30+
html_theme = 'sphinx_rtd_theme'
31+
html_static_path = ['_static']
32+
html_theme_options = {
33+
"collapse_navigation": False, # Keeps the menu expanded
34+
"navigation_depth": 4, # Adjust the depth of navigation in the sidebar
35+
"titles_only": False # Ensures subheadings are part of the ToC
36+
}
37+
38+
# Napoleon settings for Google style docstrings
39+
napoleon_google_docstring = True
40+
napoleon_numpy_docstring = False
41+
42+
numpydoc_show_class_members = False

docs/source/contributing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Contributing
2+
============
3+
4+
Please read `CONTRIBUTING.md`_ for details on our code of conduct, and the process for submitting pull requests to us.
5+
6+
.. _CONTRIBUTING.md: https://github.com/Onix-Systems/python-pin-payments/blob/master/CONTRIBUTING.md

docs/source/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. raw:: html
2+
3+
<div style="text-align: right;">
4+
<a href="https://github.com/Onix-Systems/python-monobank-client" target="_blank">Source repository on GitHub</a>
5+
</div>
6+
7+
PrivatBank API client documentation
8+
===================================
9+
10+
.. toctree::
11+
:maxdepth: 2
12+
:caption: Contents:
13+
14+
overview
15+
installation
16+
usage
17+
contributing
18+
license
19+
modules
20+

docs/source/installation.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Installation
2+
=============
3+
**This framework is published at the PyPI, install it with pip:**
4+
5+
1. This package makes it possible to use module methods in synchronous frameworks:
6+
7+
.. code-block:: bash
8+
9+
pip install monobank-api-client[http]
10+
11+
2. This package makes it possible to use module methods in asynchronous frameworks:
12+
13+
.. code-block:: bash
14+
15+
pip install monobank-api-client[aio]
16+
17+
3. This package makes it possible to use ready-made views with a synchronous script based on the Django Rest framework:
18+
19+
.. code-block:: bash
20+
21+
pip install monobank-api-client[drf]
22+
23+
To get started, add the following packages to ``INSTALLED_APPS``:
24+
25+
.. code-block:: python
26+
27+
INSTALLED_APPS = [
28+
...
29+
'rest_framework',
30+
'drf_mono',
31+
]
32+
33+
Include ``drf_mono`` urls to your ``urls.py``:
34+
35+
.. code-block:: python
36+
37+
urlpatterns = [
38+
...
39+
path('mono/', include('drf_mono.urls', namespace='drf_mono')),
40+
]
41+
42+
4. This package makes it possible to use ready-made routers with an asynchronous script based on the FastAPI framework:
43+
44+
.. code-block:: python
45+
46+
pip install monobank-api-client[fastapi]
47+
48+
5. To install all packages at once:
49+
50+
.. code-block:: python
51+
52+
pip install monobank-api-client[all]

docs/source/license.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
License
2+
=======
3+
4+
This project is licensed under the MIT License - see the `LICENSE.md`_ file for details.
5+
6+
.. _LICENSE.md: https://github.com/Onix-Systems/python-pin-payments/blob/master/LICENSE.md
7+
8+

docs/source/modules.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Mono Bank API
2+
===============
3+
4+
Asynchronous API Manager
5+
-------------------------
6+
.. automodule:: monobank_api_client.async_mono.manager
7+
:members:
8+
:undoc-members:
9+
:show-inheritance:
10+
11+
Synchronous API Manager
12+
------------------------
13+
.. automodule:: monobank_api_client.sync_mono.manager
14+
:members:
15+
:undoc-members:
16+
:show-inheritance:
17+
18+
FastAPI Router
19+
--------------
20+
.. automodule:: monobank_api_client.fastapi_mono.router
21+
:members:
22+
:undoc-members:
23+
:show-inheritance:
24+
25+
Django Rest Framework Views
26+
---------------------------
27+
.. automodule:: monobank_api_client.drf_mono.views
28+
:members:
29+
:undoc-members:
30+
:no-index:
31+

docs/source/overview.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
Overview
3+
========
4+
This project provides an interface to interact with the **Monobank API**, enabling efficient and seamless integration of its services within applications.
5+
6+
**Key Functionalities:**
7+
8+
- Fetching currency exchange rates.
9+
- Account balance retrieval.
10+
- Transaction history access.
11+
- Webhook-based notification support.
12+
13+
**Core Aim:**
14+
15+
- Simplify access to the **Monobank API**.
16+
- Allow developers to implement banking functions quickly without handling low-level API details.
17+
18+

0 commit comments

Comments
 (0)