- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13
 
Contact exports #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Contact exports #98
Conversation
…xport functionality
…ing MailtrapClient
          
WalkthroughAdds a Contact Exports feature: types, API resource, wrapper, client getter, tests, example script, and README documentation to create and fetch contact export jobs and their download URLs. Changes
 Sequence Diagram(s)sequenceDiagram
    autonumber
    participant User
    participant Client as MailtrapClient
    participant Wrapper as ContactExportsBaseAPI
    participant Resource as ContactExportsApi
    participant API as HTTP Endpoint
    User->>Client: access contactExports
    Client->>Wrapper: instantiate (accountId validated)
    Client-->>User: ContactExportsBaseAPI
    User->>Wrapper: create(filters)
    Wrapper->>Resource: create(params)
    Resource->>API: POST /api/accounts/{accountId}/contacts/exports
    API-->>Resource: ContactExportResponse
    Resource-->>Wrapper: response
    Wrapper-->>User: response
    alt fetch status/download
        User->>Wrapper: get(exportId)
        Wrapper->>Resource: get(exportId)
        Resource->>API: GET /api/accounts/{accountId}/contacts/exports/{exportId}
        API-->>Resource: ContactExportResponse (may include url)
        Resource-->>Wrapper: response
        Wrapper-->>User: response with url
    end
    Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 
 Suggested reviewers
 Poem
 Pre-merge checks and finishing touches❌ Failed checks (1 warning)
 ✅ Passed checks (3 passed)
 ✨ Finishing touches
 🧪 Generate unit tests (beta)
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
 🚧 Files skipped from review as they are similar to previous changes (1)
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment   | 
    
Co-authored-by: Marcin Klocek <[email protected]>
Motivation
Add support for Contact Exports API to enable exporting contacts based on filters. This allows users to export contacts from Mailtrap using various filter criteria such as list IDs, subscription status, and other contact fields.
Fixes #75
Changes
src/lib/api/resources/ContactExports.ts)src/lib/api/ContactExports.ts)src/types/api/contact-exports.ts)contactExportsgetter to MailtrapClientexamples/contact-exports/everything.ts)src/__tests__/lib/api/resources/ContactExports.test.ts)src/__tests__/lib/mailtrap-client.test.ts)How to test
npm test -- ContactExports.test.tsto verify all Contact Exports API tests passnpm test -- mailtrap-client.test.ts --testNamePattern="contactExports"to verify MailtrapClient getter tests passexamples/contact-exports/everything.tswith valid credentials and runnpx ts-node examples/contact-exports/everything.tsSummary by CodeRabbit
New Features
Documentation