glitch-javascript-sdk 2.1.2 → 2.1.3

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/dist/index.d.ts CHANGED
@@ -3512,6 +3512,74 @@ declare class SocialPosts {
3512
3512
  * @returns promise
3513
3513
  */
3514
3514
  static shortLinkReports<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
3515
+ /**
3516
+ * List comments for a social media post.
3517
+ *
3518
+ * @param post_id The ID of the social media post.
3519
+ * @param params Optional query parameters for filtering and sorting.
3520
+ * @returns A promise
3521
+ */
3522
+ static listComments<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3523
+ /**
3524
+ * Sync comments from the social media platform for a specific post.
3525
+ *
3526
+ * @param post_id The ID of the social media post.
3527
+ * @param params Optional query parameters (e.g., limit).
3528
+ * @returns A promise
3529
+ */
3530
+ static syncComments<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3531
+ /**
3532
+ * Get a list of all comments that are pending a response.
3533
+ *
3534
+ * @param params Optional query parameters for filtering.
3535
+ * @returns A promise
3536
+ */
3537
+ static listPendingResponses<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
3538
+ /**
3539
+ * Retrieve a single comment by its ID.
3540
+ *
3541
+ * @param comment_id The ID of the comment.
3542
+ * @param params Optional query parameters (e.g., include_thread).
3543
+ * @returns A promise
3544
+ */
3545
+ static viewComment<T>(comment_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3546
+ /**
3547
+ * Post a reply to a comment.
3548
+ *
3549
+ * @param comment_id The ID of the comment to reply to.
3550
+ * @param data The content of the reply.
3551
+ * @returns A promise
3552
+ */
3553
+ static replyToComment<T>(comment_id: string, data: object): AxiosPromise<Response<T>>;
3554
+ /**
3555
+ * Moderate a comment (approve, reject, spam, hide, show).
3556
+ *
3557
+ * @param comment_id The ID of the comment to moderate.
3558
+ * @param data The moderation action and optional reason.
3559
+ * @returns A promise
3560
+ */
3561
+ static moderateComment<T>(comment_id: string, data: object): AxiosPromise<Response<T>>;
3562
+ /**
3563
+ * Mark a comment as needing a response.
3564
+ *
3565
+ * @param comment_id The ID of the comment.
3566
+ * @returns A promise
3567
+ */
3568
+ static markCommentForResponse<T>(comment_id: string): AxiosPromise<Response<T>>;
3569
+ /**
3570
+ * Get the full thread for a given comment.
3571
+ *
3572
+ * @param comment_id The ID of a comment within the thread.
3573
+ * @returns A promise
3574
+ */
3575
+ static getCommentThread<T>(comment_id: string): AxiosPromise<Response<T>>;
3576
+ /**
3577
+ * Trigger a manual update of a comment's metrics from its platform.
3578
+ *
3579
+ * @param comment_id The ID of the comment to update.
3580
+ * @returns A promise
3581
+ */
3582
+ static updateCommentMetrics<T>(comment_id: string): AxiosPromise<Response<T>>;
3515
3583
  }
3516
3584
 
3517
3585
  declare class Titles {
@@ -5101,6 +5169,52 @@ declare class PlayTests {
5101
5169
  static mine<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5102
5170
  }
5103
5171
 
5172
+ interface SteamCapsuleCropRequest {
5173
+ media_id: string;
5174
+ capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background';
5175
+ crop_x?: number;
5176
+ crop_y?: number;
5177
+ crop_width?: number;
5178
+ crop_height?: number;
5179
+ }
5180
+ interface SteamCapsuleAnalysisRequest {
5181
+ media_id: string;
5182
+ capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background';
5183
+ game_name?: string;
5184
+ game_genre?: string;
5185
+ }
5186
+ interface SteamCapsuleDimensions {
5187
+ width: number;
5188
+ height: number;
5189
+ }
5190
+ interface SteamCapsuleCropResponse {
5191
+ media: any;
5192
+ download_url: string;
5193
+ dimensions: SteamCapsuleDimensions;
5194
+ capsule_type: string;
5195
+ }
5196
+ interface CategoryScores {
5197
+ visual_hierarchy: number;
5198
+ title_readability: number;
5199
+ genre_communication: number;
5200
+ brand_identity: number;
5201
+ composition_balance: number;
5202
+ art_style: number;
5203
+ emotional_impact: number;
5204
+ steam_compliance: number;
5205
+ }
5206
+ interface SteamCapsuleAnalysisResponse {
5207
+ media_id: string;
5208
+ capsule_type: string;
5209
+ dimensions: SteamCapsuleDimensions;
5210
+ overall_score: number;
5211
+ category_scores: CategoryScores;
5212
+ strengths: string[];
5213
+ improvements: string[];
5214
+ recommendations: string[];
5215
+ ai_description: string;
5216
+ guidelines: any;
5217
+ }
5104
5218
  declare class Media {
5105
5219
  /**
5106
5220
  * Upload media content using a File object.
@@ -5134,6 +5248,40 @@ declare class Media {
5134
5248
  * @returns promise
5135
5249
  */
5136
5250
  static get<T>(media_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
5251
+ /**
5252
+ * Crop and resize an image to Steam capsule dimensions.
5253
+ *
5254
+ * @param request The crop request parameters.
5255
+ * @param params Additional query parameters.
5256
+ *
5257
+ * @returns promise
5258
+ */
5259
+ static cropSteamCapsule(request: SteamCapsuleCropRequest, params?: Record<string, any>): AxiosPromise<Response<SteamCapsuleCropResponse>>;
5260
+ /**
5261
+ * Analyze a Steam capsule image using AI.
5262
+ *
5263
+ * @param request The analysis request parameters.
5264
+ * @param params Additional query parameters.
5265
+ *
5266
+ * @returns promise
5267
+ */
5268
+ static analyzeSteamCapsule(request: SteamCapsuleAnalysisRequest, params?: Record<string, any>): AxiosPromise<Response<SteamCapsuleAnalysisResponse>>;
5269
+ /**
5270
+ * Get Steam capsule dimensions for a specific type.
5271
+ *
5272
+ * @param capsuleType The type of Steam capsule.
5273
+ *
5274
+ * @returns The dimensions object or null if invalid type.
5275
+ */
5276
+ static getSteamCapsuleDimensions(capsuleType: string): SteamCapsuleDimensions | null;
5277
+ /**
5278
+ * Get Steam capsule type information and requirements.
5279
+ *
5280
+ * @param capsuleType The type of Steam capsule.
5281
+ *
5282
+ * @returns Information about the capsule type.
5283
+ */
5284
+ static getSteamCapsuleInfo(capsuleType: string): any;
5137
5285
  }
5138
5286
 
5139
5287
  declare class Scheduler {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Media.ts CHANGED
@@ -3,6 +3,59 @@ import Requests from "../util/Requests";
3
3
  import Response from "../util/Response";
4
4
  import { AxiosProgressEvent, AxiosPromise } from "axios";
5
5
 
6
+ export interface SteamCapsuleCropRequest {
7
+ media_id: string;
8
+ capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background';
9
+ crop_x?: number;
10
+ crop_y?: number;
11
+ crop_width?: number;
12
+ crop_height?: number;
13
+ }
14
+
15
+ export interface SteamCapsuleAnalysisRequest {
16
+ media_id: string;
17
+ capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background';
18
+ game_name?: string;
19
+ game_genre?: string;
20
+ }
21
+
22
+ export interface SteamCapsuleDimensions {
23
+ width: number;
24
+ height: number;
25
+ }
26
+
27
+ export interface SteamCapsuleCropResponse {
28
+ media: any;
29
+ download_url: string;
30
+ dimensions: SteamCapsuleDimensions;
31
+ capsule_type: string;
32
+ }
33
+
34
+ export interface CategoryScores {
35
+ visual_hierarchy: number;
36
+ title_readability: number;
37
+ genre_communication: number;
38
+ brand_identity: number;
39
+ composition_balance: number;
40
+ art_style: number;
41
+ emotional_impact: number;
42
+ steam_compliance: number;
43
+ }
44
+
45
+ export interface SteamCapsuleAnalysisResponse {
46
+ media_id: string;
47
+ capsule_type: string;
48
+ dimensions: SteamCapsuleDimensions;
49
+ overall_score: number;
50
+ category_scores: CategoryScores;
51
+ strengths: string[];
52
+ improvements: string[];
53
+ recommendations: string[];
54
+ ai_description: string;
55
+ guidelines: any;
56
+ }
57
+
58
+
6
59
  class Media {
7
60
  /**
8
61
  * Upload media content using a File object.
@@ -44,6 +97,114 @@ class Media {
44
97
  public static get<T>(media_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
45
98
  return Requests.processRoute(MediaRoute.routes.getMedia, {}, { media_id: media_id }, params);
46
99
  }
100
+
101
+ /**
102
+ * Crop and resize an image to Steam capsule dimensions.
103
+ *
104
+ * @param request The crop request parameters.
105
+ * @param params Additional query parameters.
106
+ *
107
+ * @returns promise
108
+ */
109
+ public static cropSteamCapsule(request: SteamCapsuleCropRequest, params?: Record<string, any>): AxiosPromise<Response<SteamCapsuleCropResponse>> {
110
+ return Requests.processRoute(MediaRoute.routes.cropSteamCapsule, request, {}, params);
111
+ }
112
+
113
+ /**
114
+ * Analyze a Steam capsule image using AI.
115
+ *
116
+ * @param request The analysis request parameters.
117
+ * @param params Additional query parameters.
118
+ *
119
+ * @returns promise
120
+ */
121
+ public static analyzeSteamCapsule(request: SteamCapsuleAnalysisRequest, params?: Record<string, any>): AxiosPromise<Response<SteamCapsuleAnalysisResponse>> {
122
+ return Requests.processRoute(MediaRoute.routes.analyzeSteamCapsule, request, {}, params);
123
+ }
124
+
125
+ /**
126
+ * Get Steam capsule dimensions for a specific type.
127
+ *
128
+ * @param capsuleType The type of Steam capsule.
129
+ *
130
+ * @returns The dimensions object or null if invalid type.
131
+ */
132
+ public static getSteamCapsuleDimensions(capsuleType: string): SteamCapsuleDimensions | null {
133
+ const dimensions: Record<string, SteamCapsuleDimensions> = {
134
+ 'header': { width: 920, height: 430 },
135
+ 'small': { width: 462, height: 174 },
136
+ 'main': { width: 1232, height: 706 },
137
+ 'vertical': { width: 748, height: 896 },
138
+ 'library': { width: 600, height: 900 },
139
+ 'library_header': { width: 920, height: 430 },
140
+ 'library_hero': { width: 3840, height: 1240 },
141
+ 'page_background': { width: 1438, height: 810 }
142
+ };
143
+
144
+ return dimensions[capsuleType] || null;
145
+ }
146
+
147
+ /**
148
+ * Get Steam capsule type information and requirements.
149
+ *
150
+ * @param capsuleType The type of Steam capsule.
151
+ *
152
+ * @returns Information about the capsule type.
153
+ */
154
+ public static getSteamCapsuleInfo(capsuleType: string) {
155
+ const info: Record<string, any> = {
156
+ 'header': {
157
+ name: 'Header Capsule',
158
+ purpose: 'Appears at the top of store page, in recommended sections, grid view in libraries',
159
+ textRequirement: 'Logo must be clearly legible',
160
+ designFocus: 'Focus on branding of your product'
161
+ },
162
+ 'small': {
163
+ name: 'Small Capsule',
164
+ purpose: 'Used for all lists throughout Steam: search results, top-sellers, new releases',
165
+ textRequirement: 'Logo should nearly fill the small capsule for readability',
166
+ designFocus: 'Focus on making logo clearly legible at smallest size'
167
+ },
168
+ 'main': {
169
+ name: 'Main Capsule',
170
+ purpose: 'Appears at top of front page in featured and recommended carousel',
171
+ textRequirement: 'Logo should be prominent and readable',
172
+ designFocus: 'Designed to market the product with key art and logo'
173
+ },
174
+ 'vertical': {
175
+ name: 'Vertical Capsule',
176
+ purpose: 'Can appear at top of front page during seasonal sales',
177
+ textRequirement: 'Logo should be clearly visible',
178
+ designFocus: 'Vertical asset designed to market your game'
179
+ },
180
+ 'library': {
181
+ name: 'Library Capsule',
182
+ purpose: 'Used in library overview and collection views',
183
+ textRequirement: 'Game name/logo should be easily legible against background',
184
+ designFocus: 'Graphically-centric to give user sense of experience'
185
+ },
186
+ 'library_header': {
187
+ name: 'Library Header',
188
+ purpose: 'Appears in various places in Steam Client Library',
189
+ textRequirement: 'Logo must be clearly legible',
190
+ designFocus: 'Focus on branding, similar to Library Capsule'
191
+ },
192
+ 'library_hero': {
193
+ name: 'Library Hero',
194
+ purpose: 'Appears at top of user\'s library details page',
195
+ textRequirement: 'Should NOT contain any text or logos',
196
+ designFocus: 'Visually rich, easily recognizable key art'
197
+ },
198
+ 'page_background': {
199
+ name: 'Page Background',
200
+ purpose: 'Background image for store page',
201
+ textRequirement: 'Minimal or no text',
202
+ designFocus: 'Should be ambient, not compete with page content'
203
+ }
204
+ };
205
+
206
+ return info[capsuleType] || null;
207
+ }
47
208
  }
48
209
 
49
210
  export default Media;
@@ -190,6 +190,102 @@ class SocialPosts {
190
190
  return Requests.processRoute(SocialPostsRoute.routes.shortLinkReports, undefined, undefined, params);
191
191
  }
192
192
 
193
+
194
+ /**
195
+ * List comments for a social media post.
196
+ *
197
+ * @param post_id The ID of the social media post.
198
+ * @param params Optional query parameters for filtering and sorting.
199
+ * @returns A promise
200
+ */
201
+ public static listComments<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
202
+ return Requests.processRoute(SocialPostsRoute.routes.listComments, undefined, { post_id }, params);
203
+ }
204
+
205
+ /**
206
+ * Sync comments from the social media platform for a specific post.
207
+ *
208
+ * @param post_id The ID of the social media post.
209
+ * @param params Optional query parameters (e.g., limit).
210
+ * @returns A promise
211
+ */
212
+ public static syncComments<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
213
+ return Requests.processRoute(SocialPostsRoute.routes.syncComments, undefined, { post_id }, params);
214
+ }
215
+
216
+ /**
217
+ * Get a list of all comments that are pending a response.
218
+ *
219
+ * @param params Optional query parameters for filtering.
220
+ * @returns A promise
221
+ */
222
+ public static listPendingResponses<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
223
+ return Requests.processRoute(SocialPostsRoute.routes.listPendingResponses, undefined, undefined, params);
224
+ }
225
+
226
+ /**
227
+ * Retrieve a single comment by its ID.
228
+ *
229
+ * @param comment_id The ID of the comment.
230
+ * @param params Optional query parameters (e.g., include_thread).
231
+ * @returns A promise
232
+ */
233
+ public static viewComment<T>(comment_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
234
+ return Requests.processRoute(SocialPostsRoute.routes.viewComment, undefined, { comment_id }, params);
235
+ }
236
+
237
+ /**
238
+ * Post a reply to a comment.
239
+ *
240
+ * @param comment_id The ID of the comment to reply to.
241
+ * @param data The content of the reply.
242
+ * @returns A promise
243
+ */
244
+ public static replyToComment<T>(comment_id: string, data: object): AxiosPromise<Response<T>> {
245
+ return Requests.processRoute(SocialPostsRoute.routes.replyToComment, data, { comment_id });
246
+ }
247
+
248
+ /**
249
+ * Moderate a comment (approve, reject, spam, hide, show).
250
+ *
251
+ * @param comment_id The ID of the comment to moderate.
252
+ * @param data The moderation action and optional reason.
253
+ * @returns A promise
254
+ */
255
+ public static moderateComment<T>(comment_id: string, data: object): AxiosPromise<Response<T>> {
256
+ return Requests.processRoute(SocialPostsRoute.routes.moderateComment, data, { comment_id });
257
+ }
258
+
259
+ /**
260
+ * Mark a comment as needing a response.
261
+ *
262
+ * @param comment_id The ID of the comment.
263
+ * @returns A promise
264
+ */
265
+ public static markCommentForResponse<T>(comment_id: string): AxiosPromise<Response<T>> {
266
+ return Requests.processRoute(SocialPostsRoute.routes.markCommentForResponse, undefined, { comment_id });
267
+ }
268
+
269
+ /**
270
+ * Get the full thread for a given comment.
271
+ *
272
+ * @param comment_id The ID of a comment within the thread.
273
+ * @returns A promise
274
+ */
275
+ public static getCommentThread<T>(comment_id: string): AxiosPromise<Response<T>> {
276
+ return Requests.processRoute(SocialPostsRoute.routes.getCommentThread, undefined, { comment_id });
277
+ }
278
+
279
+ /**
280
+ * Trigger a manual update of a comment's metrics from its platform.
281
+ *
282
+ * @param comment_id The ID of the comment to update.
283
+ * @returns A promise
284
+ */
285
+ public static updateCommentMetrics<T>(comment_id: string): AxiosPromise<Response<T>> {
286
+ return Requests.processRoute(SocialPostsRoute.routes.updateCommentMetrics, undefined, { comment_id });
287
+ }
288
+
193
289
  }
194
290
 
195
291
  export default SocialPosts;
@@ -5,6 +5,8 @@ class MediaRoute {
5
5
  public static routes: { [key: string]: Route } = {
6
6
  upload: { url: '/media', method: HTTP_METHODS.POST },
7
7
  getMedia: { url: '/media/{media_id}', method: HTTP_METHODS.GET },
8
+ cropSteamCapsule: { url: '/media/crop-steam-capsule', method: HTTP_METHODS.POST },
9
+ analyzeSteamCapsule: { url: '/media/analyze-steam-capsule', method: HTTP_METHODS.POST },
8
10
  };
9
11
  }
10
12
 
@@ -19,6 +19,17 @@ class SocialPostsRoute {
19
19
  updatePostImpressions : { url: '/socialposts/{post_id}/impressions', method: HTTP_METHODS.PUT },
20
20
  shortLinkReports: { url: '/socialposts/shortlinks/reports', method: HTTP_METHODS.GET },
21
21
 
22
+ // New Comment Routes
23
+ listComments: { url: '/socialposts/{post_id}/comments', method: HTTP_METHODS.GET },
24
+ syncComments: { url: '/socialposts/{post_id}/sync-comments', method: HTTP_METHODS.POST },
25
+ listPendingResponses: { url: '/socialposts/comments/pending-responses', method: HTTP_METHODS.GET },
26
+ viewComment: { url: '/socialposts/comments/{comment_id}', method: HTTP_METHODS.GET },
27
+ replyToComment: { url: '/socialposts/comments/{comment_id}/reply', method: HTTP_METHODS.POST },
28
+ moderateComment: { url: '/socialposts/comments/{comment_id}/moderate', method: HTTP_METHODS.PUT },
29
+ markCommentForResponse: { url: '/socialposts/comments/{comment_id}/mark-for-response', method: HTTP_METHODS.PUT },
30
+ getCommentThread: { url: '/socialposts/comments/{comment_id}/thread', method: HTTP_METHODS.GET },
31
+ updateCommentMetrics: { url: '/socialposts/comments/{comment_id}/update-metrics', method: HTTP_METHODS.PUT },
32
+
22
33
  };
23
34
 
24
35
  }