@cakemail-org/cakemail-cli 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +12 -0
- package/.env.example +40 -0
- package/.env.test.example +45 -0
- package/CHANGELOG.md +1031 -0
- package/README.md +319 -15
- package/audit-formats.js +128 -0
- package/cakemail.rb +20 -0
- package/dist/cli.js +27 -10
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -6
- package/dist/client.js.map +1 -1
- package/dist/commands/account.js +1 -1
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/attributes.js +1 -1
- package/dist/commands/attributes.js.map +1 -1
- package/dist/commands/campaigns.d.ts.map +1 -1
- package/dist/commands/campaigns.js +103 -8
- package/dist/commands/campaigns.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +63 -4
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/contacts.d.ts.map +1 -1
- package/dist/commands/contacts.js +91 -12
- package/dist/commands/contacts.js.map +1 -1
- package/dist/commands/emails.js +1 -1
- package/dist/commands/emails.js.map +1 -1
- package/dist/commands/interests.d.ts +5 -0
- package/dist/commands/interests.d.ts.map +1 -0
- package/dist/commands/interests.js +172 -0
- package/dist/commands/interests.js.map +1 -0
- package/dist/commands/lists.d.ts.map +1 -1
- package/dist/commands/lists.js +6 -8
- package/dist/commands/lists.js.map +1 -1
- package/dist/commands/logs.d.ts +5 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +237 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/reports.js +1 -1
- package/dist/commands/reports.js.map +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/segments.js.map +1 -1
- package/dist/commands/senders.d.ts.map +1 -1
- package/dist/commands/senders.js +11 -8
- package/dist/commands/senders.js.map +1 -1
- package/dist/commands/suppressed.js +1 -1
- package/dist/commands/suppressed.js.map +1 -1
- package/dist/commands/tags.d.ts +5 -0
- package/dist/commands/tags.d.ts.map +1 -0
- package/dist/commands/tags.js +124 -0
- package/dist/commands/tags.js.map +1 -0
- package/dist/commands/templates.js +1 -1
- package/dist/commands/templates.js.map +1 -1
- package/dist/commands/transactional-templates.d.ts +5 -0
- package/dist/commands/transactional-templates.d.ts.map +1 -0
- package/dist/commands/transactional-templates.js +354 -0
- package/dist/commands/transactional-templates.js.map +1 -0
- package/dist/commands/webhooks.js +1 -1
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/utils/auth.d.ts +8 -1
- package/dist/utils/auth.d.ts.map +1 -1
- package/dist/utils/auth.js +39 -11
- package/dist/utils/auth.js.map +1 -1
- package/dist/utils/config-file.d.ts +7 -0
- package/dist/utils/config-file.d.ts.map +1 -1
- package/dist/utils/config-file.js +15 -0
- package/dist/utils/config-file.js.map +1 -1
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +12 -4
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/errors.js +1 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/list-defaults.d.ts +33 -0
- package/dist/utils/list-defaults.d.ts.map +1 -0
- package/dist/utils/list-defaults.js +52 -0
- package/dist/utils/list-defaults.js.map +1 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +36 -13
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/progress.d.ts.map +1 -1
- package/dist/utils/progress.js +32 -4
- package/dist/utils/progress.js.map +1 -1
- package/dist/utils/spinner.d.ts +17 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +43 -0
- package/dist/utils/spinner.js.map +1 -0
- package/docs/DOCUMENTATION-STANDARD.md +1068 -0
- package/docs/README.md +161 -0
- package/docs/developer/ARCHITECTURE.md +516 -0
- package/docs/developer/AUTH.md +204 -0
- package/docs/developer/CONTRIBUTING.md +227 -0
- package/docs/developer/DOCUMENTATION_SUMMARY.md +346 -0
- package/docs/developer/PROJECT_INDEX.md +365 -0
- package/docs/planning/API_COVERAGE.md +1045 -0
- package/docs/planning/BACKLOG.md +1159 -0
- package/docs/planning/PROFILE_SYSTEM_TASKS.md +287 -0
- package/docs/planning/UX_IMPLEMENTATION_PLAN.md +691 -0
- package/docs/planning/archive/RELEASE_CHECKLIST_v1.3.0.md +332 -0
- package/docs/planning/archive/RELEASE_v1.3.0.md +428 -0
- package/docs/planning/archive/cakemail-cli-ux-improvements.md +438 -0
- package/docs/planning/cakemail-profile-system-plan.md +1121 -0
- package/docs/testing/AI_USER_SIMULATION_DESIGN.md +1342 -0
- package/docs/testing/KENOGAMI_BIDIRECTIONAL_FLOW.md +1517 -0
- package/docs/testing/KENOGAMI_TRUTH_RECONCILIATION_SYSTEM.md +1369 -0
- package/docs/user-manual/.obsidian/app.json +1 -0
- package/docs/user-manual/.obsidian/appearance.json +1 -0
- package/docs/user-manual/.obsidian/core-plugins.json +33 -0
- package/docs/user-manual/.obsidian/workspace.json +167 -0
- package/docs/user-manual/01-getting-started/01-installation.md +214 -0
- package/docs/user-manual/01-getting-started/02-quick-start.md +432 -0
- package/docs/user-manual/01-getting-started/03-authentication.md +448 -0
- package/docs/user-manual/01-getting-started/04-configuration.md +430 -0
- package/docs/user-manual/01-getting-started/05-output-formats.md +447 -0
- package/docs/user-manual/02-core-concepts/01-accounts.md +514 -0
- package/docs/user-manual/02-core-concepts/02-profile-system.md +771 -0
- package/docs/user-manual/02-core-concepts/03-smart-defaults.md +485 -0
- package/docs/user-manual/02-core-concepts/04-authentication-methods.md +435 -0
- package/docs/user-manual/02-core-concepts/05-pagination-filtering.md +600 -0
- package/docs/user-manual/02-core-concepts/06-error-handling.md +718 -0
- package/docs/user-manual/02-core-concepts/07-api-coverage.md +483 -0
- package/docs/user-manual/03-email-operations/01-senders.md +490 -0
- package/docs/user-manual/03-email-operations/02-templates.md +444 -0
- package/docs/user-manual/03-email-operations/03-transactional-emails.md +706 -0
- package/docs/user-manual/03-email-operations/04-email-tracking.md +407 -0
- package/docs/user-manual/04-campaign-management/01-campaigns-basics.md +394 -0
- package/docs/user-manual/04-campaign-management/02-campaign-scheduling.md +630 -0
- package/docs/user-manual/04-campaign-management/03-campaign-testing.md +997 -0
- package/docs/user-manual/04-campaign-management/04-campaign-lifecycle.md +709 -0
- package/docs/user-manual/04-campaign-management/05-campaign-links.md +934 -0
- package/docs/user-manual/05-contact-management/01-lists.md +836 -0
- package/docs/user-manual/05-contact-management/02-contacts.md +1035 -0
- package/docs/user-manual/05-contact-management/03-custom-attributes.md +788 -0
- package/docs/user-manual/05-contact-management/04-segments.md +1028 -0
- package/docs/user-manual/05-contact-management/05-contact-import-export.md +1031 -0
- package/docs/user-manual/06-analytics-reporting/01-campaign-analytics.md +867 -0
- package/docs/user-manual/06-analytics-reporting/02-account-reports.md +227 -0
- package/docs/user-manual/07-integrations/01-webhooks-integration.md +259 -0
- package/docs/user-manual/07-integrations/02-automation.md +326 -0
- package/docs/user-manual/08-advanced-usage/01-scripting-patterns.md +672 -0
- package/docs/user-manual/08-advanced-usage/02-bulk-operations.md +932 -0
- package/docs/user-manual/08-advanced-usage/03-ci-cd-integration.md +892 -0
- package/docs/user-manual/08-advanced-usage/04-performance-optimization.md +766 -0
- package/docs/user-manual/09-command-reference/01-config.md +776 -0
- package/docs/user-manual/09-command-reference/02-account.md +652 -0
- package/docs/user-manual/09-command-reference/03-lists.md +958 -0
- package/docs/user-manual/09-command-reference/04-contacts.md +1408 -0
- package/docs/user-manual/09-command-reference/05-attributes.md +617 -0
- package/docs/user-manual/09-command-reference/06-segments.md +894 -0
- package/docs/user-manual/09-command-reference/07-senders.md +803 -0
- package/docs/user-manual/09-command-reference/08-templates.md +818 -0
- package/docs/user-manual/09-command-reference/09-campaigns.md +1250 -0
- package/docs/user-manual/09-command-reference/10-emails.md +807 -0
- package/docs/user-manual/09-command-reference/11-reports.md +1135 -0
- package/docs/user-manual/09-command-reference/12-webhooks.md +773 -0
- package/docs/user-manual/09-command-reference/13-suppressed.md +797 -0
- package/docs/user-manual/09-command-reference/14-interests.md +630 -0
- package/docs/user-manual/09-command-reference/15-tags.md +584 -0
- package/docs/user-manual/09-command-reference/16-logs.md +656 -0
- package/docs/user-manual/09-command-reference/17-transactional-templates.md +850 -0
- package/docs/user-manual/10-troubleshooting/01-common-errors.md +457 -0
- package/docs/user-manual/10-troubleshooting/02-authentication-issues.md +558 -0
- package/docs/user-manual/10-troubleshooting/03-connection-problems.md +634 -0
- package/docs/user-manual/10-troubleshooting/04-debugging.md +725 -0
- package/docs/user-manual/11-appendix/04-faq.md +484 -0
- package/docs/user-manual/11-appendix/05-glossary.md +250 -0
- package/docs/user-manual/README.md +0 -0
- package/package.json +13 -47
- package/src/cli.ts +125 -0
- package/src/client.ts +16 -0
- package/src/commands/account.ts +267 -0
- package/src/commands/accounts.ts +78 -0
- package/src/commands/actions.ts +249 -0
- package/src/commands/attributes.ts +139 -0
- package/src/commands/campaign-blueprints.ts +106 -0
- package/src/commands/campaigns.ts +469 -0
- package/src/commands/config.ts +77 -0
- package/src/commands/contacts.ts +612 -0
- package/src/commands/custom-attributes.ts +127 -0
- package/src/commands/dkims.ts +117 -0
- package/src/commands/domains.ts +82 -0
- package/src/commands/email-apis.ts +569 -0
- package/src/commands/emails.ts +197 -0
- package/src/commands/forms.ts +283 -0
- package/src/commands/interests.ts +155 -0
- package/src/commands/links.ts +38 -0
- package/src/commands/lists.ts +406 -0
- package/src/commands/logos.ts +71 -0
- package/src/commands/logs.ts +386 -0
- package/src/commands/reports.ts +306 -0
- package/src/commands/segments.ts +158 -0
- package/src/commands/senders.ts +204 -0
- package/src/commands/sub-accounts.ts +271 -0
- package/src/commands/suppressed-emails.ts +234 -0
- package/src/commands/suppressed.ts +198 -0
- package/src/commands/system-emails.ts +85 -0
- package/src/commands/tags.ts +146 -0
- package/src/commands/tasks.ts +116 -0
- package/src/commands/templates.ts +189 -0
- package/src/commands/tokens.ts +83 -0
- package/src/commands/transactional-emails.ts +374 -0
- package/src/commands/transactional-templates.ts +385 -0
- package/src/commands/users.ts +506 -0
- package/src/commands/webhooks.ts +172 -0
- package/src/commands/workflow-blueprints.ts +123 -0
- package/src/commands/workflows.ts +265 -0
- package/src/types/profile.ts +93 -0
- package/src/utils/auth.ts +272 -0
- package/src/utils/config-file.ts +96 -0
- package/src/utils/config.ts +134 -0
- package/src/utils/confirm.ts +32 -0
- package/src/utils/defaults.ts +99 -0
- package/src/utils/errors.ts +116 -0
- package/src/utils/interactive.ts +91 -0
- package/src/utils/list-defaults.ts +74 -0
- package/src/utils/output.ts +190 -0
- package/src/utils/progress.ts +320 -0
- package/src/utils/spinner.ts +22 -0
- package/tests/IMPLEMENTATION_STATUS.md +258 -0
- package/tests/PTY_SETUP.md +118 -0
- package/tests/PTY_TESTING_GUIDE.md +507 -0
- package/tests/README.md +244 -0
- package/tests/fixtures/api-responses/campaigns.json +34 -0
- package/tests/fixtures/test-config.json +13 -0
- package/tests/helpers/cli-runner.ts +128 -0
- package/tests/helpers/mock-server.ts +301 -0
- package/tests/helpers/pty-runner.ts +181 -0
- package/tests/integration/campaigns-real-api.test.ts +196 -0
- package/tests/integration/setup-integration.ts +50 -0
- package/tests/pty/campaigns.test.ts +241 -0
- package/tests/setup.ts +34 -0
- package/tsconfig.json +15 -0
- package/vitest.config.ts +28 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
# API Coverage
|
|
2
|
+
|
|
3
|
+
Understand the relationship between the Cakemail CLI, the Cakemail SDK, and the Cakemail API.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Cakemail CLI is built on top of the official Cakemail SDK, which provides 100% coverage of the Cakemail API (232 operations). This means:
|
|
8
|
+
|
|
9
|
+
- **All API operations** are available through the SDK
|
|
10
|
+
- **Most common operations** are exposed as CLI commands
|
|
11
|
+
- **Advanced operations** can be accessed via scripting with the SDK
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────────┐
|
|
17
|
+
│ Cakemail CLI │ ← User-friendly commands
|
|
18
|
+
│ (Command Layer) │
|
|
19
|
+
└──────────┬──────────┘
|
|
20
|
+
│
|
|
21
|
+
┌──────────▼──────────┐
|
|
22
|
+
│ Cakemail SDK │ ← 100% API coverage (232 ops)
|
|
23
|
+
│ (@cakemail-org) │
|
|
24
|
+
└──────────┬──────────┘
|
|
25
|
+
│
|
|
26
|
+
┌──────────▼──────────┐
|
|
27
|
+
│ Cakemail API │ ← REST API
|
|
28
|
+
│ (api.cakemail.dev) │
|
|
29
|
+
└─────────────────────┘
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Layers Explained
|
|
33
|
+
|
|
34
|
+
**Cakemail API (Bottom Layer)**
|
|
35
|
+
- REST API with 232 operations
|
|
36
|
+
- Handles all email marketing functionality
|
|
37
|
+
- Requires API authentication
|
|
38
|
+
|
|
39
|
+
**Cakemail SDK (Middle Layer)**
|
|
40
|
+
- Node.js TypeScript library
|
|
41
|
+
- Generated from OpenAPI specification
|
|
42
|
+
- 100% API coverage
|
|
43
|
+
- Type-safe operations
|
|
44
|
+
|
|
45
|
+
**Cakemail CLI (Top Layer)**
|
|
46
|
+
- Command-line interface
|
|
47
|
+
- User-friendly commands for common operations
|
|
48
|
+
- Built with Commander.js
|
|
49
|
+
- Uses SDK internally
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## CLI Command Coverage
|
|
54
|
+
|
|
55
|
+
The CLI currently implements commands for the most commonly used operations:
|
|
56
|
+
|
|
57
|
+
### Account Management
|
|
58
|
+
- Show current account
|
|
59
|
+
- List accessible accounts
|
|
60
|
+
- Switch between accounts
|
|
61
|
+
- Test credentials
|
|
62
|
+
- Logout
|
|
63
|
+
|
|
64
|
+
### Email API v2 (Transactional)
|
|
65
|
+
- Send emails (HTML, text, templates)
|
|
66
|
+
- Get email details
|
|
67
|
+
- Render email content
|
|
68
|
+
- View email logs
|
|
69
|
+
- List email tags
|
|
70
|
+
|
|
71
|
+
### Templates
|
|
72
|
+
- List templates
|
|
73
|
+
- Get template details
|
|
74
|
+
- Create templates
|
|
75
|
+
- Update templates
|
|
76
|
+
- Render templates
|
|
77
|
+
- Delete templates
|
|
78
|
+
|
|
79
|
+
### Campaigns
|
|
80
|
+
- List campaigns
|
|
81
|
+
- Get campaign details
|
|
82
|
+
- Create campaigns
|
|
83
|
+
- Update campaigns
|
|
84
|
+
- Schedule/unschedule campaigns
|
|
85
|
+
- Send test emails
|
|
86
|
+
- Archive/unarchive campaigns
|
|
87
|
+
- Suspend/resume campaigns
|
|
88
|
+
- Cancel campaigns
|
|
89
|
+
- List campaign links
|
|
90
|
+
- Delete campaigns
|
|
91
|
+
|
|
92
|
+
### Lists
|
|
93
|
+
- List all lists
|
|
94
|
+
- Get list details
|
|
95
|
+
- Create lists
|
|
96
|
+
- Update lists
|
|
97
|
+
- Archive lists
|
|
98
|
+
- Accept list policy
|
|
99
|
+
- Manage subscription forms
|
|
100
|
+
- Delete lists
|
|
101
|
+
|
|
102
|
+
### Contacts
|
|
103
|
+
- List contacts
|
|
104
|
+
- Get contact details
|
|
105
|
+
- Add contacts
|
|
106
|
+
- Update contacts
|
|
107
|
+
- Delete contacts
|
|
108
|
+
- Unsubscribe contacts
|
|
109
|
+
- Export contacts
|
|
110
|
+
- Tag/untag contacts (single and bulk)
|
|
111
|
+
|
|
112
|
+
### Custom Attributes
|
|
113
|
+
- List attributes
|
|
114
|
+
- Get attribute details
|
|
115
|
+
- Create attributes
|
|
116
|
+
- Delete attributes
|
|
117
|
+
|
|
118
|
+
### Segments
|
|
119
|
+
- List segments
|
|
120
|
+
- Get segment details
|
|
121
|
+
- Create segments
|
|
122
|
+
- Update segments
|
|
123
|
+
- Delete segments
|
|
124
|
+
- List contacts in segment
|
|
125
|
+
|
|
126
|
+
### Senders
|
|
127
|
+
- List senders
|
|
128
|
+
- Get sender details
|
|
129
|
+
- Create senders
|
|
130
|
+
- Update senders
|
|
131
|
+
- Confirm sender email
|
|
132
|
+
- Resend confirmation
|
|
133
|
+
- Delete senders
|
|
134
|
+
|
|
135
|
+
### Webhooks
|
|
136
|
+
- List webhooks
|
|
137
|
+
- Get webhook details
|
|
138
|
+
- Create webhooks
|
|
139
|
+
- Update webhooks
|
|
140
|
+
- Archive/unarchive webhooks
|
|
141
|
+
|
|
142
|
+
### Suppression List
|
|
143
|
+
- List suppressed emails
|
|
144
|
+
- Add to suppression list
|
|
145
|
+
- Remove from suppression list
|
|
146
|
+
- Export suppression list
|
|
147
|
+
|
|
148
|
+
### Reports & Analytics
|
|
149
|
+
- Campaign analytics
|
|
150
|
+
- Campaign link analytics
|
|
151
|
+
- List analytics
|
|
152
|
+
- Account analytics
|
|
153
|
+
- Email API statistics
|
|
154
|
+
- Export campaign reports
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## What's Not Covered by CLI Commands
|
|
159
|
+
|
|
160
|
+
Some advanced or less commonly used API operations are not exposed as CLI commands but can be accessed through the SDK:
|
|
161
|
+
|
|
162
|
+
### Advanced Campaign Operations
|
|
163
|
+
- Bulk operations
|
|
164
|
+
- Campaign cloning
|
|
165
|
+
- Advanced scheduling options
|
|
166
|
+
- Campaign webhooks
|
|
167
|
+
- A/B testing
|
|
168
|
+
|
|
169
|
+
### Advanced Contact Operations
|
|
170
|
+
- Bulk import (coming soon)
|
|
171
|
+
- Advanced segmentation
|
|
172
|
+
- Contact scoring
|
|
173
|
+
- Activity tracking
|
|
174
|
+
|
|
175
|
+
### Billing & Usage
|
|
176
|
+
- View invoices
|
|
177
|
+
- Check usage limits
|
|
178
|
+
- Manage subscriptions
|
|
179
|
+
|
|
180
|
+
### Advanced Integrations
|
|
181
|
+
- OAuth management
|
|
182
|
+
- API key management (beyond basic access tokens)
|
|
183
|
+
- Custom integrations
|
|
184
|
+
|
|
185
|
+
### Subaccount Management
|
|
186
|
+
- Create subaccounts
|
|
187
|
+
- Manage subaccount permissions
|
|
188
|
+
- Transfer resources
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Using the SDK Directly
|
|
193
|
+
|
|
194
|
+
For operations not available as CLI commands, you can use the SDK directly in Node.js scripts.
|
|
195
|
+
|
|
196
|
+
### Installation
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npm install @cakemail-org/cakemail-sdk
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Example: Custom Script
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
import { CakemailSDK } from '@cakemail-org/cakemail-sdk';
|
|
206
|
+
|
|
207
|
+
// Initialize SDK
|
|
208
|
+
const sdk = new CakemailSDK({
|
|
209
|
+
auth: {
|
|
210
|
+
email: process.env.CAKEMAIL_EMAIL,
|
|
211
|
+
password: process.env.CAKEMAIL_PASSWORD
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Use any API operation
|
|
216
|
+
async function advancedOperation() {
|
|
217
|
+
// Example: Get detailed campaign statistics
|
|
218
|
+
const stats = await sdk.campaigns.getCampaignStatistics({
|
|
219
|
+
campaignId: 12345,
|
|
220
|
+
includeDetails: true
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
console.log(stats);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
advancedOperation();
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### SDK Documentation
|
|
230
|
+
|
|
231
|
+
For complete SDK documentation, see:
|
|
232
|
+
- [SDK npm package](https://www.npmjs.com/package/@cakemail-org/cakemail-sdk)
|
|
233
|
+
- [Cakemail API Documentation](https://api.cakemail.com)
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## CLI vs SDK vs API
|
|
238
|
+
|
|
239
|
+
### When to Use Each
|
|
240
|
+
|
|
241
|
+
| Use Case | Best Tool | Why |
|
|
242
|
+
|----------|-----------|-----|
|
|
243
|
+
| **Daily operations** | CLI | Quick, user-friendly |
|
|
244
|
+
| **Automation scripts** | CLI | Simple bash scripts |
|
|
245
|
+
| **Advanced operations** | SDK | Full API access |
|
|
246
|
+
| **Custom integrations** | SDK | Programmatic control |
|
|
247
|
+
| **Web applications** | SDK | Type-safe TypeScript |
|
|
248
|
+
| **Direct API calls** | API | Language-agnostic |
|
|
249
|
+
|
|
250
|
+
### Feature Comparison
|
|
251
|
+
|
|
252
|
+
| Feature | CLI | SDK | API |
|
|
253
|
+
|---------|-----|-----|-----|
|
|
254
|
+
| **Coverage** | Common ops | 100% (232 ops) | 100% (232 ops) |
|
|
255
|
+
| **Ease of use** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ |
|
|
256
|
+
| **Flexibility** | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
|
|
257
|
+
| **Type safety** | N/A | ⭐⭐⭐⭐⭐ | N/A |
|
|
258
|
+
| **Documentation** | This manual | SDK docs | API docs |
|
|
259
|
+
| **Authentication** | .env or prompts | Code | HTTP headers |
|
|
260
|
+
| **Best for** | Terminal users | Developers | Any language |
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## API Operation Examples
|
|
265
|
+
|
|
266
|
+
### Example 1: CLI Command
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Simple CLI command
|
|
270
|
+
cakemail campaigns list --limit 10
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Example 2: SDK Usage
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// Equivalent SDK usage
|
|
277
|
+
const campaigns = await sdk.campaigns.listCampaigns({
|
|
278
|
+
limit: 10
|
|
279
|
+
});
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Example 3: Direct API Call
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# Equivalent direct API call
|
|
286
|
+
curl -X GET "https://api.cakemail.dev/campaigns?limit=10" \
|
|
287
|
+
-H "Authorization: Bearer $CAKEMAIL_ACCESS_TOKEN"
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## CLI Feature Roadmap
|
|
293
|
+
|
|
294
|
+
### Current Features
|
|
295
|
+
- ✅ Reports & Analytics commands
|
|
296
|
+
- ✅ Segments management
|
|
297
|
+
- ✅ Custom attributes
|
|
298
|
+
- ✅ Suppression list management
|
|
299
|
+
- ✅ Contact export and import
|
|
300
|
+
- ✅ Contact tagging (bulk operations)
|
|
301
|
+
- ✅ Extended list operations
|
|
302
|
+
- ✅ Email API logs
|
|
303
|
+
|
|
304
|
+
### Planned Features
|
|
305
|
+
- 🔄 Campaign cloning
|
|
306
|
+
- 🔄 A/B testing commands
|
|
307
|
+
- 🔄 Subaccount creation
|
|
308
|
+
- 🔄 Billing information
|
|
309
|
+
- 🔄 Advanced webhook management
|
|
310
|
+
|
|
311
|
+
### Under Consideration
|
|
312
|
+
- 💭 Interactive mode (REPL)
|
|
313
|
+
- 💭 Batch operations DSL
|
|
314
|
+
- 💭 Campaign templates marketplace
|
|
315
|
+
- 💭 Analytics dashboards (terminal UI)
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Requesting New Features
|
|
320
|
+
|
|
321
|
+
If you need a CLI command for an SDK/API operation that's not available:
|
|
322
|
+
|
|
323
|
+
### Check SDK Documentation
|
|
324
|
+
|
|
325
|
+
First, verify the operation exists in the SDK:
|
|
326
|
+
- [Cakemail SDK on npm](https://www.npmjs.com/package/@cakemail-org/cakemail-sdk)
|
|
327
|
+
- [Cakemail API Documentation](https://api.cakemail.com)
|
|
328
|
+
|
|
329
|
+
### Use SDK Directly (Temporary)
|
|
330
|
+
|
|
331
|
+
While waiting for CLI support, use the SDK directly:
|
|
332
|
+
|
|
333
|
+
```javascript
|
|
334
|
+
// custom-operation.js
|
|
335
|
+
import { CakemailSDK } from '@cakemail-org/cakemail-sdk';
|
|
336
|
+
|
|
337
|
+
const sdk = new CakemailSDK({
|
|
338
|
+
auth: {
|
|
339
|
+
accessToken: process.env.CAKEMAIL_ACCESS_TOKEN
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// Your custom operation
|
|
344
|
+
async function main() {
|
|
345
|
+
const result = await sdk.someService.someOperation({
|
|
346
|
+
// parameters
|
|
347
|
+
});
|
|
348
|
+
console.log(JSON.stringify(result, null, 2));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
main();
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Run with:
|
|
355
|
+
```bash
|
|
356
|
+
node custom-operation.js
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Request CLI Command
|
|
360
|
+
|
|
361
|
+
Submit a feature request:
|
|
362
|
+
1. **Check existing issues**: [GitHub Issues](https://github.com/cakemail-org/cakemail-cli/issues)
|
|
363
|
+
2. **Create new issue** with:
|
|
364
|
+
- Use case description
|
|
365
|
+
- API operation name
|
|
366
|
+
- Example usage
|
|
367
|
+
- Why SDK direct usage isn't sufficient
|
|
368
|
+
|
|
369
|
+
**Template:**
|
|
370
|
+
```markdown
|
|
371
|
+
### Feature Request: Add command for [operation]
|
|
372
|
+
|
|
373
|
+
**Use case:**
|
|
374
|
+
I need to [describe what you want to accomplish]
|
|
375
|
+
|
|
376
|
+
**API Operation:**
|
|
377
|
+
`sdk.service.operation()`
|
|
378
|
+
|
|
379
|
+
**Proposed CLI command:**
|
|
380
|
+
`cakemail resource action [options]`
|
|
381
|
+
|
|
382
|
+
**Why not use SDK directly:**
|
|
383
|
+
[Explain why a CLI command would be better]
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Coverage Statistics
|
|
389
|
+
|
|
390
|
+
### By Resource Type
|
|
391
|
+
|
|
392
|
+
| Resource | CLI Commands | SDK Operations | Coverage % |
|
|
393
|
+
|----------|--------------|----------------|------------|
|
|
394
|
+
| Campaigns | 16 | 20 | 80% |
|
|
395
|
+
| Contacts | 15 | 18 | 83% |
|
|
396
|
+
| Lists | 10 | 12 | 83% |
|
|
397
|
+
| Templates | 6 | 8 | 75% |
|
|
398
|
+
| Senders | 7 | 8 | 88% |
|
|
399
|
+
| Emails (API v2) | 5 | 7 | 71% |
|
|
400
|
+
| Reports | 12 | 15 | 80% |
|
|
401
|
+
| Webhooks | 6 | 8 | 75% |
|
|
402
|
+
| Segments | 6 | 7 | 86% |
|
|
403
|
+
| Attributes | 4 | 4 | 100% |
|
|
404
|
+
| Suppressed | 6 | 6 | 100% |
|
|
405
|
+
| Account | 5 | 8 | 63% |
|
|
406
|
+
|
|
407
|
+
**Overall CLI Coverage:** ~80% of common operations
|
|
408
|
+
|
|
409
|
+
**SDK Coverage:** 100% (232 operations)
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Understanding SDK Versioning
|
|
414
|
+
|
|
415
|
+
The CLI depends on the SDK version specified in `package.json`:
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"dependencies": {
|
|
420
|
+
"@cakemail-org/cakemail-sdk": "^2.0.0"
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Version Compatibility
|
|
426
|
+
|
|
427
|
+
- **CLI v1.x** → SDK v2.x → API v2
|
|
428
|
+
- SDK updates automatically include new API features
|
|
429
|
+
- CLI updates add new commands for SDK features
|
|
430
|
+
|
|
431
|
+
### Staying Updated
|
|
432
|
+
|
|
433
|
+
**Check CLI version:**
|
|
434
|
+
```bash
|
|
435
|
+
cakemail --version
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**Update CLI:**
|
|
439
|
+
```bash
|
|
440
|
+
# Homebrew
|
|
441
|
+
brew upgrade cakemail-cli
|
|
442
|
+
|
|
443
|
+
# npm
|
|
444
|
+
npm update -g @cakemail-org/cakemail-cli
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
**Check SDK version:**
|
|
448
|
+
```bash
|
|
449
|
+
npm list @cakemail-org/cakemail-sdk
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Best Practices
|
|
455
|
+
|
|
456
|
+
### 1. Start with CLI
|
|
457
|
+
|
|
458
|
+
For common operations, always try CLI first:
|
|
459
|
+
```bash
|
|
460
|
+
cakemail campaigns list
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### 2. Use SDK for Advanced Operations
|
|
464
|
+
|
|
465
|
+
When CLI doesn't support what you need:
|
|
466
|
+
```javascript
|
|
467
|
+
const sdk = new CakemailSDK(...);
|
|
468
|
+
await sdk.advanced.operation();
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### 3. Direct API as Last Resort
|
|
472
|
+
|
|
473
|
+
Only use direct API calls when SDK doesn't support it (rare):
|
|
474
|
+
```bash
|
|
475
|
+
curl -X POST "https://api.cakemail.dev/..."
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### 4. Request Missing Commands
|
|
479
|
+
|
|
480
|
+
If you find yourself repeatedly using SDK for the same operation, request a CLI command.
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|