updated docs strings and added README.md

This commit is contained in:
2026-03-08 17:59:53 +05:30
parent 0453fdd88a
commit c541577788
46 changed files with 863 additions and 681 deletions

View File

@@ -2,21 +2,21 @@
"module": "mail_intake.adapters",
"content": {
"path": "mail_intake.adapters",
"docstring": "Mail provider adapter implementations for Mail Intake.\n\n---\n\n## Summary\n\nThis package contains **adapter-layer implementations** responsible for\ninterfacing with external mail providers and exposing a normalized,\nprovider-agnostic contract to the rest of the system.\n\nAdapters in this package:\n- Implement the `MailIntakeAdapter` interface\n- Encapsulate all provider-specific APIs and semantics\n- Perform read-only access to mail data\n- Return provider-native payloads without interpretation\n\nProvider-specific logic **must not leak** outside of adapter implementations.\nAll parsings, normalizations, and transformations must be handled by downstream\ncomponents.\n\n---\n\n## Public API\n\n MailIntakeAdapter\n MailIntakeGmailAdapter\n\n---",
"docstring": "# Summary\n\nMail provider adapter implementations for Mail Intake.\n\nThis package contains **adapter-layer implementations** responsible for\ninterfacing with external mail providers and exposing a normalized,\nprovider-agnostic contract to the rest of the system.\n\nAdapters in this package:\n\n- Implement the `MailIntakeAdapter` interface.\n- Encapsulate all provider-specific APIs and semantics.\n- Perform read-only access to mail data.\n- Return provider-native payloads without interpretation.\n\nProvider-specific logic **must not leak** outside of adapter implementations.\nAll parsings, normalizations, and transformations must be handled by downstream\ncomponents.\n\n---\n\n# Public API\n\n- `MailIntakeAdapter`\n- `MailIntakeGmailAdapter`\n\n---",
"objects": {
"MailIntakeAdapter": {
"name": "MailIntakeAdapter",
"kind": "class",
"path": "mail_intake.adapters.MailIntakeAdapter",
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
"docstring": "Base adapter interface for mail providers.\n\nNotes:\n **Guarantees:**\n\n - discover messages matching a query\n - retrieve full message payloads\n - retrieve full thread payloads\n\n **Lifecycle:**\n\n - adapters are intentionally read-only and must not mutate provider state",
"docstring": "Base adapter interface for mail providers.\n\nNotes:\n **Guarantees:**\n\n - Discover messages matching a query.\n - Retrieve full message payloads.\n - Retrieve full thread payloads.\n\n **Lifecycle:**\n\n - Adapters are intentionally read-only and must not mutate provider state.",
"members": {
"iter_message_refs": {
"name": "iter_message_refs",
"kind": "function",
"path": "mail_intake.adapters.MailIntakeAdapter.iter_message_refs",
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
"docstring": "Iterate over lightweight message references matching a query.\n\nArgs:\n query (str):\n Provider-specific query string used to filter messages.\n\nYields:\n Dict[str, str]:\n Dictionaries containing message and thread identifiers.\n\nNotes:\n **Guarantees:**\n\n - Implementations must yield dictionaries containing at least ``message_id`` and ``thread_id``\n\nExample:\n Typical yield:\n\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
"docstring": "Iterate over lightweight message references matching a query.\n\nArgs:\n query (str):\n Provider-specific query string used to filter messages.\n\nYields:\n Dict[str, str]:\n Dictionaries containing message and thread identifiers.\n\nNotes:\n **Guarantees:**\n\n - Implementations must yield dictionaries containing at least\n `message_id` and `thread_id`.\n\nExample:\n Typical yield:\n\n ```python\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }\n ```"
},
"fetch_message": {
"name": "fetch_message",
@@ -39,7 +39,7 @@
"kind": "class",
"path": "mail_intake.adapters.MailIntakeGmailAdapter",
"signature": "<bound method Alias.signature of Alias('MailIntakeGmailAdapter', 'mail_intake.adapters.gmail.MailIntakeGmailAdapter')>",
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nNotes:\n **Responsibilities:**\n\n - This class is the ONLY place where googleapiclient is imported\n - Gmail REST semantics are known\n - .execute() is called\n\n **Constraints:**\n \n - Must remain thin and imperative\n - Must not perform parsing or interpretation\n - Must not expose Gmail-specific types beyond this class",
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nNotes:\n **Responsibilities:**\n\n - This class is the ONLY place where `googleapiclient` is imported.\n - Gmail REST semantics are known.\n - `.execute()` is called.\n\n **Constraints:**\n\n - Must remain thin and imperative.\n - Must not perform parsing or interpretation.\n - Must not expose Gmail-specific types beyond this class.",
"members": {
"service": {
"name": "service",
@@ -76,7 +76,7 @@
"kind": "module",
"path": "mail_intake.adapters.base",
"signature": null,
"docstring": "Mail provider adapter contracts for Mail Intake.\n\n---\n\n## Summary\n\nThis module defines the **provider-agnostic adapter interface** used for\nread-only mail ingestion.\n\nAdapters encapsulate all provider-specific access logic and expose a\nminimal, normalized contract to the rest of the system. No provider-specific\ntypes or semantics should leak beyond implementations of this interface.",
"docstring": "# Summary\n\nMail provider adapter contracts for Mail Intake.\n\nThis module defines the **provider-agnostic adapter interface** used for\nread-only mail ingestion.\n\nAdapters encapsulate all provider-specific access logic and expose a\nminimal, normalized contract to the rest of the system. No provider-specific\ntypes or semantics should leak beyond implementations of this interface.",
"members": {
"ABC": {
"name": "ABC",
@@ -117,28 +117,28 @@
"name": "MailIntakeAdapter",
"kind": "class",
"path": "mail_intake.adapters.base.MailIntakeAdapter",
"signature": "<bound method Class.signature of Class('MailIntakeAdapter', 20, 92)>",
"docstring": "Base adapter interface for mail providers.\n\nNotes:\n **Guarantees:**\n\n - discover messages matching a query\n - retrieve full message payloads\n - retrieve full thread payloads\n\n **Lifecycle:**\n\n - adapters are intentionally read-only and must not mutate provider state",
"signature": "<bound method Class.signature of Class('MailIntakeAdapter', 18, 93)>",
"docstring": "Base adapter interface for mail providers.\n\nNotes:\n **Guarantees:**\n\n - Discover messages matching a query.\n - Retrieve full message payloads.\n - Retrieve full thread payloads.\n\n **Lifecycle:**\n\n - Adapters are intentionally read-only and must not mutate provider state.",
"members": {
"iter_message_refs": {
"name": "iter_message_refs",
"kind": "function",
"path": "mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs",
"signature": "<bound method Function.signature of Function('iter_message_refs', 36, 62)>",
"docstring": "Iterate over lightweight message references matching a query.\n\nArgs:\n query (str):\n Provider-specific query string used to filter messages.\n\nYields:\n Dict[str, str]:\n Dictionaries containing message and thread identifiers.\n\nNotes:\n **Guarantees:**\n\n - Implementations must yield dictionaries containing at least ``message_id`` and ``thread_id``\n\nExample:\n Typical yield:\n\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
"signature": "<bound method Function.signature of Function('iter_message_refs', 34, 63)>",
"docstring": "Iterate over lightweight message references matching a query.\n\nArgs:\n query (str):\n Provider-specific query string used to filter messages.\n\nYields:\n Dict[str, str]:\n Dictionaries containing message and thread identifiers.\n\nNotes:\n **Guarantees:**\n\n - Implementations must yield dictionaries containing at least\n `message_id` and `thread_id`.\n\nExample:\n Typical yield:\n\n ```python\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }\n ```"
},
"fetch_message": {
"name": "fetch_message",
"kind": "function",
"path": "mail_intake.adapters.base.MailIntakeAdapter.fetch_message",
"signature": "<bound method Function.signature of Function('fetch_message', 64, 77)>",
"signature": "<bound method Function.signature of Function('fetch_message', 65, 78)>",
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id (str):\n Provider-specific message identifier.\n\nReturns:\n Dict[str, Any]:\n Provider-native message payload (e.g., Gmail message JSON structure)."
},
"fetch_thread": {
"name": "fetch_thread",
"kind": "function",
"path": "mail_intake.adapters.base.MailIntakeAdapter.fetch_thread",
"signature": "<bound method Function.signature of Function('fetch_thread', 79, 92)>",
"signature": "<bound method Function.signature of Function('fetch_thread', 80, 93)>",
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id (str):\n Provider-specific thread identifier.\n\nReturns:\n Dict[str, Any]:\n Provider-native thread payload."
}
}
@@ -150,7 +150,7 @@
"kind": "module",
"path": "mail_intake.adapters.gmail",
"signature": null,
"docstring": "Gmail adapter implementation for Mail Intake.\n\n---\n\n## Summary\n\nThis module provides a **Gmail-specific implementation** of the\n`MailIntakeAdapter` contract.\n\nIt is the only place in the codebase where:\n- `googleapiclient` is imported\n- Gmail REST API semantics are known\n- Low-level `.execute()` calls are made\n\nAll Gmail-specific behavior must be strictly contained within this module.",
"docstring": "# Summary\n\nGmail adapter implementation for Mail Intake.\n\nThis module provides a **Gmail-specific implementation** of the\n`MailIntakeAdapter` contract.\n\nIt is the only place in the codebase where:\n\n- `googleapiclient` is imported.\n- Gmail REST API semantics are known.\n- Low-level `.execute()` calls are made.\n\nAll Gmail-specific behavior must be strictly contained within this module.",
"members": {
"Iterator": {
"name": "Iterator",
@@ -192,14 +192,14 @@
"kind": "class",
"path": "mail_intake.adapters.gmail.MailIntakeAdapter",
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
"docstring": "Base adapter interface for mail providers.\n\nNotes:\n **Guarantees:**\n\n - discover messages matching a query\n - retrieve full message payloads\n - retrieve full thread payloads\n\n **Lifecycle:**\n\n - adapters are intentionally read-only and must not mutate provider state",
"docstring": "Base adapter interface for mail providers.\n\nNotes:\n **Guarantees:**\n\n - Discover messages matching a query.\n - Retrieve full message payloads.\n - Retrieve full thread payloads.\n\n **Lifecycle:**\n\n - Adapters are intentionally read-only and must not mutate provider state.",
"members": {
"iter_message_refs": {
"name": "iter_message_refs",
"kind": "function",
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.iter_message_refs",
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
"docstring": "Iterate over lightweight message references matching a query.\n\nArgs:\n query (str):\n Provider-specific query string used to filter messages.\n\nYields:\n Dict[str, str]:\n Dictionaries containing message and thread identifiers.\n\nNotes:\n **Guarantees:**\n\n - Implementations must yield dictionaries containing at least ``message_id`` and ``thread_id``\n\nExample:\n Typical yield:\n\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
"docstring": "Iterate over lightweight message references matching a query.\n\nArgs:\n query (str):\n Provider-specific query string used to filter messages.\n\nYields:\n Dict[str, str]:\n Dictionaries containing message and thread identifiers.\n\nNotes:\n **Guarantees:**\n\n - Implementations must yield dictionaries containing at least\n `message_id` and `thread_id`.\n\nExample:\n Typical yield:\n\n ```python\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }\n ```"
},
"fetch_message": {
"name": "fetch_message",
@@ -222,21 +222,21 @@
"kind": "class",
"path": "mail_intake.adapters.gmail.MailIntakeAdapterError",
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapterError', 'mail_intake.exceptions.MailIntakeAdapterError')>",
"docstring": "Errors raised by mail provider adapters.\n\nNotes:\n **Lifecycle:**\n\n - Raised when a provider adapter encounters API errors, transport failures, or invalid provider responses"
"docstring": "Errors raised by mail provider adapters.\n\nNotes:\n **Lifecycle:**\n\n - Raised when a provider adapter encounters API errors, transport\n failures, or invalid provider responses."
},
"MailIntakeAuthProvider": {
"name": "MailIntakeAuthProvider",
"kind": "class",
"path": "mail_intake.adapters.gmail.MailIntakeAuthProvider",
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthProvider', 'mail_intake.auth.base.MailIntakeAuthProvider')>",
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nNotes:\n **Responsibilities:**\n\n - Acquire credentials from an external provider\n - Refresh or revalidate credentials as needed\n - Handle authentication-specific failure modes\n - Coordinate with credential persistence layers where applicable\n\n **Constraints:**\n \n - Mail adapters must treat returned credentials as opaque and provider-specific\n - Mail adapters rely only on the declared credential type expected by the adapter",
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nNotes:\n **Responsibilities:**\n\n - Acquire credentials from an external provider.\n - Refresh or revalidate credentials as needed.\n - Handle authentication-specific failure modes.\n - Coordinate with credential persistence layers where applicable.\n\n **Constraints:**\n\n - Mail adapters must treat returned credentials as opaque and\n provider-specific.\n - Mail adapters rely only on the declared credential type expected\n by the adapter.",
"members": {
"get_credentials": {
"name": "get_credentials",
"kind": "function",
"path": "mail_intake.adapters.gmail.MailIntakeAuthProvider.get_credentials",
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.base.MailIntakeAuthProvider.get_credentials')>",
"docstring": "Retrieve valid, provider-specific credentials.\n\nReturns:\n T:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated.\n\nNotes:\n **Guarantees:**\n\n - This method is synchronous by design\n - Represents the sole entry point through which adapters obtain authentication material\n - Implementations must either return credentials of the declared type ``T`` that are valid at the time of return or raise an exception"
"docstring": "Retrieve valid, provider-specific credentials.\n\nReturns:\n T:\n Credentials of type `T` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated.\n\nNotes:\n **Guarantees:**\n\n - This method is synchronous by design.\n - Represents the sole entry point through which adapters obtain\n authentication material.\n - Implementations must either return credentials of the declared\n type `T` that are valid at the time of return or raise an exception."
}
}
},
@@ -244,8 +244,8 @@
"name": "MailIntakeGmailAdapter",
"kind": "class",
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter",
"signature": "<bound method Class.signature of Class('MailIntakeGmailAdapter', 29, 190)>",
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nNotes:\n **Responsibilities:**\n\n - This class is the ONLY place where googleapiclient is imported\n - Gmail REST semantics are known\n - .execute() is called\n\n **Constraints:**\n \n - Must remain thin and imperative\n - Must not perform parsing or interpretation\n - Must not expose Gmail-specific types beyond this class",
"signature": "<bound method Class.signature of Class('MailIntakeGmailAdapter', 28, 189)>",
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nNotes:\n **Responsibilities:**\n\n - This class is the ONLY place where `googleapiclient` is imported.\n - Gmail REST semantics are known.\n - `.execute()` is called.\n\n **Constraints:**\n\n - Must remain thin and imperative.\n - Must not perform parsing or interpretation.\n - Must not expose Gmail-specific types beyond this class.",
"members": {
"service": {
"name": "service",
@@ -258,21 +258,21 @@
"name": "iter_message_refs",
"kind": "function",
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.iter_message_refs",
"signature": "<bound method Function.signature of Function('iter_message_refs', 93, 134)>",
"signature": "<bound method Function.signature of Function('iter_message_refs', 92, 133)>",
"docstring": "Iterate over message references matching the query.\n\nArgs:\n query (str):\n Gmail search query string.\n\nYields:\n Dict[str, str]:\n Dictionaries containing ``message_id`` and ``thread_id``.\n\nRaises:\n MailIntakeAdapterError:\n If the Gmail API returns an error."
},
"fetch_message": {
"name": "fetch_message",
"kind": "function",
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_message",
"signature": "<bound method Function.signature of Function('fetch_message', 136, 162)>",
"signature": "<bound method Function.signature of Function('fetch_message', 135, 161)>",
"docstring": "Fetch a full Gmail message by message ID.\n\nArgs:\n message_id (str):\n Gmail message identifier.\n\nReturns:\n Dict[str, Any]:\n Provider-native Gmail message payload.\n\nRaises:\n MailIntakeAdapterError:\n If the Gmail API returns an error."
},
"fetch_thread": {
"name": "fetch_thread",
"kind": "function",
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_thread",
"signature": "<bound method Function.signature of Function('fetch_thread', 164, 190)>",
"signature": "<bound method Function.signature of Function('fetch_thread', 163, 189)>",
"docstring": "Fetch a full Gmail thread by thread ID.\n\nArgs:\n thread_id (str):\n Gmail thread identifier.\n\nReturns:\n Dict[str, Any]:\n Provider-native Gmail thread payload.\n\nRaises:\n MailIntakeAdapterError:\n If the Gmail API returns an error."
}
}