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