@posty5/social-publisher-workspace 1.0.2 → 3.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/README.md +1 -1
- package/dist/index.d.mts +30 -9
- package/dist/index.d.ts +30 -9
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -559,7 +559,7 @@ This SDK ecosystem contains the following tool packages:
|
|
|
559
559
|
| @posty5/html-hosting-variables | HTML hosting variables client | 1.0.2 | [📖 Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-html-hosting-variables) | [📦 NPM](https://www.npmjs.com/package/@posty5/html-hosting-variables) |
|
|
560
560
|
| @posty5/html-hosting-form-submission | Form submission client | 1.0.2 | [📖 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
561
|
| @posty5/social-publisher-workspace | Social publisher workspace client | 1.0.2 | [📖 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-
|
|
562
|
+
| @posty5/social-publisher-post | Social publisher post client | 1.0.2 | [📖 Docs](https://github.com/Posty5/npm-sdk/tree/main/posty5-social-publisher-post) | [📦 NPM](https://www.npmjs.com/package/@posty5/social-publisher-post) |
|
|
563
563
|
|
|
564
564
|
---
|
|
565
565
|
|
package/dist/index.d.mts
CHANGED
|
@@ -21,11 +21,6 @@ type IUpdateWorkspaceRequest = IWorkspaceRequest;
|
|
|
21
21
|
interface IListParams {
|
|
22
22
|
name?: string;
|
|
23
23
|
description?: string;
|
|
24
|
-
/**
|
|
25
|
-
* API Key ID (optional)
|
|
26
|
-
* You can use this field to filter workspaces by API key
|
|
27
|
-
*/
|
|
28
|
-
apiKeyId?: string;
|
|
29
24
|
/**
|
|
30
25
|
* Tag (optional)
|
|
31
26
|
* You can use this field to filter workspaces by tag
|
|
@@ -51,12 +46,12 @@ interface IWorkspaceAccount {
|
|
|
51
46
|
facebook?: IAccountSampleDetails | any;
|
|
52
47
|
instagram?: IAccountSampleDetails | any;
|
|
53
48
|
tiktok?: IAccountSampleDetails | any;
|
|
54
|
-
facebookPlatformPageId?: string;
|
|
55
|
-
instagramPlatformAccountId?: string;
|
|
56
49
|
}
|
|
57
50
|
interface IWorkspaceResponse {
|
|
58
51
|
_id: string;
|
|
59
52
|
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
imageUrl?: string;
|
|
60
55
|
account: IWorkspaceAccount;
|
|
61
56
|
}
|
|
62
57
|
interface IWorkspaceSampleDetails {
|
|
@@ -64,7 +59,10 @@ interface IWorkspaceSampleDetails {
|
|
|
64
59
|
name: string;
|
|
65
60
|
description: string;
|
|
66
61
|
imageUrl?: string;
|
|
67
|
-
createdAt
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt?: string;
|
|
64
|
+
refId?: string;
|
|
65
|
+
tag: string;
|
|
68
66
|
}
|
|
69
67
|
/**
|
|
70
68
|
* Upload image configuration returned by API
|
|
@@ -86,6 +84,16 @@ type IUpdateWorkspaceResponse = IWorkspaceWithUploadConfig;
|
|
|
86
84
|
interface IDeleteWorkspaceResponse {
|
|
87
85
|
message?: string;
|
|
88
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Workspace details formatted for new post creation with populated accounts
|
|
89
|
+
*/
|
|
90
|
+
interface IWorkspaceForNewPostResponse {
|
|
91
|
+
_id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
imageUrl?: string;
|
|
95
|
+
account: IWorkspaceAccount;
|
|
96
|
+
}
|
|
89
97
|
|
|
90
98
|
/**
|
|
91
99
|
* Social Publisher Workspace Client
|
|
@@ -109,6 +117,19 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
109
117
|
* @param id - Workspace ID
|
|
110
118
|
*/
|
|
111
119
|
get(id: string): Promise<IWorkspaceResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Get workspace details for creating new post
|
|
122
|
+
* @param id - Workspace ID
|
|
123
|
+
* @returns Workspace details with populated account information
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
128
|
+
* console.log(workspace.account.youtube); // YouTube account details
|
|
129
|
+
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
getForNewPost(id: string): Promise<IWorkspaceForNewPostResponse>;
|
|
112
133
|
/**
|
|
113
134
|
* Create workspace with optional image upload
|
|
114
135
|
* @param data - Workspace data
|
|
@@ -153,4 +174,4 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
153
174
|
delete(id: string): Promise<void>;
|
|
154
175
|
}
|
|
155
176
|
|
|
156
|
-
export { type IAccountSampleDetails, type ICreateWorkspaceRequest, type ICreateWorkspaceResponse, type IDeleteWorkspaceResponse, type IListParams, type ISearchWorkspaceResponse, type IUpdateWorkspaceRequest, type IUpdateWorkspaceResponse, type IUploadImageConfig, type IWorkspaceAccount, type IWorkspaceRequest, type IWorkspaceResponse, type IWorkspaceSampleDetails, type IWorkspaceWithUploadConfig, type SocialPublisherAccountStatusType, SocialPublisherWorkspaceClient };
|
|
177
|
+
export { type IAccountSampleDetails, type ICreateWorkspaceRequest, type ICreateWorkspaceResponse, type IDeleteWorkspaceResponse, type IListParams, type ISearchWorkspaceResponse, type IUpdateWorkspaceRequest, type IUpdateWorkspaceResponse, type IUploadImageConfig, type IWorkspaceAccount, type IWorkspaceForNewPostResponse, type IWorkspaceRequest, type IWorkspaceResponse, type IWorkspaceSampleDetails, type IWorkspaceWithUploadConfig, type SocialPublisherAccountStatusType, SocialPublisherWorkspaceClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,11 +21,6 @@ type IUpdateWorkspaceRequest = IWorkspaceRequest;
|
|
|
21
21
|
interface IListParams {
|
|
22
22
|
name?: string;
|
|
23
23
|
description?: string;
|
|
24
|
-
/**
|
|
25
|
-
* API Key ID (optional)
|
|
26
|
-
* You can use this field to filter workspaces by API key
|
|
27
|
-
*/
|
|
28
|
-
apiKeyId?: string;
|
|
29
24
|
/**
|
|
30
25
|
* Tag (optional)
|
|
31
26
|
* You can use this field to filter workspaces by tag
|
|
@@ -51,12 +46,12 @@ interface IWorkspaceAccount {
|
|
|
51
46
|
facebook?: IAccountSampleDetails | any;
|
|
52
47
|
instagram?: IAccountSampleDetails | any;
|
|
53
48
|
tiktok?: IAccountSampleDetails | any;
|
|
54
|
-
facebookPlatformPageId?: string;
|
|
55
|
-
instagramPlatformAccountId?: string;
|
|
56
49
|
}
|
|
57
50
|
interface IWorkspaceResponse {
|
|
58
51
|
_id: string;
|
|
59
52
|
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
imageUrl?: string;
|
|
60
55
|
account: IWorkspaceAccount;
|
|
61
56
|
}
|
|
62
57
|
interface IWorkspaceSampleDetails {
|
|
@@ -64,7 +59,10 @@ interface IWorkspaceSampleDetails {
|
|
|
64
59
|
name: string;
|
|
65
60
|
description: string;
|
|
66
61
|
imageUrl?: string;
|
|
67
|
-
createdAt
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt?: string;
|
|
64
|
+
refId?: string;
|
|
65
|
+
tag: string;
|
|
68
66
|
}
|
|
69
67
|
/**
|
|
70
68
|
* Upload image configuration returned by API
|
|
@@ -86,6 +84,16 @@ type IUpdateWorkspaceResponse = IWorkspaceWithUploadConfig;
|
|
|
86
84
|
interface IDeleteWorkspaceResponse {
|
|
87
85
|
message?: string;
|
|
88
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Workspace details formatted for new post creation with populated accounts
|
|
89
|
+
*/
|
|
90
|
+
interface IWorkspaceForNewPostResponse {
|
|
91
|
+
_id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
imageUrl?: string;
|
|
95
|
+
account: IWorkspaceAccount;
|
|
96
|
+
}
|
|
89
97
|
|
|
90
98
|
/**
|
|
91
99
|
* Social Publisher Workspace Client
|
|
@@ -109,6 +117,19 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
109
117
|
* @param id - Workspace ID
|
|
110
118
|
*/
|
|
111
119
|
get(id: string): Promise<IWorkspaceResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Get workspace details for creating new post
|
|
122
|
+
* @param id - Workspace ID
|
|
123
|
+
* @returns Workspace details with populated account information
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
128
|
+
* console.log(workspace.account.youtube); // YouTube account details
|
|
129
|
+
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
getForNewPost(id: string): Promise<IWorkspaceForNewPostResponse>;
|
|
112
133
|
/**
|
|
113
134
|
* Create workspace with optional image upload
|
|
114
135
|
* @param data - Workspace data
|
|
@@ -153,4 +174,4 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
153
174
|
delete(id: string): Promise<void>;
|
|
154
175
|
}
|
|
155
176
|
|
|
156
|
-
export { type IAccountSampleDetails, type ICreateWorkspaceRequest, type ICreateWorkspaceResponse, type IDeleteWorkspaceResponse, type IListParams, type ISearchWorkspaceResponse, type IUpdateWorkspaceRequest, type IUpdateWorkspaceResponse, type IUploadImageConfig, type IWorkspaceAccount, type IWorkspaceRequest, type IWorkspaceResponse, type IWorkspaceSampleDetails, type IWorkspaceWithUploadConfig, type SocialPublisherAccountStatusType, SocialPublisherWorkspaceClient };
|
|
177
|
+
export { type IAccountSampleDetails, type ICreateWorkspaceRequest, type ICreateWorkspaceResponse, type IDeleteWorkspaceResponse, type IListParams, type ISearchWorkspaceResponse, type IUpdateWorkspaceRequest, type IUpdateWorkspaceResponse, type IUploadImageConfig, type IWorkspaceAccount, type IWorkspaceForNewPostResponse, type IWorkspaceRequest, type IWorkspaceResponse, type IWorkspaceSampleDetails, type IWorkspaceWithUploadConfig, type SocialPublisherAccountStatusType, SocialPublisherWorkspaceClient };
|
package/dist/index.js
CHANGED
|
@@ -34,17 +34,33 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
34
34
|
const response = await this.http.get(`${this.basePath}/${id}`);
|
|
35
35
|
return response.result;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Get workspace details for creating new post
|
|
39
|
+
* @param id - Workspace ID
|
|
40
|
+
* @returns Workspace details with populated account information
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
45
|
+
* console.log(workspace.account.youtube); // YouTube account details
|
|
46
|
+
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
async getForNewPost(id) {
|
|
50
|
+
const response = await this.http.get(`${this.basePath}/${id}/for-new-post`);
|
|
51
|
+
return response.result;
|
|
52
|
+
}
|
|
37
53
|
/**
|
|
38
54
|
* Create workspace with optional image upload
|
|
39
55
|
* @param data - Workspace data
|
|
40
56
|
* @param logo - Optional image file (File or Blob)
|
|
41
57
|
* @returns Workspace details
|
|
42
|
-
*
|
|
58
|
+
*
|
|
43
59
|
* @example
|
|
44
60
|
* ```typescript
|
|
45
61
|
* // Create without image
|
|
46
62
|
* const workspace = await client.create({ name: 'My Workspace', description: 'Description' });
|
|
47
|
-
*
|
|
63
|
+
*
|
|
48
64
|
* // Create with image
|
|
49
65
|
* const file = new File([imageBlob], 'logo.png', { type: 'image/png' });
|
|
50
66
|
* const workspace = await client.create(
|
|
@@ -75,12 +91,12 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
75
91
|
* @param data - Workspace data
|
|
76
92
|
* @param logo - Optional new image file (File or Blob)
|
|
77
93
|
* @returns Workspace details
|
|
78
|
-
*
|
|
94
|
+
*
|
|
79
95
|
* @example
|
|
80
96
|
* ```typescript
|
|
81
97
|
* // Update without changing image
|
|
82
98
|
* await client.update('workspace-id', { name: 'New Name', description: 'New Description' });
|
|
83
|
-
*
|
|
99
|
+
*
|
|
84
100
|
* // Update with new image
|
|
85
101
|
* const file = new File([imageBlob], 'new-logo.png', { type: 'image/png' });
|
|
86
102
|
* await client.update(
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/social-publisher-workspace.client.ts"],"names":["uploadToR2"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../src/social-publisher-workspace.client.ts"],"names":["uploadToR2"],"mappings":";;;;;AAgBO,IAAM,iCAAN,MAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ1C,YAAY,IAAA,EAAkB;AAN9B,IAAA,IAAA,CAAQ,QAAA,GAAW,iCAAA;AAOjB,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,IAAA,CAAK,MAAA,EAAsB,UAAA,EAAmE;AAClG,IAAA,MAAM,WAAW,MAAM,IAAA,CAAK,IAAA,CAAK,GAAA,CAA8B,KAAK,QAAA,EAAU;AAAA,MAC5E,MAAA,EAAQ;AAAA,QACN,GAAG,MAAA;AAAA,QACH,GAAG;AAAA;AACL,KACD,CAAA;AACD,IAAA,OAAO,QAAA,CAAS,MAAA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,EAAA,EAAyC;AACjD,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,IAAA,CAAK,GAAA,CAAwB,GAAG,IAAA,CAAK,QAAQ,CAAA,CAAA,EAAI,EAAE,CAAA,CAAE,CAAA;AACjF,IAAA,OAAO,QAAA,CAAS,MAAA;AAAA,E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AA,CAAK,GAAA,CAA8B,GAAG,IAAA,CAAK,QAAQ,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,EAAI;AAAA,MACvF,GAAG,IAAA;AAAA,MACH,QAAA,EAAU,CAAC,CAAC;AAAA,KACb,CAAA;AAGD,IAAA,IAAI,IAAA,IAAQ,QAAA,CAAS,MAAA,EAAQ,iBAAA,EAAmB;AAC9C,MAAA,MAAMA,eAAA,CAAW,QAAA,CAAS,MAAA,CAAO,iBAAA,CAAkB,WAAW,IAAA,EAAM;AAAA,QAClE,WAAA,EAAa,IAAA,YAAgB,IAAA,GAAO,IAAA,CAAK,IAAA,GAAO;AAAA,OACjD,CAAA;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAO,EAAA,EAA2B;AACtC,IAAA,MAAM,IAAA,CAAK,KAAK,MAAA,CAAiC,CAAA,EAAG,KAAK,QAAQ,CAAA,CAAA,EAAI,EAAE,CAAA,CAAE,CAAA;AAAA,EAC3E;AACF","file":"index.js","sourcesContent":["import { HttpClient, IPaginationParams, uploadToR2 } from \"@posty5/core\";\r\nimport {\r\n ICreateWorkspaceRequest,\r\n IUpdateWorkspaceRequest,\r\n IListParams,\r\n ISearchWorkspaceResponse,\r\n ICreateWorkspaceResponse,\r\n IUpdateWorkspaceResponse,\r\n IDeleteWorkspaceResponse,\r\n IWorkspaceResponse,\r\n IWorkspaceForNewPostResponse,\r\n} from \"./interfaces\";\r\n\r\n/**\r\n * Social Publisher Workspace Client\r\n */\r\nexport class SocialPublisherWorkspaceClient {\r\n private http: HttpClient;\r\n private basePath = \"/api/social-publisher-workspace\";\r\n\r\n /**\r\n * Create client\r\n * @param http - HttpClient instance\r\n */\r\n constructor(http: HttpClient) {\r\n this.http = http;\r\n }\r\n\r\n /**\r\n * Search workspaces\r\n * @param params - Search filters\r\n * @param pagination - Pagination options\r\n */\r\n async list(params?: IListParams, pagination?: IPaginationParams): Promise<ISearchWorkspaceResponse> {\r\n const response = await this.http.get<ISearchWorkspaceResponse>(this.basePath, {\r\n params: {\r\n ...params,\r\n ...pagination,\r\n },\r\n });\r\n return response.result!;\r\n }\r\n\r\n /**\r\n * Get workspace by ID\r\n * @param id - Workspace ID\r\n */\r\n async get(id: string): Promise<IWorkspaceResponse> {\r\n const response = await this.http.get<IWorkspaceResponse>(`${this.basePath}/${id}`);\r\n return response.result!;\r\n }\r\n\r\n /**\r\n * Get workspace details for creating new post\r\n * @param id - Workspace ID\r\n * @returns Workspace details with populated account information\r\n *\r\n * @example\r\n * ```typescript\r\n * const workspace = await client.getForNewPost('workspace-id');\r\n * console.log(workspace.account.youtube); // YouTube account details\r\n * console.log(workspace.account.facebook?.status); // Facebook account status\r\n * ```\r\n */\r\n async getForNewPost(id: string): Promise<IWorkspaceForNewPostResponse> {\r\n const response = await this.http.get<IWorkspaceForNewPostResponse>(`${this.basePath}/${id}/for-new-post`);\r\n return response.result!;\r\n }\r\n\r\n /**\r\n * Create workspace with optional image upload\r\n * @param data - Workspace data\r\n * @param logo - Optional image file (File or Blob)\r\n * @returns Workspace details\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create without image\r\n * const workspace = await client.create({ name: 'My Workspace', description: 'Description' });\r\n *\r\n * // Create with image\r\n * const file = new File([imageBlob], 'logo.png', { type: 'image/png' });\r\n * const workspace = await client.create(\r\n * { name: 'My Workspace', description: 'Description' },\r\n * file\r\n * );\r\n */\r\n async create(data: ICreateWorkspaceRequest, logo?: File | Blob): Promise<string> {\r\n // Step 1: Create workspace and get upload config\r\n const response = await this.http.post<ICreateWorkspaceResponse>(this.basePath, {\r\n ...data,\r\n hasImage: !!logo,\r\n createdFrom: \"npmPackage\",\r\n });\r\n\r\n // Step 2: Upload image if provided\r\n if (logo && response.result?.uploadImageConfig) {\r\n var res = await uploadToR2(response.result.uploadImageConfig.uploadUrl, logo, {\r\n contentType: /*logo instanceof File ? logo.type : 'image/png'*/ \"image/png\",\r\n });\r\n console.log(res);\r\n }\r\n\r\n return response.result?.workspaceId!;\r\n }\r\n\r\n /**\r\n * Update workspace with optional image upload\r\n * @param id - Workspace ID\r\n * @param data - Workspace data\r\n * @param logo - Optional new image file (File or Blob)\r\n * @returns Workspace details\r\n *\r\n * @example\r\n * ```typescript\r\n * // Update without changing image\r\n * await client.update('workspace-id', { name: 'New Name', description: 'New Description' });\r\n *\r\n * // Update with new image\r\n * const file = new File([imageBlob], 'new-logo.png', { type: 'image/png' });\r\n * await client.update(\r\n * 'workspace-id',\r\n */\r\n async update(id: string, data: IUpdateWorkspaceRequest, logo?: File | Blob): Promise<void> {\r\n // Step 1: Update workspace and get upload config\r\n const response = await this.http.put<IUpdateWorkspaceResponse>(`${this.basePath}/${id}`, {\r\n ...data,\r\n hasImage: !!logo,\r\n });\r\n\r\n // Step 2: Upload image if provided\r\n if (logo && response.result?.uploadImageConfig) {\r\n await uploadToR2(response.result.uploadImageConfig.uploadUrl, logo, {\r\n contentType: logo instanceof File ? logo.type : \"image/png\",\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Delete workspace\r\n * @param id - Workspace ID\r\n */\r\n async delete(id: string): Promise<void> {\r\n await this.http.delete<IDeleteWorkspaceResponse>(`${this.basePath}/${id}`);\r\n }\r\n}\r\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -32,17 +32,33 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
32
32
|
const response = await this.http.get(`${this.basePath}/${id}`);
|
|
33
33
|
return response.result;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Get workspace details for creating new post
|
|
37
|
+
* @param id - Workspace ID
|
|
38
|
+
* @returns Workspace details with populated account information
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
43
|
+
* console.log(workspace.account.youtube); // YouTube account details
|
|
44
|
+
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
async getForNewPost(id) {
|
|
48
|
+
const response = await this.http.get(`${this.basePath}/${id}/for-new-post`);
|
|
49
|
+
return response.result;
|
|
50
|
+
}
|
|
35
51
|
/**
|
|
36
52
|
* Create workspace with optional image upload
|
|
37
53
|
* @param data - Workspace data
|
|
38
54
|
* @param logo - Optional image file (File or Blob)
|
|
39
55
|
* @returns Workspace details
|
|
40
|
-
*
|
|
56
|
+
*
|
|
41
57
|
* @example
|
|
42
58
|
* ```typescript
|
|
43
59
|
* // Create without image
|
|
44
60
|
* const workspace = await client.create({ name: 'My Workspace', description: 'Description' });
|
|
45
|
-
*
|
|
61
|
+
*
|
|
46
62
|
* // Create with image
|
|
47
63
|
* const file = new File([imageBlob], 'logo.png', { type: 'image/png' });
|
|
48
64
|
* const workspace = await client.create(
|
|
@@ -73,12 +89,12 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
73
89
|
* @param data - Workspace data
|
|
74
90
|
* @param logo - Optional new image file (File or Blob)
|
|
75
91
|
* @returns Workspace details
|
|
76
|
-
*
|
|
92
|
+
*
|
|
77
93
|
* @example
|
|
78
94
|
* ```typescript
|
|
79
95
|
* // Update without changing image
|
|
80
96
|
* await client.update('workspace-id', { name: 'New Name', description: 'New Description' });
|
|
81
|
-
*
|
|
97
|
+
*
|
|
82
98
|
* // Update with new image
|
|
83
99
|
* const file = new File([imageBlob], 'new-logo.png', { type: 'image/png' });
|
|
84
100
|
* await client.update(
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/social-publisher-workspace.client.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/social-publisher-workspace.client.ts"],"names":[],"mappings":";;;AAgBO,IAAM,iCAAN,MAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ1C,YAAY,IAAA,EAAkB;AAN9B,IAAA,IAAA,CAAQ,QAAA,GAAW,iCAAA;AAOjB,IAAA,IAAA,CAAK,IAAA,GAAO,IAA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ginationParams, uploadToR2 } from \"@posty5/core\";\r\nimport {\r\n ICreateWorkspaceRequest,\r\n IUpdateWorkspaceRequest,\r\n IListParams,\r\n ISearchWorkspaceResponse,\r\n ICreateWorkspaceResponse,\r\n IUpdateWorkspaceResponse,\r\n IDeleteWorkspaceResponse,\r\n IWorkspaceResponse,\r\n IWorkspaceForNewPostResponse,\r\n} from \"./interfaces\";\r\n\r\n/**\r\n * Social Publisher Workspace Client\r\n */\r\nexport class SocialPublisherWorkspaceClient {\r\n private http: HttpClient;\r\n private basePath = \"/api/social-publisher-workspace\";\r\n\r\n /**\r\n * Create client\r\n * @param http - HttpClient instance\r\n */\r\n constructor(http: HttpClient) {\r\n this.http = http;\r\n }\r\n\r\n /**\r\n * Search workspaces\r\n * @param params - Search filters\r\n * @param pagination - Pagination options\r\n */\r\n async list(params?: IListParams, pagination?: IPaginationParams): Promise<ISearchWorkspaceResponse> {\r\n const response = await this.http.get<ISearchWorkspaceResponse>(this.basePath, {\r\n params: {\r\n ...params,\r\n ...pagination,\r\n },\r\n });\r\n return response.result!;\r\n }\r\n\r\n /**\r\n * Get workspace by ID\r\n * @param id - Workspace ID\r\n */\r\n async get(id: string): Promise<IWorkspaceResponse> {\r\n const response = await this.http.get<IWorkspaceResponse>(`${this.basePath}/${id}`);\r\n return response.result!;\r\n }\r\n\r\n /**\r\n * Get workspace details for creating new post\r\n * @param id - Workspace ID\r\n * @returns Workspace details with populated account information\r\n *\r\n * @example\r\n * ```typescript\r\n * const workspace = await client.getForNewPost('workspace-id');\r\n * console.log(workspace.account.youtube); // YouTube account details\r\n * console.log(workspace.account.facebook?.status); // Facebook account status\r\n * ```\r\n */\r\n async getForNewPost(id: string): Promise<IWorkspaceForNewPostResponse> {\r\n const response = await this.http.get<IWorkspaceForNewPostResponse>(`${this.basePath}/${id}/for-new-post`);\r\n return response.result!;\r\n }\r\n\r\n /**\r\n * Create workspace with optional image upload\r\n * @param data - Workspace data\r\n * @param logo - Optional image file (File or Blob)\r\n * @returns Workspace details\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create without image\r\n * const workspace = await client.create({ name: 'My Workspace', description: 'Description' });\r\n *\r\n * // Create with image\r\n * const file = new File([imageBlob], 'logo.png', { type: 'image/png' });\r\n * const workspace = await client.create(\r\n * { name: 'My Workspace', description: 'Description' },\r\n * file\r\n * );\r\n */\r\n async create(data: ICreateWorkspaceRequest, logo?: File | Blob): Promise<string> {\r\n // Step 1: Create workspace and get upload config\r\n const response = await this.http.post<ICreateWorkspaceResponse>(this.basePath, {\r\n ...data,\r\n hasImage: !!logo,\r\n createdFrom: \"npmPackage\",\r\n });\r\n\r\n // Step 2: Upload image if provided\r\n if (logo && response.result?.uploadImageConfig) {\r\n var res = await uploadToR2(response.result.uploadImageConfig.uploadUrl, logo, {\r\n contentType: /*logo instanceof File ? logo.type : 'image/png'*/ \"image/png\",\r\n });\r\n console.log(res);\r\n }\r\n\r\n return response.result?.workspaceId!;\r\n }\r\n\r\n /**\r\n * Update workspace with optional image upload\r\n * @param id - Workspace ID\r\n * @param data - Workspace data\r\n * @param logo - Optional new image file (File or Blob)\r\n * @returns Workspace details\r\n *\r\n * @example\r\n * ```typescript\r\n * // Update without changing image\r\n * await client.update('workspace-id', { name: 'New Name', description: 'New Description' });\r\n *\r\n * // Update with new image\r\n * const file = new File([imageBlob], 'new-logo.png', { type: 'image/png' });\r\n * await client.update(\r\n * 'workspace-id',\r\n */\r\n async update(id: string, data: IUpdateWorkspaceRequest, logo?: File | Blob): Promise<void> {\r\n // Step 1: Update workspace and get upload config\r\n const response = await this.http.put<IUpdateWorkspaceResponse>(`${this.basePath}/${id}`, {\r\n ...data,\r\n hasImage: !!logo,\r\n });\r\n\r\n // Step 2: Upload image if provided\r\n if (logo && response.result?.uploadImageConfig) {\r\n await uploadToR2(response.result.uploadImageConfig.uploadUrl, logo, {\r\n contentType: logo instanceof File ? logo.type : \"image/png\",\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Delete workspace\r\n * @param id - Workspace ID\r\n */\r\n async delete(id: string): Promise<void> {\r\n await this.http.delete<IDeleteWorkspaceResponse>(`${this.basePath}/${id}`);\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posty5/social-publisher-workspace",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Social Publisher Organization management SDK for Posty5 API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
18
19
|
"import": "./dist/index.mjs",
|
|
19
|
-
"require": "./dist/index.js"
|
|
20
|
-
"types": "./dist/index.d.ts"
|
|
20
|
+
"require": "./dist/index.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "Posty5",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@posty5/core": "^
|
|
48
|
+
"@posty5/core": "^2.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@posty5/core": "file:../posty5-core",
|