Add download_attachment functionality to extract email attachments #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
download_attachmentmethod to the baseEmailClientclass and implements it for both Gmail and Outlook providers/download_attachmentAPI endpointNew Endpoint
Parameters:
msg_id(required) - The email message IDattachment_index(default: 0) - Which attachment to download (0-based)save_dir(optional) - If provided, saves file to disk; otherwise returns base64 dataResponse:
{ "operation_status": "succeeded", "operation_message": "Attachment has been downloaded successfully", "result": { "filename": "document.pdf", "mimeType": "application/pdf", "size": 249216, "total_attachments": 2, "saved": true, "filepath": "/path/to/save/document.pdf" } }Test Results
Files Changed
email_client/BaseEmailProvider.py- Added abstract method + success messageemail_client/gmail_helpers.py- Gmail implementationemail_client/outlook_helpers.py- Outlook/Graph API implementationapi/main.py- New endpoint🤖 Generated with Claude Code