@posty5/social-publisher-workspace 1.0.0 β 1.0.1
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 +576 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,616 @@
|
|
|
1
1
|
# @posty5/social-publisher-workspace
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official Posty5 SDK for managing social media publishing workspaces. Create, manage, and organize workspaces to group your social media accounts and streamline multi-platform content distribution.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## π What is Posty5?
|
|
8
|
+
|
|
9
|
+
**Posty5** is a comprehensive suite of free online tools designed to enhance your digital marketing and social media presence. With over 4+ powerful tools and counting, Posty5 provides everything you need to:
|
|
10
|
+
|
|
11
|
+
- π **Shorten URLs** - Create memorable, trackable short links
|
|
12
|
+
- π± **Generate QR Codes** - Transform URLs, WiFi credentials, contact cards, and more into scannable codes
|
|
13
|
+
- π **Host HTML Pages** - Deploy static HTML pages with dynamic variables and form submission handling
|
|
14
|
+
- π’ **Automate Social Media** - Schedule and manage social media posts across multiple platforms
|
|
15
|
+
- π **Track Performance** - Monitor and analyze your digital marketing efforts
|
|
16
|
+
|
|
17
|
+
Posty5 empowers businesses, marketers, and developers to streamline their online workflowsβall from a unified control panel.
|
|
18
|
+
|
|
19
|
+
**Learn more:** [https://posty5.com](https://posty5.com)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## π¦ About This Package
|
|
24
|
+
|
|
25
|
+
`@posty5/social-publisher-workspace` is the **workspace management client** for the Posty5 Social Media Publisher. This package enables you to programmatically create and manage workspaces (organizations) that group your social media accounts for streamlined content distribution.
|
|
26
|
+
|
|
27
|
+
### What are Social Publisher Workspaces?
|
|
28
|
+
|
|
29
|
+
Workspaces (also called organizations) are containers that group your connected social media accounts. Each workspace can contain multiple accounts from YouTube, Facebook, Instagram, and TikTok, allowing you to manage different brands, clients, or campaigns independently.
|
|
30
|
+
|
|
31
|
+
### Key Capabilities
|
|
32
|
+
|
|
33
|
+
- **Create Workspaces** - Programmatically create new workspaces with custom names, descriptions, and logos
|
|
34
|
+
- **List & Search** - Retrieve all workspaces with pagination, filtering, and search capabilities
|
|
35
|
+
- **Update Workspaces** - Modify workspace details including name, description, and logo image
|
|
36
|
+
- **Delete Workspaces** - Remove workspaces when no longer needed
|
|
37
|
+
- **Tag & Reference System** - Organize workspaces using custom tags and reference IDs for integration with your systems
|
|
38
|
+
- **Account Management** - View connected social media accounts (YouTube, Facebook, Instagram, TikTok) within each workspace
|
|
39
|
+
- **Logo Upload** - Upload custom workspace logos with automatic image optimization
|
|
40
|
+
|
|
41
|
+
### Why Use This Package?
|
|
42
|
+
|
|
43
|
+
- **Team Collaboration**: Manage multiple clients or brands with separate workspaces
|
|
44
|
+
- **Automated Workflow**: Integrate workspace management into your content distribution pipeline
|
|
45
|
+
- **Custom Organization**: Use tags and reference IDs to map workspaces to your internal systems
|
|
46
|
+
- **Multi-Platform Support**: Group accounts from YouTube, Facebook, Instagram, and TikTok
|
|
47
|
+
- **Logo Branding**: Upload custom logos for professional workspace presentation
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## π₯ Installation
|
|
52
|
+
|
|
53
|
+
Install via npm:
|
|
6
54
|
|
|
7
55
|
```bash
|
|
8
|
-
npm install @posty5/
|
|
56
|
+
npm install @posty5/social-publisher-workspace @posty5/core
|
|
9
57
|
```
|
|
10
58
|
|
|
11
|
-
|
|
59
|
+
---
|
|
12
60
|
|
|
13
|
-
|
|
61
|
+
## π Quick Start
|
|
14
62
|
|
|
15
63
|
```typescript
|
|
16
|
-
import { HttpClient } from
|
|
17
|
-
import { SocialPublisherWorkspaceClient } from
|
|
64
|
+
import { HttpClient } from "@posty5/core";
|
|
65
|
+
import { SocialPublisherWorkspaceClient } from "@posty5/social-publisher-workspace";
|
|
18
66
|
|
|
19
|
-
//
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
67
|
+
// Initialize the HTTP client with your API key
|
|
68
|
+
const httpClient = new HttpClient({
|
|
69
|
+
apiKey: "your-api-key", // Get from studio.posty5.com/account/settings?tab=APIKeys
|
|
70
|
+
debug: true, // Optional: Enable debug logging
|
|
23
71
|
});
|
|
24
72
|
|
|
25
|
-
// Create client
|
|
26
|
-
const
|
|
73
|
+
// Create workspace client
|
|
74
|
+
const client = new SocialPublisherWorkspaceClient(httpClient);
|
|
75
|
+
|
|
76
|
+
// Create a new workspace
|
|
77
|
+
const workspaceId = await client.create({
|
|
78
|
+
name: "My Brand Workspace",
|
|
79
|
+
description: "Workspace for managing social media accounts",
|
|
80
|
+
tag: "brand-2024", // Optional: Custom tag for filtering
|
|
81
|
+
refId: "WORKSPACE-001", // Optional: Your internal reference ID
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
console.log("Created workspace:", workspaceId);
|
|
85
|
+
|
|
86
|
+
// Get workspace details
|
|
87
|
+
const workspace = await client.get(workspaceId);
|
|
88
|
+
console.log("Workspace:", workspace.name);
|
|
89
|
+
console.log("Connected accounts:", workspace.account);
|
|
90
|
+
|
|
91
|
+
// List all workspaces
|
|
92
|
+
const workspaces = await client.list(
|
|
93
|
+
{},
|
|
94
|
+
{
|
|
95
|
+
page: 1,
|
|
96
|
+
pageSize: 10,
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
console.log(`Found ${workspaces.pagination.totalCount} workspaces`);
|
|
27
101
|
```
|
|
28
102
|
|
|
29
|
-
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## π API Reference & Examples
|
|
106
|
+
|
|
107
|
+
### create()
|
|
108
|
+
|
|
109
|
+
Create a new social media workspace with optional logo image upload.
|
|
110
|
+
|
|
111
|
+
**Parameters:**
|
|
112
|
+
|
|
113
|
+
- `data` (ICreateWorkspaceRequest): Workspace configuration
|
|
114
|
+
- `name` (string): Workspace name
|
|
115
|
+
- `description` (string): Workspace description
|
|
116
|
+
- `tag` (string, optional): Custom tag for filtering
|
|
117
|
+
- `refId` (string, optional): Your internal reference ID
|
|
118
|
+
- `logo` (File | Blob, optional): Logo image file (PNG, JPG, or WebP)
|
|
119
|
+
|
|
120
|
+
**Returns:** `Promise<string>` - Created workspace ID
|
|
121
|
+
|
|
122
|
+
**Example:**
|
|
30
123
|
|
|
31
124
|
```typescript
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
125
|
+
// Create workspace without logo
|
|
126
|
+
const workspaceId = await client.create({
|
|
127
|
+
name: "Client A - Social Media",
|
|
128
|
+
description: "Managing social accounts for Client A",
|
|
129
|
+
tag: "client-a",
|
|
130
|
+
refId: "CLIENT-A-WS-001",
|
|
35
131
|
});
|
|
36
|
-
|
|
132
|
+
|
|
133
|
+
console.log("Workspace created:", workspaceId);
|
|
134
|
+
|
|
135
|
+
// Create workspace with logo upload
|
|
136
|
+
import * as fs from "fs";
|
|
137
|
+
|
|
138
|
+
const logoFile = fs.readFileSync("./logo.png");
|
|
139
|
+
const logoBlob = new Blob([logoFile], { type: "image/png" });
|
|
140
|
+
const logo = new File([logoBlob], "logo.png", { type: "image/png" });
|
|
141
|
+
|
|
142
|
+
const workspaceWithLogo = await client.create(
|
|
143
|
+
{
|
|
144
|
+
name: "Brand Workspace",
|
|
145
|
+
description: "Workspace with custom branding",
|
|
146
|
+
},
|
|
147
|
+
logo,
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
console.log("Workspace with logo:", workspaceWithLogo);
|
|
37
151
|
```
|
|
38
152
|
|
|
39
|
-
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### get()
|
|
156
|
+
|
|
157
|
+
Retrieve detailed information about a specific workspace by ID.
|
|
158
|
+
|
|
159
|
+
**Parameters:**
|
|
160
|
+
|
|
161
|
+
- `id` (string): Workspace ID
|
|
162
|
+
|
|
163
|
+
**Returns:** `Promise<IWorkspaceResponse>` - Workspace details including connected accounts
|
|
164
|
+
|
|
165
|
+
**Response Structure:**
|
|
40
166
|
|
|
41
167
|
```typescript
|
|
42
|
-
|
|
43
|
-
|
|
168
|
+
{
|
|
169
|
+
_id: string; // Workspace ID
|
|
170
|
+
name: string; // Workspace name
|
|
171
|
+
account: { // Connected social media accounts
|
|
172
|
+
youtube?: { // YouTube account (if connected)
|
|
173
|
+
link: string; // Account URL
|
|
174
|
+
name: string; // Channel name
|
|
175
|
+
thumbnail: string; // Channel thumbnail
|
|
176
|
+
platformAccountId: string; // YouTube channel ID
|
|
177
|
+
status: 'active' | 'inactive' | 'authenticationExpired';
|
|
178
|
+
};
|
|
179
|
+
facebook?: { /* ... */ }; // Facebook page account
|
|
180
|
+
instagram?: { /* ... */ }; // Instagram account
|
|
181
|
+
tiktok?: { /* ... */ }; // TikTok account
|
|
182
|
+
};
|
|
183
|
+
}
|
|
44
184
|
```
|
|
45
185
|
|
|
46
|
-
|
|
186
|
+
**Example:**
|
|
47
187
|
|
|
48
188
|
```typescript
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
189
|
+
// Get workspace details
|
|
190
|
+
const workspace = await client.get("workspace-id-here");
|
|
191
|
+
|
|
192
|
+
console.log("Workspace:", workspace.name);
|
|
193
|
+
|
|
194
|
+
// Check connected accounts
|
|
195
|
+
if (workspace.account.youtube) {
|
|
196
|
+
console.log("YouTube channel:", workspace.account.youtube.name);
|
|
197
|
+
console.log("Status:", workspace.account.youtube.status);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (workspace.account.tiktok) {
|
|
201
|
+
console.log("TikTok account:", workspace.account.tiktok.name);
|
|
202
|
+
console.log("Profile:", workspace.account.tiktok.link);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Handle authentication expiration
|
|
206
|
+
for (const [platform, account] of Object.entries(workspace.account)) {
|
|
207
|
+
if (account && account.status === "authenticationExpired") {
|
|
208
|
+
console.warn(`${platform} account needs re-authentication`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### list()
|
|
216
|
+
|
|
217
|
+
Search and retrieve workspaces with pagination and filtering options.
|
|
218
|
+
|
|
219
|
+
**Parameters:**
|
|
220
|
+
|
|
221
|
+
- `params` (IListParams, optional): Search and filter options
|
|
222
|
+
- `name` (string, optional): Filter by workspace name (partial match)
|
|
223
|
+
- `description` (string, optional): Filter by description (partial match)
|
|
224
|
+
- `tag` (string, optional): Filter by custom tag
|
|
225
|
+
- `refId` (string, optional): Filter by reference ID
|
|
226
|
+
- `apiKeyId` (string, optional): Filter by API key
|
|
227
|
+
- `pagination` (IPaginationParams, optional): Pagination settings
|
|
228
|
+
- `page` (number): Page number (default: 1)
|
|
229
|
+
- `pageSize` (number): Items per page (default: 10)
|
|
230
|
+
|
|
231
|
+
**Returns:** `Promise<ISearchWorkspaceResponse>` - Paginated workspace list
|
|
232
|
+
|
|
233
|
+
**Response Structure:**
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
{
|
|
237
|
+
items: Array<{
|
|
238
|
+
_id: string; // Workspace ID
|
|
239
|
+
name: string; // Workspace name
|
|
240
|
+
description: string; // Workspace description
|
|
241
|
+
imageUrl?: string; // Logo URL (if uploaded)
|
|
242
|
+
createdAt: string; // Creation timestamp
|
|
243
|
+
}>;
|
|
244
|
+
pagination: {
|
|
245
|
+
page: number; // Current page
|
|
246
|
+
pageSize: number; // Items per page
|
|
247
|
+
totalCount: number; // Total workspaces
|
|
248
|
+
totalPages: number; // Total pages
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Example:**
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
// Get all workspaces with pagination
|
|
257
|
+
const allWorkspaces = await client.list(
|
|
258
|
+
{},
|
|
259
|
+
{
|
|
260
|
+
page: 1,
|
|
261
|
+
pageSize: 20,
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
console.log(`Total workspaces: ${allWorkspaces.pagination.totalCount}`);
|
|
266
|
+
console.log(`Showing page ${allWorkspaces.pagination.page} of ${allWorkspaces.pagination.totalPages}`);
|
|
267
|
+
|
|
268
|
+
// Display workspaces
|
|
269
|
+
allWorkspaces.items.forEach((workspace) => {
|
|
270
|
+
console.log(`- ${workspace.name}: ${workspace.description}`);
|
|
52
271
|
});
|
|
272
|
+
|
|
273
|
+
// Search by name
|
|
274
|
+
const searchResults = await client.list(
|
|
275
|
+
{
|
|
276
|
+
name: "brand", // Finds workspaces with "brand" in the name
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
page: 1,
|
|
280
|
+
pageSize: 10,
|
|
281
|
+
},
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
console.log(`Found ${searchResults.items.length} matching workspaces`);
|
|
285
|
+
|
|
286
|
+
// Filter by tag
|
|
287
|
+
const clientWorkspaces = await client.list(
|
|
288
|
+
{
|
|
289
|
+
tag: "client-a", // Get all workspaces tagged with 'client-a'
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
page: 1,
|
|
293
|
+
pageSize: 50,
|
|
294
|
+
},
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
console.log(`Client A has ${clientWorkspaces.items.length} workspaces`);
|
|
298
|
+
|
|
299
|
+
// Filter by reference ID
|
|
300
|
+
const specificWorkspace = await client.list(
|
|
301
|
+
{
|
|
302
|
+
refId: "WORKSPACE-001", // Find workspace by your internal ID
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
page: 1,
|
|
306
|
+
pageSize: 1,
|
|
307
|
+
},
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
if (specificWorkspace.items.length > 0) {
|
|
311
|
+
console.log("Found workspace:", specificWorkspace.items[0].name);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Pagination example - fetch all pages
|
|
315
|
+
async function getAllWorkspaces() {
|
|
316
|
+
const allItems = [];
|
|
317
|
+
let page = 1;
|
|
318
|
+
let totalPages = 1;
|
|
319
|
+
|
|
320
|
+
while (page <= totalPages) {
|
|
321
|
+
const result = await client.list({}, { page, pageSize: 50 });
|
|
322
|
+
allItems.push(...result.items);
|
|
323
|
+
totalPages = result.pagination.totalPages;
|
|
324
|
+
page++;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return allItems;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const allMyWorkspaces = await getAllWorkspaces();
|
|
331
|
+
console.log(`Total workspaces: ${allMyWorkspaces.length}`);
|
|
53
332
|
```
|
|
54
333
|
|
|
55
|
-
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### update()
|
|
337
|
+
|
|
338
|
+
Update workspace details including name, description, and optional logo image.
|
|
339
|
+
|
|
340
|
+
**Parameters:**
|
|
341
|
+
|
|
342
|
+
- `id` (string): Workspace ID to update
|
|
343
|
+
- `data` (IUpdateWorkspaceRequest): Updated workspace data
|
|
344
|
+
- `name` (string): New workspace name
|
|
345
|
+
- `description` (string): New workspace description
|
|
346
|
+
- `tag` (string, optional): Updated custom tag
|
|
347
|
+
- `refId` (string, optional): Updated reference ID
|
|
348
|
+
- `logo` (File | Blob, optional): New logo image file
|
|
349
|
+
|
|
350
|
+
**Returns:** `Promise<void>` - No return value on success
|
|
351
|
+
|
|
352
|
+
**Example:**
|
|
56
353
|
|
|
57
354
|
```typescript
|
|
58
|
-
|
|
355
|
+
// Update workspace name and description
|
|
356
|
+
await client.update("workspace-id", {
|
|
357
|
+
name: "Updated Workspace Name",
|
|
358
|
+
description: "New description for this workspace",
|
|
359
|
+
tag: "updated-tag",
|
|
360
|
+
refId: "NEW-REF-ID",
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
console.log("Workspace updated successfully");
|
|
364
|
+
|
|
365
|
+
// Update with new logo
|
|
366
|
+
import * as fs from "fs";
|
|
367
|
+
|
|
368
|
+
const newLogoFile = fs.readFileSync("./new-logo.png");
|
|
369
|
+
const newLogoBlob = new Blob([newLogoFile], { type: "image/png" });
|
|
370
|
+
const newLogo = new File([newLogoBlob], "new-logo.png", { type: "image/png" });
|
|
371
|
+
|
|
372
|
+
await client.update(
|
|
373
|
+
"workspace-id",
|
|
374
|
+
{
|
|
375
|
+
name: "Workspace with New Logo",
|
|
376
|
+
description: "Updated branding",
|
|
377
|
+
},
|
|
378
|
+
newLogo,
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
console.log("Workspace and logo updated");
|
|
382
|
+
|
|
383
|
+
// Update only specific fields
|
|
384
|
+
await client.update("workspace-id", {
|
|
385
|
+
name: "New Name",
|
|
386
|
+
description: "New Description",
|
|
387
|
+
// tag and refId remain unchanged
|
|
388
|
+
});
|
|
59
389
|
```
|
|
60
390
|
|
|
61
|
-
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
### delete()
|
|
394
|
+
|
|
395
|
+
Delete a workspace. Note: This will remove the workspace and all its settings, but connected social media accounts will remain in your account.
|
|
396
|
+
|
|
397
|
+
**Parameters:**
|
|
398
|
+
|
|
399
|
+
- `id` (string): Workspace ID to delete
|
|
400
|
+
|
|
401
|
+
**Returns:** `Promise<void>` - No return value on success
|
|
402
|
+
|
|
403
|
+
**Example:**
|
|
62
404
|
|
|
63
405
|
```typescript
|
|
64
|
-
|
|
65
|
-
|
|
406
|
+
// Delete workspace
|
|
407
|
+
await client.delete("workspace-id-to-delete");
|
|
408
|
+
console.log("Workspace deleted successfully");
|
|
409
|
+
|
|
410
|
+
// Delete with error handling
|
|
411
|
+
try {
|
|
412
|
+
await client.delete("workspace-id");
|
|
413
|
+
console.log("Workspace deleted");
|
|
414
|
+
} catch (error) {
|
|
415
|
+
if (error instanceof NotFoundError) {
|
|
416
|
+
console.error("Workspace not found");
|
|
417
|
+
} else {
|
|
418
|
+
console.error("Failed to delete workspace:", error.message);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Delete workspace and verify
|
|
423
|
+
const workspaceId = "workspace-to-delete";
|
|
424
|
+
|
|
425
|
+
await client.delete(workspaceId);
|
|
426
|
+
|
|
427
|
+
// Try to get it (should throw NotFoundError)
|
|
428
|
+
try {
|
|
429
|
+
await client.get(workspaceId);
|
|
430
|
+
console.error("Workspace still exists!");
|
|
431
|
+
} catch (error) {
|
|
432
|
+
console.log("Workspace successfully deleted");
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## π Complete Workflow Example
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
import { HttpClient } from "@posty5/core";
|
|
442
|
+
import { SocialPublisherWorkspaceClient } from "@posty5/social-publisher-workspace";
|
|
443
|
+
|
|
444
|
+
// Initialize client
|
|
445
|
+
const httpClient = new HttpClient({
|
|
446
|
+
apiKey: process.env.POSTY5_API_KEY!,
|
|
447
|
+
debug: false,
|
|
66
448
|
});
|
|
67
449
|
|
|
68
|
-
|
|
450
|
+
const client = new SocialPublisherWorkspaceClient(httpClient);
|
|
451
|
+
|
|
452
|
+
async function manageWorkspaces() {
|
|
453
|
+
try {
|
|
454
|
+
// 1. Create a new workspace
|
|
455
|
+
console.log("Creating workspace...");
|
|
456
|
+
const workspaceId = await client.create({
|
|
457
|
+
name: "E-commerce Brand 2024",
|
|
458
|
+
description: "Social media accounts for our e-commerce store",
|
|
459
|
+
tag: "ecommerce",
|
|
460
|
+
refId: "ECOM-WS-001",
|
|
461
|
+
});
|
|
462
|
+
console.log("β Created workspace:", workspaceId);
|
|
463
|
+
|
|
464
|
+
// 2. Get workspace details
|
|
465
|
+
console.log("\nFetching workspace details...");
|
|
466
|
+
const workspace = await client.get(workspaceId);
|
|
467
|
+
console.log("β Workspace:", workspace.name);
|
|
468
|
+
console.log(" Connected accounts:");
|
|
469
|
+
|
|
470
|
+
if (workspace.account.youtube) {
|
|
471
|
+
console.log(` - YouTube: ${workspace.account.youtube.name}`);
|
|
472
|
+
}
|
|
473
|
+
if (workspace.account.tiktok) {
|
|
474
|
+
console.log(` - TikTok: ${workspace.account.tiktok.name}`);
|
|
475
|
+
}
|
|
476
|
+
if (workspace.account.facebook) {
|
|
477
|
+
console.log(` - Facebook: ${workspace.account.facebook.name}`);
|
|
478
|
+
}
|
|
479
|
+
if (workspace.account.instagram) {
|
|
480
|
+
console.log(` - Instagram: ${workspace.account.instagram.name}`);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// 3. List all workspaces for this tag
|
|
484
|
+
console.log("\nListing all e-commerce workspaces...");
|
|
485
|
+
const workspaces = await client.list(
|
|
486
|
+
{
|
|
487
|
+
tag: "ecommerce",
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
page: 1,
|
|
491
|
+
pageSize: 10,
|
|
492
|
+
},
|
|
493
|
+
);
|
|
494
|
+
console.log(`β Found ${workspaces.pagination.totalCount} workspaces`);
|
|
495
|
+
|
|
496
|
+
// 4. Update workspace
|
|
497
|
+
console.log("\nUpdating workspace...");
|
|
498
|
+
await client.update(workspaceId, {
|
|
499
|
+
name: "E-commerce Brand 2024 (Updated)",
|
|
500
|
+
description: "Updated description",
|
|
501
|
+
tag: "ecommerce",
|
|
502
|
+
refId: "ECOM-WS-001",
|
|
503
|
+
});
|
|
504
|
+
console.log("β Workspace updated");
|
|
505
|
+
|
|
506
|
+
// 5. Delete workspace
|
|
507
|
+
console.log("\nDeleting workspace...");
|
|
508
|
+
await client.delete(workspaceId);
|
|
509
|
+
console.log("β Workspace deleted");
|
|
510
|
+
} catch (error) {
|
|
511
|
+
console.error("Error:", error.message);
|
|
512
|
+
throw error;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Run the workflow
|
|
517
|
+
manageWorkspaces();
|
|
69
518
|
```
|
|
70
519
|
|
|
71
|
-
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## π TypeScript Support
|
|
523
|
+
|
|
524
|
+
Full TypeScript support with exported interfaces:
|
|
525
|
+
|
|
526
|
+
```typescript
|
|
527
|
+
import {
|
|
528
|
+
// Client
|
|
529
|
+
SocialPublisherWorkspaceClient,
|
|
530
|
+
|
|
531
|
+
// Request interfaces
|
|
532
|
+
ICreateWorkspaceRequest,
|
|
533
|
+
IUpdateWorkspaceRequest,
|
|
534
|
+
IListParams,
|
|
535
|
+
|
|
536
|
+
// Response interfaces
|
|
537
|
+
IWorkspaceResponse,
|
|
538
|
+
ISearchWorkspaceResponse,
|
|
539
|
+
IWorkspaceAccount,
|
|
540
|
+
IAccountSampleDetails,
|
|
541
|
+
IWorkspaceSampleDetails,
|
|
542
|
+
|
|
543
|
+
// Types
|
|
544
|
+
SocialPublisherAccountStatusType, // 'active' | 'inactive' | 'authenticationExpired'
|
|
545
|
+
} from "@posty5/social-publisher-workspace";
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## π¦ Related Packages
|
|
551
|
+
|
|
552
|
+
This SDK ecosystem contains the following tool packages:
|
|
553
|
+
|
|
554
|
+
| Package | Description | Version | GitHub | NPM |
|
|
555
|
+
| --- | --- | --- | --- | --- |
|
|
556
|
+
| @posty5/short-link | URL shortener client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-short-link) | [π¦ NPM](https://www.npmjs.com/package/@posty5/short-link) |
|
|
557
|
+
| @posty5/qr-code | QR code generator client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-qr-code) | [π¦ NPM](https://www.npmjs.com/package/@posty5/qr-code) |
|
|
558
|
+
| @posty5/html-hosting | HTML hosting client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-html-hosting) | [π¦ NPM](https://www.npmjs.com/package/@posty5/html-hosting) |
|
|
559
|
+
| @posty5/html-hosting-variables | HTML hosting variables client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-html-hosting-variables) | [π¦ NPM](https://www.npmjs.com/package/@posty5/html-hosting-variables) |
|
|
560
|
+
| @posty5/html-hosting-form-submission | Form submission client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-html-hosting-form-submission) | [π¦ NPM](https://www.npmjs.com/package/@posty5/html-hosting-form-submission) |
|
|
561
|
+
| @posty5/social-publisher-workspace | Social publisher workspace client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-social-publisher-workspace) | [π¦ NPM](https://www.npmjs.com/package/@posty5/social-publisher-workspace) |
|
|
562
|
+
| @posty5/social-publisher-task | Social publisher task client | 1.0.0 | [π Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-social-publisher-task) | [π¦ NPM](https://www.npmjs.com/package/@posty5/social-publisher-task) |
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## π» Node.js Compatibility
|
|
567
|
+
|
|
568
|
+
- **Node.js**: >= 16.0.0
|
|
569
|
+
- **Module Systems**: ESM and CommonJS
|
|
570
|
+
- **TypeScript**: Full type definitions included
|
|
571
|
+
|
|
572
|
+
---
|
|
573
|
+
|
|
574
|
+
## π Support
|
|
575
|
+
|
|
576
|
+
We're here to help you succeed with Posty5!
|
|
577
|
+
|
|
578
|
+
### Get Help
|
|
579
|
+
|
|
580
|
+
- **Documentation**: [https://guide.posty5.com](https://guide.posty5.com)
|
|
581
|
+
- **Contact Us**: [https://posty5.com/contact-us](https://posty5.com/contact-us)
|
|
582
|
+
- **GitHub Issues**: [Report bugs or request features](https://github.com/Posty5/npm-sdk/issues)
|
|
583
|
+
- **API Status**: Check API status and uptime at [https://status.posty5.com](https://status.posty5.com)
|
|
584
|
+
|
|
585
|
+
### Common Issues
|
|
586
|
+
|
|
587
|
+
1. **Authentication Errors**
|
|
588
|
+
- Ensure your API key is valid and active
|
|
589
|
+
- Get your API key from [studio.posty5.com/account/settings?tab=APIKeys](studio.posty5.com/account/settings?tab=APIKeys)
|
|
590
|
+
|
|
591
|
+
2. **Network Errors**
|
|
592
|
+
- Check your internet connection
|
|
593
|
+
- Verify firewall settings allow connections to `api.posty5.com`
|
|
594
|
+
|
|
595
|
+
3. **Rate Limiting**
|
|
596
|
+
- The SDK includes automatic retry logic
|
|
597
|
+
- Check your API plan limits in the dashboard
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## π License
|
|
602
|
+
|
|
603
|
+
MIT License - see [LICENSE](./LICENSE) file for details.
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## π Useful Links
|
|
608
|
+
|
|
609
|
+
- **Website**: [https://posty5.com](https://posty5.com)
|
|
610
|
+
- **Dashboard**: [studio.posty5.com/account/settings?tab=APIKeys](studio.posty5.com/account/settings?tab=APIKeys)
|
|
611
|
+
- **API Documentation**: [https://docs.posty5.com](https://docs.posty5.com)
|
|
612
|
+
- **GitHub**: [https://github.com/Posty5/npm-sdk](https://github.com/Posty5/npm-sdk)
|
|
613
|
+
|
|
614
|
+
---
|
|
72
615
|
|
|
73
|
-
|
|
616
|
+
Made with β€οΈ by the Posty5 team
|