Skip to content

Commit a9d283a

Browse files
committed
Update docs
Update docs
1 parent 48b0c79 commit a9d283a

32 files changed

Lines changed: 5481 additions & 1247 deletions

docs/README.md

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,56 @@
77
[![Main README](https://img.shields.io/badge/Main-README-green.svg)](../README.md)
88
[![GitHub](https://img.shields.io/badge/GitHub-Repository-black.svg)](https://github.com/Integration-Automation/MailThunder)
99

10-
This directory contains the [Read the Docs](https://readthedocs.io/) documentation source for **MailThunder**.
10+
This directory contains the [Read the Docs](https://readthedocs.io/) Sphinx documentation source for **MailThunder**.
1111

12-
For the full project overview, installation guide, quick start, and API reference, see the [Main README](../README.md).
12+
For the full project overview, see the [Main README](../README.md).
1313

1414
---
1515

1616
## Documentation Structure
1717

1818
```
1919
docs/
20-
README.md # This file
21-
Makefile # Unix build script for Sphinx
22-
make.bat # Windows build script for Sphinx
23-
requirements.txt # Python dependencies for building docs (sphinx-rtd-theme)
20+
README.md # This file
21+
Makefile # Unix build script
22+
make.bat # Windows build script
23+
requirements.txt # Sphinx dependencies
2424
source/
25-
conf.py # Sphinx configuration
26-
index.rst # Documentation root (toctree entry point)
25+
conf.py # Sphinx configuration
26+
index.rst # Root page (toctree entry point)
2727
docs/
28-
Eng/ # English documentation
29-
eng_index.rst # English index page
30-
send_google_mail.rst # Guide: Sending emails via SMTP
31-
read_google_mail.rst # Guide: Reading emails via IMAP
32-
Zh/ # Traditional Chinese documentation (繁體中文)
33-
zh_index.rst # Chinese index page
34-
send_google_mail.rst # Guide: 使用 SMTP 寄送郵件
35-
read_google_mail.rst # Guide: 使用 IMAP 讀取郵件
36-
API/ # API reference documentation
37-
api_index.rst # API index page
38-
smtp_api.rst # SMTP API reference
39-
imap_api.rst # IMAP API reference
28+
Eng/ # English documentation
29+
eng_index.rst # Overview & architecture
30+
installation.rst # Installation guide
31+
authentication.rst # Authentication setup
32+
send_google_mail.rst # Sending emails (SMTP)
33+
read_google_mail.rst # Reading emails (IMAP)
34+
scripting_engine.rst # JSON scripting engine
35+
project_templates.rst # Project template scaffolding
36+
cli.rst # Command-line interface
37+
socket_server.rst # TCP socket server
38+
package_manager.rst # Dynamic package loader
39+
logging.rst # Logging system
40+
exceptions.rst # Custom exceptions
41+
Zh/ # 繁體中文文件
42+
zh_index.rst # 總覽與架構
43+
installation.rst # 安裝指南
44+
authentication.rst # 認證設定
45+
send_google_mail.rst # 寄送郵件 (SMTP)
46+
read_google_mail.rst # 讀取郵件 (IMAP)
47+
scripting_engine.rst # JSON 腳本引擎
48+
project_templates.rst # 專案模板
49+
cli.rst # 命令列介面
50+
socket_server.rst # Socket 伺服器
51+
package_manager.rst # 套件管理器
52+
logging.rst # 日誌記錄
53+
exceptions.rst # 例外處理
54+
API/ # API reference
55+
api_index.rst # Public exports & module map
56+
smtp_api.rst # SMTPWrapper API
57+
imap_api.rst # IMAPWrapper API
58+
executor_api.rst # Executor API
59+
utils_api.rst # Utility functions API
4060
```
4161

4262
---
@@ -50,7 +70,7 @@ make html # Linux / macOS
5070
make.bat html # Windows
5171
```
5272

53-
Open `docs/build/html/index.html` in your browser to view.
73+
Open `docs/build/html/index.html` in your browser.
5474

5575
---
5676

@@ -64,12 +84,3 @@ Configured via `.readthedocs.yaml` in the project root:
6484
| Python | `3.11` |
6585
| Sphinx config | `docs/source/conf.py` |
6686
| Theme | `sphinx-rtd-theme` |
67-
68-
---
69-
70-
## Contributing to Documentation
71-
72-
1. Create or edit `.rst` files under `docs/source/docs/`
73-
2. Add new files to the relevant `toctree` in the index `.rst`
74-
3. Build locally to verify rendering
75-
4. Push to trigger a Read the Docs rebuild

docs/source/conf.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
# Configuration file for the Sphinx documentation builder.
22
#
3-
# This file only contains a selection of the most common options. For a full
4-
# list see the documentation:
3+
# For the full list of configuration options see:
54
# https://www.sphinx-doc.org/en/master/usage/configuration.html
65

76
# -- Path setup --------------------------------------------------------------
87

9-
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
11-
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
#
138
import os
149
import sys
1510
from pathlib import Path
@@ -26,27 +21,22 @@
2621

2722
# -- General configuration ---------------------------------------------------
2823

29-
# Add any Sphinx extension module names here, as strings. They can be
30-
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
31-
# ones.
3224
extensions = []
3325

34-
# Add any paths that contain templates here, relative to this directory.
3526
templates_path = ["_templates"]
3627

37-
# List of patterns, relative to source directory, that match files and
38-
# directories to ignore when looking for source files.
39-
# This pattern also affects html_static_path and html_extra_path.
4028
exclude_patterns = []
4129

4230
# -- Options for HTML output -------------------------------------------------
4331

44-
# The theme to use for HTML and HTML Help pages. See the documentation for
45-
# a list of builtin themes.
46-
#
4732
html_theme = "sphinx_rtd_theme"
4833

49-
# Add any paths that contain custom static files (such as style sheets) here,
50-
# relative to this directory. They are copied after the builtin static files,
51-
# so a file named "default.css" will overwrite the builtin "default.css".
5234
html_static_path = ["_static"]
35+
36+
# -- Options for sphinx_rtd_theme --------------------------------------------
37+
38+
html_theme_options = {
39+
"navigation_depth": 4,
40+
"collapse_navigation": False,
41+
"titles_only": False,
42+
}

docs/source/docs/API/api_index.rst

Lines changed: 74 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
MailThunder API Reference
2-
=========================
1+
API Reference
2+
=============
33

4-
This section provides the complete API reference for MailThunder's public classes and functions.
4+
This section provides the complete API reference for all public classes, methods,
5+
and functions in MailThunder.
56

67
.. toctree::
7-
:maxdepth: 4
8-
:caption: API Documentation
8+
:maxdepth: 3
9+
:caption: API Documentation
910

10-
smtp_api.rst
11-
imap_api.rst
11+
smtp_api
12+
imap_api
13+
executor_api
14+
utils_api
1215

1316
----
1417

@@ -19,151 +22,76 @@ All public APIs are accessible from the top-level ``je_mail_thunder`` package:
1922

2023
.. code-block:: python
2124
22-
from je_mail_thunder import (
23-
# SMTP
24-
SMTPWrapper,
25-
smtp_instance,
26-
# IMAP
27-
IMAPWrapper,
28-
imap_instance,
29-
# Authentication
30-
set_mail_thunder_os_environ,
31-
get_mail_thunder_os_environ,
32-
mail_thunder_content_data_dict,
33-
is_need_to_save_content,
34-
read_output_content,
35-
write_output_content,
36-
# Executor
37-
execute_action,
38-
execute_files,
39-
add_command_to_executor,
40-
# JSON
41-
read_action_json,
42-
# File Utilities
43-
get_dir_files_as_list,
44-
# Project
45-
create_project_dir,
46-
)
25+
from je_mail_thunder import (
26+
# SMTP
27+
SMTPWrapper, # SMTP wrapper class
28+
smtp_instance, # Pre-created SMTP instance (or None)
4729
48-
----
49-
50-
Executor Functions
51-
------------------
52-
53-
**Module:** ``je_mail_thunder.utils.executor.action_executor``
30+
# IMAP
31+
IMAPWrapper, # IMAP wrapper class
32+
imap_instance, # Pre-created IMAP instance (or None)
5433
55-
.. code-block:: python
56-
57-
def execute_action(action_list: [list, dict]) -> dict:
58-
"""
59-
Execute a list of action commands.
34+
# Authentication
35+
set_mail_thunder_os_environ, # Set auth env vars
36+
get_mail_thunder_os_environ, # Get auth env vars
37+
mail_thunder_content_data_dict, # Global credential dict
38+
is_need_to_save_content, # Check if credentials need saving
39+
read_output_content, # Read mail_thunder_content.json
40+
write_output_content, # Write mail_thunder_content.json
6041
61-
:param action_list: A list of action commands, or a dict with an "auto_control" key.
62-
Each action is a list where:
63-
- [0] is the command name (str)
64-
- [1] (optional) is a dict for keyword arguments or a list for positional arguments
65-
:return: A dict mapping "execute: [action]" to the return value of each command.
66-
"""
42+
# Executor
43+
execute_action, # Execute action list
44+
execute_files, # Execute multiple action files
45+
add_command_to_executor, # Register custom commands
6746
68-
.. code-block:: python
47+
# JSON
48+
read_action_json, # Read JSON action file
6949
70-
def execute_files(execute_files_list: list) -> list:
71-
"""
72-
Execute multiple JSON action files.
50+
# File Utilities
51+
get_dir_files_as_list, # List directory files
7352
74-
:param execute_files_list: A list of file paths to JSON action files.
75-
:return: A list of execution result dicts (one per file).
76-
"""
77-
78-
.. code-block:: python
79-
80-
def add_command_to_executor(command_dict: dict):
81-
"""
82-
Add custom functions to the executor.
83-
84-
:param command_dict: A dict mapping command names (str) to callable functions.
85-
Values must be types.MethodType or types.FunctionType.
86-
:raises AddCommandException: If a value is not a valid function type.
87-
"""
53+
# Project
54+
create_project_dir, # Scaffold project with templates
55+
)
8856
8957
----
9058

91-
Utility Functions
92-
-----------------
93-
94-
**Authentication:**
95-
96-
.. code-block:: python
97-
98-
def set_mail_thunder_os_environ(mail_thunder_user: str, mail_thunder_user_password: str):
99-
"""
100-
Set authentication environment variables.
101-
102-
:param mail_thunder_user: Email address
103-
:param mail_thunder_user_password: Email password or app password
104-
"""
105-
106-
.. code-block:: python
107-
108-
def get_mail_thunder_os_environ() -> dict:
109-
"""
110-
Get authentication environment variables.
111-
112-
:return: {"mail_thunder_user": str or None, "mail_thunder_user_password": str or None}
113-
"""
114-
115-
**Content File:**
116-
117-
.. code-block:: python
118-
119-
def read_output_content() -> dict:
120-
"""
121-
Read mail_thunder_content.json from the current working directory.
122-
123-
:return: Dict with "user" and "password" keys, or None if file not found.
124-
"""
125-
126-
.. code-block:: python
127-
128-
def write_output_content():
129-
"""
130-
Write content data to mail_thunder_content.json in the current working directory.
131-
"""
132-
133-
**JSON:**
134-
135-
.. code-block:: python
136-
137-
def read_action_json(file_path: str) -> dict:
138-
"""
139-
Read and parse a JSON action file.
140-
141-
:param file_path: Path to the JSON file.
142-
:return: Parsed JSON data as dict or list.
143-
"""
144-
145-
**File Utilities:**
146-
147-
.. code-block:: python
148-
149-
def get_dir_files_as_list(path: str) -> list:
150-
"""
151-
Get all file paths in a directory as a list.
152-
153-
:param path: Directory path to scan.
154-
:return: List of file path strings.
155-
"""
156-
157-
**Project:**
158-
159-
.. code-block:: python
160-
161-
def create_project_dir(project_path=None, parent_name=None):
162-
"""
163-
Create a project directory with pre-built templates.
164-
165-
:param project_path: Path where the project will be created (default: current directory).
166-
:param parent_name: Name of the project root directory.
167-
"""
168-
169-
----
59+
Module Map
60+
----------
61+
62+
.. list-table::
63+
:header-rows: 1
64+
:widths: 40 60
65+
66+
* - Import Path
67+
- Description
68+
* - ``je_mail_thunder.smtp.smtp_wrapper``
69+
- ``SMTPWrapper`` class, ``smtp_instance``
70+
* - ``je_mail_thunder.imap.imap_wrapper``
71+
- ``IMAPWrapper`` class, ``imap_instance``
72+
* - ``je_mail_thunder.utils.executor.action_executor``
73+
- ``Executor`` class, ``execute_action()``, ``execute_files()``, ``add_command_to_executor()``
74+
* - ``je_mail_thunder.utils.save_mail_user_content.save_on_env``
75+
- ``set_mail_thunder_os_environ()``, ``get_mail_thunder_os_environ()``
76+
* - ``je_mail_thunder.utils.save_mail_user_content.mail_thunder_content_save``
77+
- ``read_output_content()``, ``write_output_content()``
78+
* - ``je_mail_thunder.utils.save_mail_user_content.mail_thunder_content_data``
79+
- ``mail_thunder_content_data_dict``, ``is_need_to_save_content()``
80+
* - ``je_mail_thunder.utils.json.json_file``
81+
- ``read_action_json()``, ``write_action_json()``
82+
* - ``je_mail_thunder.utils.json_format.json_process``
83+
- ``reformat_json()``
84+
* - ``je_mail_thunder.utils.file_process.get_dir_file_list``
85+
- ``get_dir_files_as_list()``
86+
* - ``je_mail_thunder.utils.project.create_project_structure``
87+
- ``create_project_dir()``
88+
* - ``je_mail_thunder.utils.package_manager.package_manager_class``
89+
- ``PackageManager`` class, ``package_manager``
90+
* - ``je_mail_thunder.utils.socket_server.mail_thunder_socket_server``
91+
- ``TCPServer``, ``TCPServerHandler``, ``start_autocontrol_socket_server()``
92+
* - ``je_mail_thunder.utils.logging.loggin_instance``
93+
- ``mail_thunder_logger``
94+
* - ``je_mail_thunder.utils.exception.exceptions``
95+
- All custom exception classes
96+
* - ``je_mail_thunder.utils.exception.exception_tags``
97+
- Error tag strings

0 commit comments

Comments
 (0)