postiz 2.0.7 → 2.0.9

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/README.md CHANGED
@@ -172,6 +172,57 @@ postiz posts:delete <post-id>
172
172
 
173
173
  ---
174
174
 
175
+ ### Analytics
176
+
177
+ **Get platform analytics**
178
+ ```bash
179
+ postiz analytics:platform <integration-id>
180
+ postiz analytics:platform <integration-id> -d 30
181
+ ```
182
+
183
+ Returns metrics like followers, impressions, and engagement over time for a specific integration/channel. The `-d` flag specifies the number of days to look back (default: 7).
184
+
185
+ **Get post analytics**
186
+ ```bash
187
+ postiz analytics:post <post-id>
188
+ postiz analytics:post <post-id> -d 30
189
+ ```
190
+
191
+ Returns metrics like likes, comments, shares, and impressions for a specific published post.
192
+
193
+ **⚠️ If `analytics:post` returns `{"missing": true}`**, the post was published but the platform didn't return a usable post ID. You must resolve this before analytics will work:
194
+
195
+ ```bash
196
+ # 1. List available content from the provider
197
+ postiz posts:missing <post-id>
198
+
199
+ # 2. Connect the correct content to the post
200
+ postiz posts:connect <post-id> --release-id "7321456789012345678"
201
+
202
+ # 3. Analytics will now work
203
+ postiz analytics:post <post-id>
204
+ ```
205
+
206
+ ---
207
+
208
+ ### Connecting Missing Posts
209
+
210
+ Some platforms (e.g. TikTok) don't return a post ID immediately after publishing. The post's `releaseId` is set to `"missing"` and analytics won't work until resolved.
211
+
212
+ **List available content from the provider**
213
+ ```bash
214
+ postiz posts:missing <post-id>
215
+ ```
216
+
217
+ Returns an array of `{id, url}` items representing recent content from the provider. Returns an empty array if the provider doesn't support this feature.
218
+
219
+ **Connect a post to its published content**
220
+ ```bash
221
+ postiz posts:connect <post-id> --release-id "<content-id>"
222
+ ```
223
+
224
+ ---
225
+
175
226
  ### Media Upload
176
227
 
177
228
  **Upload file and get URL**
@@ -328,6 +379,7 @@ The CLI enables dynamic discovery of integration capabilities:
328
379
  2. **Get settings** - Retrieve character limits, required fields, and available tools
329
380
  3. **Trigger tools** - Fetch dynamic data (flairs, playlists, boards, etc.)
330
381
  4. **Create posts** - Use discovered data in posts
382
+ 5. **Analyze** - Get post analytics; if `{"missing": true}` is returned, resolve with `posts:missing` + `posts:connect`
331
383
 
332
384
  This allows AI agents to adapt to different platforms without hardcoded knowledge.
333
385
 
@@ -480,9 +532,13 @@ The CLI interacts with these Postiz API endpoints:
480
532
  | `/public/v1/posts` | POST | Create a post |
481
533
  | `/public/v1/posts` | GET | List posts |
482
534
  | `/public/v1/posts/:id` | DELETE | Delete a post |
535
+ | `/public/v1/posts/:id/missing` | GET | Get missing content from provider |
536
+ | `/public/v1/posts/:id/release-id` | PUT | Update release ID for a post |
483
537
  | `/public/v1/integrations` | GET | List integrations |
484
538
  | `/public/v1/integration-settings/:id` | GET | Get integration settings |
485
539
  | `/public/v1/integration-trigger/:id` | POST | Trigger integration tool |
540
+ | `/public/v1/analytics/:integration` | GET | Get platform analytics |
541
+ | `/public/v1/analytics/post/:postId` | GET | Get post analytics |
486
542
  | `/public/v1/upload` | POST | Upload media |
487
543
 
488
544
  ---
@@ -513,6 +569,7 @@ The CLI provides clear error messages with exit codes:
513
569
  | `Invalid settings` | Check `integrations:settings` for required fields |
514
570
  | `Tool not found` | Check available tools in `integrations:settings` output |
515
571
  | `Upload failed` | Verify file exists and format is supported |
572
+ | `analytics:post` returns `{"missing": true}` | Run `posts:missing <id>` then `posts:connect <id> --release-id "<rid>"` |
516
573
 
517
574
  ---
518
575
 
@@ -528,6 +585,7 @@ src/
528
585
  └── commands/
529
586
  ├── posts.ts # Post management commands
530
587
  ├── integrations.ts # Integration commands
588
+ ├── analytics.ts # Analytics commands
531
589
  └── upload.ts # Media upload command
532
590
  examples/ # Example scripts and JSON files
533
591
  package.json
@@ -583,6 +641,15 @@ postiz posts:list # List posts
583
641
  postiz posts:delete <id> # Delete post
584
642
  postiz upload <file> # Upload media
585
643
 
644
+ # Analytics
645
+ postiz analytics:platform <id> # Platform analytics (7 days)
646
+ postiz analytics:platform <id> -d 30 # Platform analytics (30 days)
647
+ postiz analytics:post <id> # Post analytics (7 days)
648
+ postiz analytics:post <id> -d 30 # Post analytics (30 days)
649
+ # If analytics:post returns {"missing": true}, resolve it:
650
+ postiz posts:missing <id> # List provider content
651
+ postiz posts:connect <id> --release-id "<rid>" # Connect content to post
652
+
586
653
  # Help
587
654
  postiz --help # Show help
588
655
  postiz posts:create --help # Command help
package/SKILL.md CHANGED
@@ -21,6 +21,8 @@ The fundamental pattern for using Postiz CLI:
21
21
  2. **Fetch** - Use integration tools to retrieve dynamic data (flairs, playlists, companies)
22
22
  3. **Prepare** - Upload media files if needed
23
23
  4. **Post** - Create posts with content, media, and platform-specific settings
24
+ 5. **Analyze** - Track performance with platform and post-level analytics
25
+ 6. **Resolve** - If analytics returns `{"missing": true}`, run `posts:missing` to list provider content, then `posts:connect` to link it
24
26
 
25
27
  ```bash
26
28
  # 1. Discover
@@ -35,6 +37,14 @@ postiz upload image.jpg
35
37
 
36
38
  # 4. Post
37
39
  postiz posts:create -c "Content" -m "image.jpg" -i "<integration-id>"
40
+
41
+ # 5. Analyze
42
+ postiz analytics:platform <integration-id> -d 30
43
+ postiz analytics:post <post-id> -d 7
44
+
45
+ # 6. Resolve (if analytics returns {"missing": true})
46
+ postiz posts:missing <post-id>
47
+ postiz posts:connect <post-id> --release-id "<content-id>"
38
48
  ```
39
49
 
40
50
  ---
@@ -112,6 +122,57 @@ postiz posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59
112
122
  postiz posts:delete <post-id>
113
123
  ```
114
124
 
125
+ ### Analytics
126
+
127
+ ```bash
128
+ # Get platform analytics (default: last 7 days)
129
+ postiz analytics:platform <integration-id>
130
+
131
+ # Get platform analytics for last 30 days
132
+ postiz analytics:platform <integration-id> -d 30
133
+
134
+ # Get post analytics (default: last 7 days)
135
+ postiz analytics:post <post-id>
136
+
137
+ # Get post analytics for last 30 days
138
+ postiz analytics:post <post-id> -d 30
139
+ ```
140
+
141
+ Returns an array of metrics (e.g. Followers, Impressions, Likes, Comments) with daily data points and percentage change over the period.
142
+
143
+ **⚠️ IMPORTANT: Missing Release ID Handling**
144
+
145
+ If `analytics:post` returns `{"missing": true}` instead of an analytics array, the post was published but the platform didn't return a usable post ID. You **must** resolve this before analytics will work:
146
+
147
+ ```bash
148
+ # 1. analytics:post returns {"missing": true}
149
+ postiz analytics:post <post-id>
150
+
151
+ # 2. Get available content from the provider
152
+ postiz posts:missing <post-id>
153
+ # Returns: [{"id": "7321456789012345678", "url": "https://...cover.jpg"}, ...]
154
+
155
+ # 3. Connect the correct content to the post
156
+ postiz posts:connect <post-id> --release-id "7321456789012345678"
157
+
158
+ # 4. Now analytics will work
159
+ postiz analytics:post <post-id>
160
+ ```
161
+
162
+ ### Connecting Missing Posts
163
+
164
+ Some platforms (e.g. TikTok) don't return a post ID immediately after publishing. When this happens, the post's `releaseId` is set to `"missing"` and analytics are unavailable until resolved.
165
+
166
+ ```bash
167
+ # List recent content from the provider for a post with missing release ID
168
+ postiz posts:missing <post-id>
169
+
170
+ # Connect a post to its published content
171
+ postiz posts:connect <post-id> --release-id "<content-id>"
172
+ ```
173
+
174
+ Returns an empty array if the provider doesn't support this feature or if the post doesn't have a missing release ID.
175
+
115
176
  ### Media Upload
116
177
 
117
178
  **⚠️ IMPORTANT:** Always upload files to Postiz before using them in posts. Many platforms (TikTok, Instagram, YouTube) **require verified URLs** and will reject external links.
@@ -581,6 +642,7 @@ postiz posts:create \
581
642
  8. **Character limits** - Each platform has different limits, check `maxLength` in settings
582
643
  9. **Required settings** - Some platforms require specific settings (Reddit needs title, YouTube needs title)
583
644
  10. **Media MIME types** - CLI auto-detects from file extension, ensure correct extension
645
+ 11. **Analytics returns `{"missing": true}`** - The post was published but the platform didn't return a post ID. Run `posts:missing <post-id>` to get available content, then `posts:connect <post-id> --release-id "<id>"` to link it. Analytics will work after connecting.
584
646
 
585
647
  ---
586
648
 
@@ -608,6 +670,15 @@ postiz posts:list # List posts
608
670
  postiz posts:delete <id> # Delete post
609
671
  postiz upload <file> # Upload media
610
672
 
673
+ # Analytics
674
+ postiz analytics:platform <id> # Platform analytics (7 days)
675
+ postiz analytics:platform <id> -d 30 # Platform analytics (30 days)
676
+ postiz analytics:post <id> # Post analytics (7 days)
677
+ postiz analytics:post <id> -d 30 # Post analytics (30 days)
678
+ # If analytics:post returns {"missing": true}, resolve it:
679
+ postiz posts:missing <id> # List provider content
680
+ postiz posts:connect <id> --release-id "<rid>" # Connect content to post
681
+
611
682
  # Help
612
683
  postiz --help # Show help
613
684
  postiz posts:create --help # Command help
package/dist/index.js CHANGED
@@ -151,6 +151,17 @@ var PostizAPI = class {
151
151
  }
152
152
  return await response.json();
153
153
  }
154
+ async getMissingContent(postId) {
155
+ return this.request(`/public/v1/posts/${postId}/missing`, {
156
+ method: "GET"
157
+ });
158
+ }
159
+ async updateReleaseId(postId, releaseId) {
160
+ return this.request(`/public/v1/posts/${postId}/release-id`, {
161
+ method: "PUT",
162
+ body: JSON.stringify({ releaseId })
163
+ });
164
+ }
154
165
  async getAnalytics(integrationId, date) {
155
166
  return this.request(`/public/v1/analytics/${integrationId}?date=${encodeURIComponent(date)}`, {
156
167
  method: "GET"
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/api.ts","../src/config.ts","../src/commands/posts.ts","../src/commands/integrations.ts","../src/commands/analytics.ts","../src/commands/upload.ts"],"sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { createPost, listPosts, deletePost } from './commands/posts';\nimport { listIntegrations, getIntegrationSettings, triggerIntegrationTool } from './commands/integrations';\nimport { getAnalytics, getPostAnalytics } from './commands/analytics';\nimport { uploadFile } from './commands/upload';\nimport type { Argv } from 'yargs';\n\nyargs(hideBin(process.argv))\n .scriptName('postiz')\n .usage('$0 <command> [options]')\n .command(\n 'posts:create',\n 'Create a new post',\n (yargs: Argv) => {\n return yargs\n .option('content', {\n alias: 'c',\n describe: 'Post/comment content (can be used multiple times)',\n type: 'string',\n })\n .option('media', {\n alias: 'm',\n describe: 'Comma-separated media URLs for the corresponding -c (can be used multiple times)',\n type: 'string',\n })\n .option('integrations', {\n alias: 'i',\n describe: 'Comma-separated list of integration IDs',\n type: 'string',\n })\n .option('date', {\n alias: 's',\n describe: 'Schedule date (ISO 8601 format) - REQUIRED',\n type: 'string',\n })\n .option('type', {\n alias: 't',\n describe: 'Post type: \"schedule\" or \"draft\"',\n type: 'string',\n choices: ['schedule', 'draft'],\n default: 'schedule',\n })\n .option('delay', {\n alias: 'd',\n describe: 'Delay in milliseconds between comments (default: 5000)',\n type: 'number',\n default: 5000,\n })\n .option('json', {\n alias: 'j',\n describe: 'Path to JSON file with full post structure',\n type: 'string',\n })\n .option('shortLink', {\n describe: 'Use short links',\n type: 'boolean',\n default: true,\n })\n .option('settings', {\n describe: 'Platform-specific settings as JSON string',\n type: 'string',\n })\n .check((argv) => {\n if (!argv.json && !argv.content) {\n throw new Error('Either --content or --json is required');\n }\n if (!argv.json && !argv.integrations) {\n throw new Error('--integrations is required when not using --json');\n }\n if (!argv.json && !argv.date) {\n throw new Error('--date is required when not using --json');\n }\n return true;\n })\n .example(\n '$0 posts:create -c \"Hello World!\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Simple scheduled post'\n )\n .example(\n '$0 posts:create -c \"Draft post\" -s \"2024-12-31T12:00:00Z\" -t draft -i \"twitter-123\"',\n 'Create draft post'\n )\n .example(\n '$0 posts:create -c \"Main post\" -m \"img1.jpg,img2.jpg\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Post with multiple images'\n )\n .example(\n '$0 posts:create -c \"Main post\" -m \"img1.jpg\" -c \"First comment\" -m \"img2.jpg\" -c \"Second comment\" -m \"img3.jpg,img4.jpg\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Post with comments, each having their own media'\n )\n .example(\n '$0 posts:create -c \"Main\" -c \"Comment with semicolon; see?\" -c \"Another!\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Comments can contain semicolons'\n )\n .example(\n '$0 posts:create -c \"Thread 1/3\" -c \"Thread 2/3\" -c \"Thread 3/3\" -d 2000 -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Twitter thread with 2s delay'\n )\n .example(\n '$0 posts:create --json ./post.json',\n 'Complex post from JSON file'\n )\n .example(\n '$0 posts:create -c \"Post to subreddit\" -s \"2024-12-31T12:00:00Z\" --settings \\'{\"subreddit\":[{\"value\":{\"subreddit\":\"programming\",\"title\":\"My Title\",\"type\":\"text\",\"url\":\"\",\"is_flair_required\":false}}]}\\' -i \"reddit-123\"',\n 'Reddit post with specific subreddit settings'\n )\n .example(\n '$0 posts:create -c \"Video description\" -s \"2024-12-31T12:00:00Z\" --settings \\'{\"title\":\"My Video\",\"type\":\"public\",\"tags\":[{\"value\":\"tech\",\"label\":\"Tech\"}]}\\' -i \"youtube-123\"',\n 'YouTube post with title and tags'\n )\n .example(\n '$0 posts:create -c \"Tweet content\" -s \"2024-12-31T12:00:00Z\" --settings \\'{\"who_can_reply_post\":\"everyone\"}\\' -i \"twitter-123\"',\n 'X (Twitter) post with reply settings'\n );\n },\n createPost as any\n )\n .command(\n 'posts:list',\n 'List all posts',\n (yargs: Argv) => {\n return yargs\n .option('startDate', {\n describe: 'Start date (ISO 8601 format). Default: 30 days ago',\n type: 'string',\n })\n .option('endDate', {\n describe: 'End date (ISO 8601 format). Default: 30 days from now',\n type: 'string',\n })\n .option('customer', {\n describe: 'Customer ID (optional)',\n type: 'string',\n })\n .example('$0 posts:list', 'List all posts (last 30 days to next 30 days)')\n .example(\n '$0 posts:list --startDate \"2024-01-01T00:00:00Z\" --endDate \"2024-12-31T23:59:59Z\"',\n 'List posts for a specific date range'\n )\n .example(\n '$0 posts:list --customer \"customer-id\"',\n 'List posts for a specific customer'\n );\n },\n listPosts as any\n )\n .command(\n 'posts:delete <id>',\n 'Delete a post',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Post ID to delete',\n type: 'string',\n })\n .example('$0 posts:delete abc123', 'Delete post with ID abc123');\n },\n deletePost as any\n )\n .command(\n 'integrations:list',\n 'List all connected integrations',\n {},\n listIntegrations as any\n )\n .command(\n 'integrations:settings <id>',\n 'Get settings schema for a specific integration',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Integration ID',\n type: 'string',\n })\n .example(\n '$0 integrations:settings reddit-123',\n 'Get settings schema for Reddit integration'\n )\n .example(\n '$0 integrations:settings youtube-456',\n 'Get settings schema for YouTube integration'\n );\n },\n getIntegrationSettings as any\n )\n .command(\n 'integrations:trigger <id> <method>',\n 'Trigger an integration tool to fetch additional data',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Integration ID',\n type: 'string',\n })\n .positional('method', {\n describe: 'Method name from the integration tools',\n type: 'string',\n })\n .option('data', {\n alias: 'd',\n describe: 'Data to pass to the tool as JSON string',\n type: 'string',\n })\n .example(\n '$0 integrations:trigger reddit-123 getSubreddits',\n 'Get list of subreddits'\n )\n .example(\n '$0 integrations:trigger reddit-123 searchSubreddits -d \\'{\"query\":\"programming\"}\\'',\n 'Search for subreddits'\n )\n .example(\n '$0 integrations:trigger youtube-123 getPlaylists',\n 'Get YouTube playlists'\n );\n },\n triggerIntegrationTool as any\n )\n .command(\n 'analytics:platform <id>',\n 'Get analytics for a specific integration/channel',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Integration ID',\n type: 'string',\n })\n .option('date', {\n alias: 'd',\n describe: 'Number of days to look back (default: 7)',\n type: 'string',\n default: '7',\n })\n .example(\n '$0 analytics:platform integration-123',\n 'Get last 7 days of analytics'\n )\n .example(\n '$0 analytics:platform integration-123 -d 30',\n 'Get last 30 days of analytics'\n );\n },\n getAnalytics as any\n )\n .command(\n 'analytics:post <id>',\n 'Get analytics for a specific post',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Post ID',\n type: 'string',\n })\n .option('date', {\n alias: 'd',\n describe: 'Number of days to look back (default: 7)',\n type: 'string',\n default: '7',\n })\n .example(\n '$0 analytics:post post-123',\n 'Get last 7 days of post analytics'\n )\n .example(\n '$0 analytics:post post-123 -d 30',\n 'Get last 30 days of post analytics'\n );\n },\n getPostAnalytics as any\n )\n .command(\n 'upload <file>',\n 'Upload a file',\n (yargs: Argv) => {\n return yargs\n .positional('file', {\n describe: 'File path to upload',\n type: 'string',\n })\n .example('$0 upload ./image.png', 'Upload an image');\n },\n uploadFile as any\n )\n .demandCommand(1, 'You need at least one command')\n .help()\n .alias('h', 'help')\n .version()\n .alias('v', 'version')\n .epilogue(\n 'For more information, visit: https://postiz.com\\n\\nSet your API key: export POSTIZ_API_KEY=your_api_key'\n )\n .parse();\n","import fetch, { FormData } from 'node-fetch';\n\nexport interface PostizConfig {\n apiKey: string;\n apiUrl?: string;\n}\n\nexport class PostizAPI {\n private apiKey: string;\n private apiUrl: string;\n\n constructor(config: PostizConfig) {\n this.apiKey = config.apiKey;\n this.apiUrl = config.apiUrl || 'https://api.postiz.com';\n }\n\n private async request(endpoint: string, options: any = {}) {\n const url = `${this.apiUrl}${endpoint}`;\n const headers = {\n 'Content-Type': 'application/json',\n Authorization: this.apiKey,\n ...options.headers,\n };\n\n try {\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`API Error (${response.status}): ${error}`);\n }\n\n return await response.json();\n } catch (error: any) {\n throw new Error(`Request failed: ${error.message}`);\n }\n }\n\n async createPost(data: any) {\n return this.request('/public/v1/posts', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n async listPosts(filters: any = {}) {\n const queryString = new URLSearchParams(\n Object.entries(filters).reduce((acc, [key, value]) => {\n if (value !== undefined && value !== null) {\n acc[key] = String(value);\n }\n return acc;\n }, {} as Record<string, string>)\n ).toString();\n\n const endpoint = queryString\n ? `/public/v1/posts?${queryString}`\n : '/public/v1/posts';\n\n return this.request(endpoint, {\n method: 'GET',\n });\n }\n\n async deletePost(id: string) {\n return this.request(`/public/v1/posts/${id}`, {\n method: 'DELETE',\n });\n }\n\n async upload(file: Buffer, filename: string) {\n const formData = new FormData();\n const extension = filename.split('.').pop()?.toLowerCase() || '';\n\n // Determine MIME type based on file extension\n const mimeTypes: Record<string, string> = {\n // Images\n 'png': 'image/png',\n 'jpg': 'image/jpeg',\n 'jpeg': 'image/jpeg',\n 'gif': 'image/gif',\n 'webp': 'image/webp',\n 'svg': 'image/svg+xml',\n 'bmp': 'image/bmp',\n 'ico': 'image/x-icon',\n\n // Videos\n 'mp4': 'video/mp4',\n 'mov': 'video/quicktime',\n 'avi': 'video/x-msvideo',\n 'mkv': 'video/x-matroska',\n 'webm': 'video/webm',\n 'flv': 'video/x-flv',\n 'wmv': 'video/x-ms-wmv',\n 'm4v': 'video/x-m4v',\n 'mpeg': 'video/mpeg',\n 'mpg': 'video/mpeg',\n '3gp': 'video/3gpp',\n\n // Audio\n 'mp3': 'audio/mpeg',\n 'wav': 'audio/wav',\n 'ogg': 'audio/ogg',\n 'aac': 'audio/aac',\n 'flac': 'audio/flac',\n 'm4a': 'audio/mp4',\n\n // Documents\n 'pdf': 'application/pdf',\n 'doc': 'application/msword',\n 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n };\n\n const type = mimeTypes[extension] || 'application/octet-stream';\n\n const blob = new Blob([file], { type });\n formData.append('file', blob, filename);\n\n const url = `${this.apiUrl}/public/v1/upload`;\n const response = await fetch(url, {\n method: 'POST',\n // @ts-ignore\n body: formData,\n headers: {\n Authorization: this.apiKey,\n },\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Upload failed (${response.status}): ${error}`);\n }\n\n return await response.json();\n }\n\n async getAnalytics(integrationId: string, date: string) {\n return this.request(`/public/v1/analytics/${integrationId}?date=${encodeURIComponent(date)}`, {\n method: 'GET',\n });\n }\n\n async getPostAnalytics(postId: string, date: string) {\n return this.request(`/public/v1/analytics/post/${postId}?date=${encodeURIComponent(date)}`, {\n method: 'GET',\n });\n }\n\n async listIntegrations() {\n return this.request('/public/v1/integrations', {\n method: 'GET',\n });\n }\n\n async getIntegrationSettings(integrationId: string) {\n return this.request(`/public/v1/integration-settings/${integrationId}`, {\n method: 'GET',\n });\n }\n\n async triggerIntegrationTool(\n integrationId: string,\n methodName: string,\n data: Record<string, string>\n ) {\n return this.request(`/public/v1/integration-trigger/${integrationId}`, {\n method: 'POST',\n body: JSON.stringify({ methodName, data }),\n });\n }\n}\n","import { PostizConfig } from './api';\n\nexport function getConfig(): PostizConfig {\n const apiKey = process.env.POSTIZ_API_KEY;\n const apiUrl = process.env.POSTIZ_API_URL;\n\n if (!apiKey) {\n console.error('❌ Error: POSTIZ_API_KEY environment variable is required');\n console.error('Please set it using: export POSTIZ_API_KEY=your_api_key');\n process.exit(1);\n }\n\n return {\n apiKey,\n apiUrl,\n };\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\nimport { readFileSync, existsSync } from 'fs';\n\nexport async function createPost(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n // Support both simple and complex post creation\n let postData: any;\n\n if (args.json) {\n // Load from JSON file for complex posts with comments and media\n try {\n const jsonPath = args.json;\n if (!existsSync(jsonPath)) {\n console.error(`❌ JSON file not found: ${jsonPath}`);\n process.exit(1);\n }\n const jsonContent = readFileSync(jsonPath, 'utf-8');\n postData = JSON.parse(jsonContent);\n } catch (error: any) {\n console.error('❌ Failed to parse JSON file:', error.message);\n process.exit(1);\n }\n } else {\n const integrations = args.integrations\n ? args.integrations.split(',').map((id: string) => id.trim())\n : [];\n\n if (integrations.length === 0) {\n console.error('❌ At least one integration ID is required');\n console.error('Use -i or --integrations to specify integration IDs');\n console.error('Run \"postiz integrations:list\" to see available integrations');\n process.exit(1);\n }\n\n // Support multiple -c and -m flags\n // Normalize to arrays\n const contents = Array.isArray(args.content) ? args.content : [args.content];\n const medias = Array.isArray(args.media) ? args.media : (args.media ? [args.media] : []);\n\n if (!contents[0]) {\n console.error('❌ At least one -c/--content is required');\n process.exit(1);\n }\n\n // Build value array by pairing contents with their media\n const values = contents.map((content: string, index: number) => {\n const mediaForThisContent = medias[index];\n const images = mediaForThisContent\n ? mediaForThisContent.split(',').map((img: string) => ({\n id: Math.random().toString(36).substring(7),\n path: img.trim(),\n }))\n : [];\n\n return {\n content: content,\n image: images,\n // Add delay for all items except the first (main post)\n ...(index > 0 && { delay: args.delay || 5000 }),\n };\n });\n\n // Parse provider-specific settings if provided\n // Note: __type is automatically added by the backend based on integration ID\n let settings: any = undefined;\n\n if (args.settings) {\n try {\n settings = typeof args.settings === 'string'\n ? JSON.parse(args.settings)\n : args.settings;\n } catch (error: any) {\n console.error('❌ Failed to parse settings JSON:', error.message);\n process.exit(1);\n }\n }\n\n // Build the proper post structure\n postData = {\n type: args.type || 'schedule', // 'schedule' or 'draft'\n date: args.date, // Required date field\n shortLink: args.shortLink !== false,\n tags: [],\n posts: integrations.map((integrationId: string) => ({\n integration: { id: integrationId },\n value: values,\n settings: settings,\n })),\n };\n }\n\n try {\n const result = await api.createPost(postData);\n console.log('✅ Post created successfully!');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to create post:', error.message);\n process.exit(1);\n }\n}\n\nexport async function listPosts(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n // Set default date range: last 30 days to 30 days in the future\n const defaultStartDate = new Date();\n defaultStartDate.setDate(defaultStartDate.getDate() - 30);\n\n const defaultEndDate = new Date();\n defaultEndDate.setDate(defaultEndDate.getDate() + 30);\n\n // Only send fields that are in GetPostsDto\n const filters: any = {\n startDate: args.startDate || defaultStartDate.toISOString(),\n endDate: args.endDate || defaultEndDate.toISOString(),\n };\n\n // customer is optional in the DTO\n if (args.customer) {\n filters.customer = args.customer;\n }\n\n try {\n const result = await api.listPosts(filters);\n console.log('📋 Posts:');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to list posts:', error.message);\n process.exit(1);\n }\n}\n\nexport async function deletePost(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Post ID is required');\n process.exit(1);\n }\n\n try {\n await api.deletePost(args.id);\n console.log(`✅ Post ${args.id} deleted successfully!`);\n } catch (error: any) {\n console.error('❌ Failed to delete post:', error.message);\n process.exit(1);\n }\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\n\nexport async function listIntegrations() {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n try {\n const result = await api.listIntegrations();\n console.log('🔌 Connected Integrations:');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to list integrations:', error.message);\n process.exit(1);\n }\n}\n\nexport async function getIntegrationSettings(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Integration ID is required');\n process.exit(1);\n }\n\n try {\n const result = await api.getIntegrationSettings(args.id);\n console.log(`⚙️ Settings for integration: ${args.id}`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to get integration settings:', error.message);\n process.exit(1);\n }\n}\n\nexport async function triggerIntegrationTool(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Integration ID is required');\n process.exit(1);\n }\n\n if (!args.method) {\n console.error('❌ Method name is required');\n process.exit(1);\n }\n\n // Parse data from JSON string or use empty object\n let data: Record<string, string> = {};\n if (args.data) {\n try {\n data = JSON.parse(args.data);\n } catch (error: any) {\n console.error('❌ Failed to parse data JSON:', error.message);\n process.exit(1);\n }\n }\n\n try {\n const result = await api.triggerIntegrationTool(args.id, args.method, data);\n console.log(`🔧 Tool result for ${args.method}:`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to trigger tool:', error.message);\n process.exit(1);\n }\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\n\nexport async function getAnalytics(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Integration ID is required');\n process.exit(1);\n }\n\n const date = args.date || '7';\n\n try {\n const result = await api.getAnalytics(args.id, date);\n console.log(`📊 Analytics for integration: ${args.id}`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to get analytics:', error.message);\n process.exit(1);\n }\n}\n\nexport async function getPostAnalytics(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Post ID is required');\n process.exit(1);\n }\n\n const date = args.date || '7';\n\n try {\n const result = await api.getPostAnalytics(args.id, date);\n console.log(`📊 Analytics for post: ${args.id}`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to get post analytics:', error.message);\n process.exit(1);\n }\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\nimport { readFileSync } from 'fs';\n\nexport async function uploadFile(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.file) {\n console.error('❌ File path is required');\n process.exit(1);\n }\n\n try {\n const fileBuffer = readFileSync(args.file);\n const filename = args.file.split('/').pop() || 'file';\n\n const result = await api.upload(fileBuffer, filename);\n console.log('✅ File uploaded successfully!');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to upload file:', error.message);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mBAAkB;AAClB,qBAAwB;;;ACDxB,wBAAgC;AAOzB,IAAM,YAAN,MAAgB;AAAA,EAIrB,YAAY,QAAsB;AAChC,SAAK,SAAS,OAAO;AACrB,SAAK,SAAS,OAAO,UAAU;AAAA,EACjC;AAAA,EAEA,MAAc,QAAQ,UAAkB,UAAe,CAAC,GAAG;AACzD,UAAM,MAAM,GAAG,KAAK,MAAM,GAAG,QA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ACA,WAAgB;AACf,WAAOA,OACJ,WAAW,QAAQ;AAAA,MAClB,UAAU;AAAA,MACV,MAAM;AAAA,IACR,CAAC,EACA,QAAQ,yBAAyB,iBAAiB;AAAA,EACvD;AAAA,EACA;AACF,EACC,cAAc,GAAG,+BAA+B,EAChD,KAAK,EACL,MAAM,KAAK,MAAM,EACjB,QAAQ,EACR,MAAM,KAAK,SAAS,EACpB;AAAA,EACC;AACF,EACC,MAAM;","names":["fetch","import_fs","yargs"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/api.ts","../src/config.ts","../src/commands/posts.ts","../src/commands/integrations.ts","../src/commands/analytics.ts","../src/commands/upload.ts"],"sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { createPost, listPosts, deletePost } from './commands/posts';\nimport { listIntegrations, getIntegrationSettings, triggerIntegrationTool } from './commands/integrations';\nimport { getAnalytics, getPostAnalytics } from './commands/analytics';\nimport { uploadFile } from './commands/upload';\nimport type { Argv } from 'yargs';\n\nyargs(hideBin(process.argv))\n .scriptName('postiz')\n .usage('$0 <command> [options]')\n .command(\n 'posts:create',\n 'Create a new post',\n (yargs: Argv) => {\n return yargs\n .option('content', {\n alias: 'c',\n describe: 'Post/comment content (can be used multiple times)',\n type: 'string',\n })\n .option('media', {\n alias: 'm',\n describe: 'Comma-separated media URLs for the corresponding -c (can be used multiple times)',\n type: 'string',\n })\n .option('integrations', {\n alias: 'i',\n describe: 'Comma-separated list of integration IDs',\n type: 'string',\n })\n .option('date', {\n alias: 's',\n describe: 'Schedule date (ISO 8601 format) - REQUIRED',\n type: 'string',\n })\n .option('type', {\n alias: 't',\n describe: 'Post type: \"schedule\" or \"draft\"',\n type: 'string',\n choices: ['schedule', 'draft'],\n default: 'schedule',\n })\n .option('delay', {\n alias: 'd',\n describe: 'Delay in milliseconds between comments (default: 5000)',\n type: 'number',\n default: 5000,\n })\n .option('json', {\n alias: 'j',\n describe: 'Path to JSON file with full post structure',\n type: 'string',\n })\n .option('shortLink', {\n describe: 'Use short links',\n type: 'boolean',\n default: true,\n })\n .option('settings', {\n describe: 'Platform-specific settings as JSON string',\n type: 'string',\n })\n .check((argv) => {\n if (!argv.json && !argv.content) {\n throw new Error('Either --content or --json is required');\n }\n if (!argv.json && !argv.integrations) {\n throw new Error('--integrations is required when not using --json');\n }\n if (!argv.json && !argv.date) {\n throw new Error('--date is required when not using --json');\n }\n return true;\n })\n .example(\n '$0 posts:create -c \"Hello World!\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Simple scheduled post'\n )\n .example(\n '$0 posts:create -c \"Draft post\" -s \"2024-12-31T12:00:00Z\" -t draft -i \"twitter-123\"',\n 'Create draft post'\n )\n .example(\n '$0 posts:create -c \"Main post\" -m \"img1.jpg,img2.jpg\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Post with multiple images'\n )\n .example(\n '$0 posts:create -c \"Main post\" -m \"img1.jpg\" -c \"First comment\" -m \"img2.jpg\" -c \"Second comment\" -m \"img3.jpg,img4.jpg\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Post with comments, each having their own media'\n )\n .example(\n '$0 posts:create -c \"Main\" -c \"Comment with semicolon; see?\" -c \"Another!\" -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Comments can contain semicolons'\n )\n .example(\n '$0 posts:create -c \"Thread 1/3\" -c \"Thread 2/3\" -c \"Thread 3/3\" -d 2000 -s \"2024-12-31T12:00:00Z\" -i \"twitter-123\"',\n 'Twitter thread with 2s delay'\n )\n .example(\n '$0 posts:create --json ./post.json',\n 'Complex post from JSON file'\n )\n .example(\n '$0 posts:create -c \"Post to subreddit\" -s \"2024-12-31T12:00:00Z\" --settings \\'{\"subreddit\":[{\"value\":{\"subreddit\":\"programming\",\"title\":\"My Title\",\"type\":\"text\",\"url\":\"\",\"is_flair_required\":false}}]}\\' -i \"reddit-123\"',\n 'Reddit post with specific subreddit settings'\n )\n .example(\n '$0 posts:create -c \"Video description\" -s \"2024-12-31T12:00:00Z\" --settings \\'{\"title\":\"My Video\",\"type\":\"public\",\"tags\":[{\"value\":\"tech\",\"label\":\"Tech\"}]}\\' -i \"youtube-123\"',\n 'YouTube post with title and tags'\n )\n .example(\n '$0 posts:create -c \"Tweet content\" -s \"2024-12-31T12:00:00Z\" --settings \\'{\"who_can_reply_post\":\"everyone\"}\\' -i \"twitter-123\"',\n 'X (Twitter) post with reply settings'\n );\n },\n createPost as any\n )\n .command(\n 'posts:list',\n 'List all posts',\n (yargs: Argv) => {\n return yargs\n .option('startDate', {\n describe: 'Start date (ISO 8601 format). Default: 30 days ago',\n type: 'string',\n })\n .option('endDate', {\n describe: 'End date (ISO 8601 format). Default: 30 days from now',\n type: 'string',\n })\n .option('customer', {\n describe: 'Customer ID (optional)',\n type: 'string',\n })\n .example('$0 posts:list', 'List all posts (last 30 days to next 30 days)')\n .example(\n '$0 posts:list --startDate \"2024-01-01T00:00:00Z\" --endDate \"2024-12-31T23:59:59Z\"',\n 'List posts for a specific date range'\n )\n .example(\n '$0 posts:list --customer \"customer-id\"',\n 'List posts for a specific customer'\n );\n },\n listPosts as any\n )\n .command(\n 'posts:delete <id>',\n 'Delete a post',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Post ID to delete',\n type: 'string',\n })\n .example('$0 posts:delete abc123', 'Delete post with ID abc123');\n },\n deletePost as any\n )\n .command(\n 'integrations:list',\n 'List all connected integrations',\n {},\n listIntegrations as any\n )\n .command(\n 'integrations:settings <id>',\n 'Get settings schema for a specific integration',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Integration ID',\n type: 'string',\n })\n .example(\n '$0 integrations:settings reddit-123',\n 'Get settings schema for Reddit integration'\n )\n .example(\n '$0 integrations:settings youtube-456',\n 'Get settings schema for YouTube integration'\n );\n },\n getIntegrationSettings as any\n )\n .command(\n 'integrations:trigger <id> <method>',\n 'Trigger an integration tool to fetch additional data',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Integration ID',\n type: 'string',\n })\n .positional('method', {\n describe: 'Method name from the integration tools',\n type: 'string',\n })\n .option('data', {\n alias: 'd',\n describe: 'Data to pass to the tool as JSON string',\n type: 'string',\n })\n .example(\n '$0 integrations:trigger reddit-123 getSubreddits',\n 'Get list of subreddits'\n )\n .example(\n '$0 integrations:trigger reddit-123 searchSubreddits -d \\'{\"query\":\"programming\"}\\'',\n 'Search for subreddits'\n )\n .example(\n '$0 integrations:trigger youtube-123 getPlaylists',\n 'Get YouTube playlists'\n );\n },\n triggerIntegrationTool as any\n )\n .command(\n 'analytics:platform <id>',\n 'Get analytics for a specific integration/channel',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Integration ID',\n type: 'string',\n })\n .option('date', {\n alias: 'd',\n describe: 'Number of days to look back (default: 7)',\n type: 'string',\n default: '7',\n })\n .example(\n '$0 analytics:platform integration-123',\n 'Get last 7 days of analytics'\n )\n .example(\n '$0 analytics:platform integration-123 -d 30',\n 'Get last 30 days of analytics'\n );\n },\n getAnalytics as any\n )\n .command(\n 'analytics:post <id>',\n 'Get analytics for a specific post',\n (yargs: Argv) => {\n return yargs\n .positional('id', {\n describe: 'Post ID',\n type: 'string',\n })\n .option('date', {\n alias: 'd',\n describe: 'Number of days to look back (default: 7)',\n type: 'string',\n default: '7',\n })\n .example(\n '$0 analytics:post post-123',\n 'Get last 7 days of post analytics'\n )\n .example(\n '$0 analytics:post post-123 -d 30',\n 'Get last 30 days of post analytics'\n );\n },\n getPostAnalytics as any\n )\n .command(\n 'upload <file>',\n 'Upload a file',\n (yargs: Argv) => {\n return yargs\n .positional('file', {\n describe: 'File path to upload',\n type: 'string',\n })\n .example('$0 upload ./image.png', 'Upload an image');\n },\n uploadFile as any\n )\n .demandCommand(1, 'You need at least one command')\n .help()\n .alias('h', 'help')\n .version()\n .alias('v', 'version')\n .epilogue(\n 'For more information, visit: https://postiz.com\\n\\nSet your API key: export POSTIZ_API_KEY=your_api_key'\n )\n .parse();\n","import fetch, { FormData } from 'node-fetch';\n\nexport interface PostizConfig {\n apiKey: string;\n apiUrl?: string;\n}\n\nexport class PostizAPI {\n private apiKey: string;\n private apiUrl: string;\n\n constructor(config: PostizConfig) {\n this.apiKey = config.apiKey;\n this.apiUrl = config.apiUrl || 'https://api.postiz.com';\n }\n\n private async request(endpoint: string, options: any = {}) {\n const url = `${this.apiUrl}${endpoint}`;\n const headers = {\n 'Content-Type': 'application/json',\n Authorization: this.apiKey,\n ...options.headers,\n };\n\n try {\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`API Error (${response.status}): ${error}`);\n }\n\n return await response.json();\n } catch (error: any) {\n throw new Error(`Request failed: ${error.message}`);\n }\n }\n\n async createPost(data: any) {\n return this.request('/public/v1/posts', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n async listPosts(filters: any = {}) {\n const queryString = new URLSearchParams(\n Object.entries(filters).reduce((acc, [key, value]) => {\n if (value !== undefined && value !== null) {\n acc[key] = String(value);\n }\n return acc;\n }, {} as Record<string, string>)\n ).toString();\n\n const endpoint = queryString\n ? `/public/v1/posts?${queryString}`\n : '/public/v1/posts';\n\n return this.request(endpoint, {\n method: 'GET',\n });\n }\n\n async deletePost(id: string) {\n return this.request(`/public/v1/posts/${id}`, {\n method: 'DELETE',\n });\n }\n\n async upload(file: Buffer, filename: string) {\n const formData = new FormData();\n const extension = filename.split('.').pop()?.toLowerCase() || '';\n\n // Determine MIME type based on file extension\n const mimeTypes: Record<string, string> = {\n // Images\n 'png': 'image/png',\n 'jpg': 'image/jpeg',\n 'jpeg': 'image/jpeg',\n 'gif': 'image/gif',\n 'webp': 'image/webp',\n 'svg': 'image/svg+xml',\n 'bmp': 'image/bmp',\n 'ico': 'image/x-icon',\n\n // Videos\n 'mp4': 'video/mp4',\n 'mov': 'video/quicktime',\n 'avi': 'video/x-msvideo',\n 'mkv': 'video/x-matroska',\n 'webm': 'video/webm',\n 'flv': 'video/x-flv',\n 'wmv': 'video/x-ms-wmv',\n 'm4v': 'video/x-m4v',\n 'mpeg': 'video/mpeg',\n 'mpg': 'video/mpeg',\n '3gp': 'video/3gpp',\n\n // Audio\n 'mp3': 'audio/mpeg',\n 'wav': 'audio/wav',\n 'ogg': 'audio/ogg',\n 'aac': 'audio/aac',\n 'flac': 'audio/flac',\n 'm4a': 'audio/mp4',\n\n // Documents\n 'pdf': 'application/pdf',\n 'doc': 'application/msword',\n 'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n };\n\n const type = mimeTypes[extension] || 'application/octet-stream';\n\n const blob = new Blob([file], { type });\n formData.append('file', blob, filename);\n\n const url = `${this.apiUrl}/public/v1/upload`;\n const response = await fetch(url, {\n method: 'POST',\n // @ts-ignore\n body: formData,\n headers: {\n Authorization: this.apiKey,\n },\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Upload failed (${response.status}): ${error}`);\n }\n\n return await response.json();\n }\n\n async getMissingContent(postId: string) {\n return this.request(`/public/v1/posts/${postId}/missing`, {\n method: 'GET',\n });\n }\n\n async updateReleaseId(postId: string, releaseId: string) {\n return this.request(`/public/v1/posts/${postId}/release-id`, {\n method: 'PUT',\n body: JSON.stringify({ releaseId }),\n });\n }\n\n async getAnalytics(integrationId: string, date: string) {\n return this.request(`/public/v1/analytics/${integrationId}?date=${encodeURIComponent(date)}`, {\n method: 'GET',\n });\n }\n\n async getPostAnalytics(postId: string, date: string) {\n return this.request(`/public/v1/analytics/post/${postId}?date=${encodeURIComponent(date)}`, {\n method: 'GET',\n });\n }\n\n async listIntegrations() {\n return this.request('/public/v1/integrations', {\n method: 'GET',\n });\n }\n\n async getIntegrationSettings(integrationId: string) {\n return this.request(`/public/v1/integration-settings/${integrationId}`, {\n method: 'GET',\n });\n }\n\n async triggerIntegrationTool(\n integrationId: string,\n methodName: string,\n data: Record<string, string>\n ) {\n return this.request(`/public/v1/integration-trigger/${integrationId}`, {\n method: 'POST',\n body: JSON.stringify({ methodName, data }),\n });\n }\n}\n","import { PostizConfig } from './api';\n\nexport function getConfig(): PostizConfig {\n const apiKey = process.env.POSTIZ_API_KEY;\n const apiUrl = process.env.POSTIZ_API_URL;\n\n if (!apiKey) {\n console.error('❌ Error: POSTIZ_API_KEY environment variable is required');\n console.error('Please set it using: export POSTIZ_API_KEY=your_api_key');\n process.exit(1);\n }\n\n return {\n apiKey,\n apiUrl,\n };\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\nimport { readFileSync, existsSync } from 'fs';\n\nexport async function createPost(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n // Support both simple and complex post creation\n let postData: any;\n\n if (args.json) {\n // Load from JSON file for complex posts with comments and media\n try {\n const jsonPath = args.json;\n if (!existsSync(jsonPath)) {\n console.error(`❌ JSON file not found: ${jsonPath}`);\n process.exit(1);\n }\n const jsonContent = readFileSync(jsonPath, 'utf-8');\n postData = JSON.parse(jsonContent);\n } catch (error: any) {\n console.error('❌ Failed to parse JSON file:', error.message);\n process.exit(1);\n }\n } else {\n const integrations = args.integrations\n ? args.integrations.split(',').map((id: string) => id.trim())\n : [];\n\n if (integrations.length === 0) {\n console.error('❌ At least one integration ID is required');\n console.error('Use -i or --integrations to specify integration IDs');\n console.error('Run \"postiz integrations:list\" to see available integrations');\n process.exit(1);\n }\n\n // Support multiple -c and -m flags\n // Normalize to arrays\n const contents = Array.isArray(args.content) ? args.content : [args.content];\n const medias = Array.isArray(args.media) ? args.media : (args.media ? [args.media] : []);\n\n if (!contents[0]) {\n console.error('❌ At least one -c/--content is required');\n process.exit(1);\n }\n\n // Build value array by pairing contents with their media\n const values = contents.map((content: string, index: number) => {\n const mediaForThisContent = medias[index];\n const images = mediaForThisContent\n ? mediaForThisContent.split(',').map((img: string) => ({\n id: Math.random().toString(36).substring(7),\n path: img.trim(),\n }))\n : [];\n\n return {\n content: content,\n image: images,\n // Add delay for all items except the first (main post)\n ...(index > 0 && { delay: args.delay || 5000 }),\n };\n });\n\n // Parse provider-specific settings if provided\n // Note: __type is automatically added by the backend based on integration ID\n let settings: any = undefined;\n\n if (args.settings) {\n try {\n settings = typeof args.settings === 'string'\n ? JSON.parse(args.settings)\n : args.settings;\n } catch (error: any) {\n console.error('❌ Failed to parse settings JSON:', error.message);\n process.exit(1);\n }\n }\n\n // Build the proper post structure\n postData = {\n type: args.type || 'schedule', // 'schedule' or 'draft'\n date: args.date, // Required date field\n shortLink: args.shortLink !== false,\n tags: [],\n posts: integrations.map((integrationId: string) => ({\n integration: { id: integrationId },\n value: values,\n settings: settings,\n })),\n };\n }\n\n try {\n const result = await api.createPost(postData);\n console.log('✅ Post created successfully!');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to create post:', error.message);\n process.exit(1);\n }\n}\n\nexport async function listPosts(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n // Set default date range: last 30 days to 30 days in the future\n const defaultStartDate = new Date();\n defaultStartDate.setDate(defaultStartDate.getDate() - 30);\n\n const defaultEndDate = new Date();\n defaultEndDate.setDate(defaultEndDate.getDate() + 30);\n\n // Only send fields that are in GetPostsDto\n const filters: any = {\n startDate: args.startDate || defaultStartDate.toISOString(),\n endDate: args.endDate || defaultEndDate.toISOString(),\n };\n\n // customer is optional in the DTO\n if (args.customer) {\n filters.customer = args.customer;\n }\n\n try {\n const result = await api.listPosts(filters);\n console.log('📋 Posts:');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to list posts:', error.message);\n process.exit(1);\n }\n}\n\nexport async function deletePost(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Post ID is required');\n process.exit(1);\n }\n\n try {\n await api.deletePost(args.id);\n console.log(`✅ Post ${args.id} deleted successfully!`);\n } catch (error: any) {\n console.error('❌ Failed to delete post:', error.message);\n process.exit(1);\n }\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\n\nexport async function listIntegrations() {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n try {\n const result = await api.listIntegrations();\n console.log('🔌 Connected Integrations:');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to list integrations:', error.message);\n process.exit(1);\n }\n}\n\nexport async function getIntegrationSettings(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Integration ID is required');\n process.exit(1);\n }\n\n try {\n const result = await api.getIntegrationSettings(args.id);\n console.log(`⚙️ Settings for integration: ${args.id}`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to get integration settings:', error.message);\n process.exit(1);\n }\n}\n\nexport async function triggerIntegrationTool(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Integration ID is required');\n process.exit(1);\n }\n\n if (!args.method) {\n console.error('❌ Method name is required');\n process.exit(1);\n }\n\n // Parse data from JSON string or use empty object\n let data: Record<string, string> = {};\n if (args.data) {\n try {\n data = JSON.parse(args.data);\n } catch (error: any) {\n console.error('❌ Failed to parse data JSON:', error.message);\n process.exit(1);\n }\n }\n\n try {\n const result = await api.triggerIntegrationTool(args.id, args.method, data);\n console.log(`🔧 Tool result for ${args.method}:`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to trigger tool:', error.message);\n process.exit(1);\n }\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\n\nexport async function getAnalytics(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Integration ID is required');\n process.exit(1);\n }\n\n const date = args.date || '7';\n\n try {\n const result = await api.getAnalytics(args.id, date);\n console.log(`📊 Analytics for integration: ${args.id}`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to get analytics:', error.message);\n process.exit(1);\n }\n}\n\nexport async function getPostAnalytics(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.id) {\n console.error('❌ Post ID is required');\n process.exit(1);\n }\n\n const date = args.date || '7';\n\n try {\n const result = await api.getPostAnalytics(args.id, date);\n console.log(`📊 Analytics for post: ${args.id}`);\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to get post analytics:', error.message);\n process.exit(1);\n }\n}\n","import { PostizAPI } from '../api';\nimport { getConfig } from '../config';\nimport { readFileSync } from 'fs';\n\nexport async function uploadFile(args: any) {\n const config = getConfig();\n const api = new PostizAPI(config);\n\n if (!args.file) {\n console.error('❌ File path is required');\n process.exit(1);\n }\n\n try {\n const fileBuffer = readFileSync(args.file);\n const filename = args.file.split('/').pop() || 'file';\n\n const result = await api.upload(fileBuffer, filename);\n console.log('✅ File uploaded successfully!');\n console.log(JSON.stringify(result, null, 2));\n return result;\n } catch (error: any) {\n console.error('❌ Failed to upload file:', error.message);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mBAAkB;AAClB,qBAAwB;;;ACDxB,wBAAgC;AAOzB,IAAM,YAAN,MAAgB;AAAA,EAIrB,YAAY,QAAsB;AAChC,SAAK,SAAS,OAAO;AACrB,SAAK,SAAS,OAAO,UAAU;AAAA,EACjC;AAAA,EAEA,MAAc,QAAQ,UAAkB,UAAe,CAAC,GAAG;AACzD,UAAM,MAAM,GAAG,KAAK,MAAM,GAAG,QAAQ;AACrC,UAAM,UAAU;AAAA,MACd,gBAAgB;AAAA,MAChB,eAAe,KAAK;AAAA,OACjB,QAAQ;AAGb,QAAI;AACF,YAAM,WAAW,UAAM,kBAAAA,SAAM,KAAK,iCAC7B,UAD6B;AAAA,QAEhC;AAAA,MACF,EAAC;AAED,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,QAAQ,MAAM,SAAS,KAAK;AAClC,cAAM,IAAI,MAAM,cAAc,SA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AAAA,EACA;AAAA,EACA,CAACA,WAAgB;AACf,WAAOA,OACJ,WAAW,QAAQ;AAAA,MAClB,UAAU;AAAA,MACV,MAAM;AAAA,IACR,CAAC,EACA,QAAQ,yBAAyB,iBAAiB;AAAA,EACvD;AAAA,EACA;AACF,EACC,cAAc,GAAG,+BAA+B,EAChD,KAAK,EACL,MAAM,KAAK,MAAM,EACjB,QAAQ,EACR,MAAM,KAAK,SAAS,EACpB;AAAA,EACC;AACF,EACC,MAAM;","names":["fetch","import_fs","yargs"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postiz",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Postiz CLI - Command line interface for the Postiz social media scheduling API",
5
5
  "main": "dist/index.js",
6
6
  "bin": {