@posty5/social-publisher-workspace 2.0.0 → 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 +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
@@ -46,12 +46,12 @@ interface IWorkspaceAccount {
|
|
|
46
46
|
facebook?: IAccountSampleDetails | any;
|
|
47
47
|
instagram?: IAccountSampleDetails | any;
|
|
48
48
|
tiktok?: IAccountSampleDetails | any;
|
|
49
|
-
facebookPlatformPageId?: string;
|
|
50
|
-
instagramPlatformAccountId?: string;
|
|
51
49
|
}
|
|
52
50
|
interface IWorkspaceResponse {
|
|
53
51
|
_id: string;
|
|
54
52
|
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
imageUrl?: string;
|
|
55
55
|
account: IWorkspaceAccount;
|
|
56
56
|
}
|
|
57
57
|
interface IWorkspaceSampleDetails {
|
|
@@ -85,9 +85,9 @@ interface IDeleteWorkspaceResponse {
|
|
|
85
85
|
message?: string;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Workspace details formatted for new
|
|
88
|
+
* Workspace details formatted for new post creation with populated accounts
|
|
89
89
|
*/
|
|
90
|
-
interface
|
|
90
|
+
interface IWorkspaceForNewPostResponse {
|
|
91
91
|
_id: string;
|
|
92
92
|
name: string;
|
|
93
93
|
description: string;
|
|
@@ -118,18 +118,18 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
118
118
|
*/
|
|
119
119
|
get(id: string): Promise<IWorkspaceResponse>;
|
|
120
120
|
/**
|
|
121
|
-
* Get workspace details for creating new
|
|
121
|
+
* Get workspace details for creating new post
|
|
122
122
|
* @param id - Workspace ID
|
|
123
123
|
* @returns Workspace details with populated account information
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
* ```typescript
|
|
127
|
-
* const workspace = await client.
|
|
127
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
128
128
|
* console.log(workspace.account.youtube); // YouTube account details
|
|
129
129
|
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
getForNewPost(id: string): Promise<IWorkspaceForNewPostResponse>;
|
|
133
133
|
/**
|
|
134
134
|
* Create workspace with optional image upload
|
|
135
135
|
* @param data - Workspace data
|
|
@@ -174,4 +174,4 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
174
174
|
delete(id: string): Promise<void>;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
export { type IAccountSampleDetails, type ICreateWorkspaceRequest, type ICreateWorkspaceResponse, type IDeleteWorkspaceResponse, type IListParams, type ISearchWorkspaceResponse, type IUpdateWorkspaceRequest, type IUpdateWorkspaceResponse, type IUploadImageConfig, type IWorkspaceAccount, type
|
|
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
|
@@ -46,12 +46,12 @@ interface IWorkspaceAccount {
|
|
|
46
46
|
facebook?: IAccountSampleDetails | any;
|
|
47
47
|
instagram?: IAccountSampleDetails | any;
|
|
48
48
|
tiktok?: IAccountSampleDetails | any;
|
|
49
|
-
facebookPlatformPageId?: string;
|
|
50
|
-
instagramPlatformAccountId?: string;
|
|
51
49
|
}
|
|
52
50
|
interface IWorkspaceResponse {
|
|
53
51
|
_id: string;
|
|
54
52
|
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
imageUrl?: string;
|
|
55
55
|
account: IWorkspaceAccount;
|
|
56
56
|
}
|
|
57
57
|
interface IWorkspaceSampleDetails {
|
|
@@ -85,9 +85,9 @@ interface IDeleteWorkspaceResponse {
|
|
|
85
85
|
message?: string;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Workspace details formatted for new
|
|
88
|
+
* Workspace details formatted for new post creation with populated accounts
|
|
89
89
|
*/
|
|
90
|
-
interface
|
|
90
|
+
interface IWorkspaceForNewPostResponse {
|
|
91
91
|
_id: string;
|
|
92
92
|
name: string;
|
|
93
93
|
description: string;
|
|
@@ -118,18 +118,18 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
118
118
|
*/
|
|
119
119
|
get(id: string): Promise<IWorkspaceResponse>;
|
|
120
120
|
/**
|
|
121
|
-
* Get workspace details for creating new
|
|
121
|
+
* Get workspace details for creating new post
|
|
122
122
|
* @param id - Workspace ID
|
|
123
123
|
* @returns Workspace details with populated account information
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
* ```typescript
|
|
127
|
-
* const workspace = await client.
|
|
127
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
128
128
|
* console.log(workspace.account.youtube); // YouTube account details
|
|
129
129
|
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
getForNewPost(id: string): Promise<IWorkspaceForNewPostResponse>;
|
|
133
133
|
/**
|
|
134
134
|
* Create workspace with optional image upload
|
|
135
135
|
* @param data - Workspace data
|
|
@@ -174,4 +174,4 @@ declare class SocialPublisherWorkspaceClient {
|
|
|
174
174
|
delete(id: string): Promise<void>;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
export { type IAccountSampleDetails, type ICreateWorkspaceRequest, type ICreateWorkspaceResponse, type IDeleteWorkspaceResponse, type IListParams, type ISearchWorkspaceResponse, type IUpdateWorkspaceRequest, type IUpdateWorkspaceResponse, type IUploadImageConfig, type IWorkspaceAccount, type
|
|
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
|
@@ -35,21 +35,19 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
35
35
|
return response.result;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* Get workspace details for creating new
|
|
38
|
+
* Get workspace details for creating new post
|
|
39
39
|
* @param id - Workspace ID
|
|
40
40
|
* @returns Workspace details with populated account information
|
|
41
|
-
*
|
|
41
|
+
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```typescript
|
|
44
|
-
* const workspace = await client.
|
|
44
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
45
45
|
* console.log(workspace.account.youtube); // YouTube account details
|
|
46
46
|
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
async
|
|
50
|
-
const response = await this.http.get(
|
|
51
|
-
`${this.basePath}/${id}/for-new-task`
|
|
52
|
-
);
|
|
49
|
+
async getForNewPost(id) {
|
|
50
|
+
const response = await this.http.get(`${this.basePath}/${id}/for-new-post`);
|
|
53
51
|
return response.result;
|
|
54
52
|
}
|
|
55
53
|
/**
|
|
@@ -57,12 +55,12 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
57
55
|
* @param data - Workspace data
|
|
58
56
|
* @param logo - Optional image file (File or Blob)
|
|
59
57
|
* @returns Workspace details
|
|
60
|
-
*
|
|
58
|
+
*
|
|
61
59
|
* @example
|
|
62
60
|
* ```typescript
|
|
63
61
|
* // Create without image
|
|
64
62
|
* const workspace = await client.create({ name: 'My Workspace', description: 'Description' });
|
|
65
|
-
*
|
|
63
|
+
*
|
|
66
64
|
* // Create with image
|
|
67
65
|
* const file = new File([imageBlob], 'logo.png', { type: 'image/png' });
|
|
68
66
|
* const workspace = await client.create(
|
|
@@ -93,12 +91,12 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
93
91
|
* @param data - Workspace data
|
|
94
92
|
* @param logo - Optional new image file (File or Blob)
|
|
95
93
|
* @returns Workspace details
|
|
96
|
-
*
|
|
94
|
+
*
|
|
97
95
|
* @example
|
|
98
96
|
* ```typescript
|
|
99
97
|
* // Update without changing image
|
|
100
98
|
* await client.update('workspace-id', { name: 'New Name', description: 'New Description' });
|
|
101
|
-
*
|
|
99
|
+
*
|
|
102
100
|
* // Update with new image
|
|
103
101
|
* const file = new File([imageBlob], 'new-logo.png', { type: 'image/png' });
|
|
104
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":";;;;;AAgBO,IAAM,iCAAN,MAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
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,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,cAAc,EAAA,EAAmD;AACrE,IAAA,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AAA,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
|
@@ -33,21 +33,19 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
33
33
|
return response.result;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Get workspace details for creating new
|
|
36
|
+
* Get workspace details for creating new post
|
|
37
37
|
* @param id - Workspace ID
|
|
38
38
|
* @returns Workspace details with populated account information
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```typescript
|
|
42
|
-
* const workspace = await client.
|
|
42
|
+
* const workspace = await client.getForNewPost('workspace-id');
|
|
43
43
|
* console.log(workspace.account.youtube); // YouTube account details
|
|
44
44
|
* console.log(workspace.account.facebook?.status); // Facebook account status
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
async
|
|
48
|
-
const response = await this.http.get(
|
|
49
|
-
`${this.basePath}/${id}/for-new-task`
|
|
50
|
-
);
|
|
47
|
+
async getForNewPost(id) {
|
|
48
|
+
const response = await this.http.get(`${this.basePath}/${id}/for-new-post`);
|
|
51
49
|
return response.result;
|
|
52
50
|
}
|
|
53
51
|
/**
|
|
@@ -55,12 +53,12 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
55
53
|
* @param data - Workspace data
|
|
56
54
|
* @param logo - Optional image file (File or Blob)
|
|
57
55
|
* @returns Workspace details
|
|
58
|
-
*
|
|
56
|
+
*
|
|
59
57
|
* @example
|
|
60
58
|
* ```typescript
|
|
61
59
|
* // Create without image
|
|
62
60
|
* const workspace = await client.create({ name: 'My Workspace', description: 'Description' });
|
|
63
|
-
*
|
|
61
|
+
*
|
|
64
62
|
* // Create with image
|
|
65
63
|
* const file = new File([imageBlob], 'logo.png', { type: 'image/png' });
|
|
66
64
|
* const workspace = await client.create(
|
|
@@ -91,12 +89,12 @@ var SocialPublisherWorkspaceClient = class {
|
|
|
91
89
|
* @param data - Workspace data
|
|
92
90
|
* @param logo - Optional new image file (File or Blob)
|
|
93
91
|
* @returns Workspace details
|
|
94
|
-
*
|
|
92
|
+
*
|
|
95
93
|
* @example
|
|
96
94
|
* ```typescript
|
|
97
95
|
* // Update without changing image
|
|
98
96
|
* await client.update('workspace-id', { name: 'New Name', description: 'New Description' });
|
|
99
|
-
*
|
|
97
|
+
*
|
|
100
98
|
* // Update with new image
|
|
101
99
|
* const file = new File([imageBlob], 'new-logo.png', { type: 'image/png' });
|
|
102
100
|
* await client.update(
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/social-publisher-workspace.client.ts"],"names":[],"mappings":";;;AAgBO,IAAM,iCAAN,MAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
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,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AA,CAAE,CAAA;AAAA,EAC3E;AACF","file":"index.mjs","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"]}
|