glitch-javascript-sdk 2.1.6 → 2.1.8

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
@@ -5179,7 +5179,7 @@ declare class PlayTests {
5179
5179
 
5180
5180
  interface SteamCapsuleCropRequest {
5181
5181
  media_id: string;
5182
- capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background';
5182
+ capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background' | 'screenshot' | 'app_icon' | 'shortcut_icon';
5183
5183
  crop_x?: number;
5184
5184
  crop_y?: number;
5185
5185
  crop_width?: number;
@@ -5191,6 +5191,22 @@ interface SteamCapsuleAnalysisRequest {
5191
5191
  game_name?: string;
5192
5192
  game_genre?: string;
5193
5193
  }
5194
+ interface RemoveBackgroundRequest {
5195
+ media_id: string;
5196
+ output_format?: 'png' | 'webp';
5197
+ }
5198
+ interface RemoveBackgroundAIRequest {
5199
+ media_id: string;
5200
+ use_ai_analysis?: boolean;
5201
+ }
5202
+ interface CreateLibraryLogoRequest {
5203
+ media_id: string;
5204
+ target_width?: number;
5205
+ target_height?: number;
5206
+ }
5207
+ interface ValidateScreenshotRequest {
5208
+ media_id: string;
5209
+ }
5194
5210
  interface SteamCapsuleDimensions {
5195
5211
  width: number;
5196
5212
  height: number;
@@ -5223,6 +5239,30 @@ interface SteamCapsuleAnalysisResponse {
5223
5239
  ai_description: string;
5224
5240
  guidelines: any;
5225
5241
  }
5242
+ interface RemoveBackgroundResponse {
5243
+ success: boolean;
5244
+ message: string;
5245
+ data: any;
5246
+ }
5247
+ interface RemoveBackgroundAIResponse {
5248
+ success: boolean;
5249
+ message: string;
5250
+ data: any;
5251
+ ai_used: boolean;
5252
+ }
5253
+ interface CreateLibraryLogoResponse {
5254
+ success: boolean;
5255
+ message: string;
5256
+ data: any;
5257
+ }
5258
+ interface ScreenshotValidationResponse {
5259
+ success: boolean;
5260
+ valid: boolean;
5261
+ dimensions: SteamCapsuleDimensions;
5262
+ aspect_ratio: number;
5263
+ issues: string[];
5264
+ recommendations: string[];
5265
+ }
5226
5266
  declare class Media {
5227
5267
  /**
5228
5268
  * Upload media content using a File object.
@@ -5257,13 +5297,13 @@ declare class Media {
5257
5297
  */
5258
5298
  static get<T>(media_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
5259
5299
  /**
5260
- * Crop and resize an image to Steam capsule dimensions.
5261
- *
5262
- * @param request The crop request parameters.
5263
- * @param params Additional query parameters.
5264
- *
5265
- * @returns promise
5266
- */
5300
+ * Crop and resize an image to Steam capsule dimensions.
5301
+ *
5302
+ * @param request The crop request parameters.
5303
+ * @param params Additional query parameters.
5304
+ *
5305
+ * @returns promise
5306
+ */
5267
5307
  static cropSteamCapsule(request: SteamCapsuleCropRequest, params?: Record<string, any>): AxiosPromise<Response<SteamCapsuleCropResponse>>;
5268
5308
  /**
5269
5309
  * Analyze a Steam capsule image using AI.
@@ -5274,6 +5314,42 @@ declare class Media {
5274
5314
  * @returns promise
5275
5315
  */
5276
5316
  static analyzeSteamCapsule(request: SteamCapsuleAnalysisRequest, params?: Record<string, any>): AxiosPromise<Response<SteamCapsuleAnalysisResponse>>;
5317
+ /**
5318
+ * Remove background from an image to create transparent PNG.
5319
+ *
5320
+ * @param request The background removal request parameters.
5321
+ * @param params Additional query parameters.
5322
+ *
5323
+ * @returns promise
5324
+ */
5325
+ static removeBackground(request: RemoveBackgroundRequest, params?: Record<string, any>): AxiosPromise<Response<RemoveBackgroundResponse>>;
5326
+ /**
5327
+ * Remove background from an image using AI analysis for better results.
5328
+ *
5329
+ * @param request The AI-enhanced background removal request parameters.
5330
+ * @param params Additional query parameters.
5331
+ *
5332
+ * @returns promise
5333
+ */
5334
+ static removeBackgroundAI(request: RemoveBackgroundAIRequest, params?: Record<string, any>): AxiosPromise<Response<RemoveBackgroundAIResponse>>;
5335
+ /**
5336
+ * Create a Steam Library Logo meeting Steam's requirements.
5337
+ *
5338
+ * @param request The library logo creation request parameters.
5339
+ * @param params Additional query parameters.
5340
+ *
5341
+ * @returns promise
5342
+ */
5343
+ static createLibraryLogo(request: CreateLibraryLogoRequest, params?: Record<string, any>): AxiosPromise<Response<CreateLibraryLogoResponse>>;
5344
+ /**
5345
+ * Validate a screenshot against Steam's requirements.
5346
+ *
5347
+ * @param request The screenshot validation request parameters.
5348
+ * @param params Additional query parameters.
5349
+ *
5350
+ * @returns promise
5351
+ */
5352
+ static validateScreenshot(request: ValidateScreenshotRequest, params?: Record<string, any>): AxiosPromise<Response<ScreenshotValidationResponse>>;
5277
5353
  /**
5278
5354
  * Get Steam capsule dimensions for a specific type.
5279
5355
  *
@@ -5290,6 +5366,31 @@ declare class Media {
5290
5366
  * @returns Information about the capsule type.
5291
5367
  */
5292
5368
  static getSteamCapsuleInfo(capsuleType: string): any;
5369
+ /**
5370
+ * Get Steam screenshot requirements.
5371
+ *
5372
+ * @returns Screenshot requirements object.
5373
+ */
5374
+ static getSteamScreenshotRequirements(): {
5375
+ minWidth: number;
5376
+ minHeight: number;
5377
+ aspectRatio: number;
5378
+ minCount: number;
5379
+ format: string;
5380
+ content: string;
5381
+ };
5382
+ /**
5383
+ * Get Steam library logo requirements.
5384
+ *
5385
+ * @returns Library logo requirements object.
5386
+ */
5387
+ static getSteamLibraryLogoRequirements(): {
5388
+ maxWidth: number;
5389
+ maxHeight: number;
5390
+ format: string;
5391
+ requirement: string;
5392
+ content: string;
5393
+ };
5293
5394
  }
5294
5395
 
5295
5396
  declare class Scheduler {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
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
@@ -5,7 +5,7 @@ import { AxiosProgressEvent, AxiosPromise } from "axios";
5
5
 
6
6
  export interface SteamCapsuleCropRequest {
7
7
  media_id: string;
8
- capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background';
8
+ capsule_type: 'header' | 'small' | 'main' | 'vertical' | 'library' | 'library_header' | 'library_hero' | 'page_background' | 'screenshot' | 'app_icon' | 'shortcut_icon';
9
9
  crop_x?: number;
10
10
  crop_y?: number;
11
11
  crop_width?: number;
@@ -19,6 +19,26 @@ export interface SteamCapsuleAnalysisRequest {
19
19
  game_genre?: string;
20
20
  }
21
21
 
22
+ export interface RemoveBackgroundRequest {
23
+ media_id: string;
24
+ output_format?: 'png' | 'webp';
25
+ }
26
+
27
+ export interface RemoveBackgroundAIRequest {
28
+ media_id: string;
29
+ use_ai_analysis?: boolean;
30
+ }
31
+
32
+ export interface CreateLibraryLogoRequest {
33
+ media_id: string;
34
+ target_width?: number;
35
+ target_height?: number;
36
+ }
37
+
38
+ export interface ValidateScreenshotRequest {
39
+ media_id: string;
40
+ }
41
+
22
42
  export interface SteamCapsuleDimensions {
23
43
  width: number;
24
44
  height: number;
@@ -55,6 +75,33 @@ export interface SteamCapsuleAnalysisResponse {
55
75
  guidelines: any;
56
76
  }
57
77
 
78
+ export interface RemoveBackgroundResponse {
79
+ success: boolean;
80
+ message: string;
81
+ data: any;
82
+ }
83
+
84
+ export interface RemoveBackgroundAIResponse {
85
+ success: boolean;
86
+ message: string;
87
+ data: any;
88
+ ai_used: boolean;
89
+ }
90
+
91
+ export interface CreateLibraryLogoResponse {
92
+ success: boolean;
93
+ message: string;
94
+ data: any;
95
+ }
96
+
97
+ export interface ScreenshotValidationResponse {
98
+ success: boolean;
99
+ valid: boolean;
100
+ dimensions: SteamCapsuleDimensions;
101
+ aspect_ratio: number;
102
+ issues: string[];
103
+ recommendations: string[];
104
+ }
58
105
 
59
106
  class Media {
60
107
  /**
@@ -98,7 +145,7 @@ class Media {
98
145
  return Requests.processRoute(MediaRoute.routes.getMedia, {}, { media_id: media_id }, params);
99
146
  }
100
147
 
101
- /**
148
+ /**
102
149
  * Crop and resize an image to Steam capsule dimensions.
103
150
  *
104
151
  * @param request The crop request parameters.
@@ -122,6 +169,54 @@ class Media {
122
169
  return Requests.processRoute(MediaRoute.routes.analyzeSteamCapsule, request, {}, params);
123
170
  }
124
171
 
172
+ /**
173
+ * Remove background from an image to create transparent PNG.
174
+ *
175
+ * @param request The background removal request parameters.
176
+ * @param params Additional query parameters.
177
+ *
178
+ * @returns promise
179
+ */
180
+ public static removeBackground(request: RemoveBackgroundRequest, params?: Record<string, any>): AxiosPromise<Response<RemoveBackgroundResponse>> {
181
+ return Requests.processRoute(MediaRoute.routes.removeBackground, request, {}, params);
182
+ }
183
+
184
+ /**
185
+ * Remove background from an image using AI analysis for better results.
186
+ *
187
+ * @param request The AI-enhanced background removal request parameters.
188
+ * @param params Additional query parameters.
189
+ *
190
+ * @returns promise
191
+ */
192
+ public static removeBackgroundAI(request: RemoveBackgroundAIRequest, params?: Record<string, any>): AxiosPromise<Response<RemoveBackgroundAIResponse>> {
193
+ return Requests.processRoute(MediaRoute.routes.removeBackgroundAI, request, {}, params);
194
+ }
195
+
196
+ /**
197
+ * Create a Steam Library Logo meeting Steam's requirements.
198
+ *
199
+ * @param request The library logo creation request parameters.
200
+ * @param params Additional query parameters.
201
+ *
202
+ * @returns promise
203
+ */
204
+ public static createLibraryLogo(request: CreateLibraryLogoRequest, params?: Record<string, any>): AxiosPromise<Response<CreateLibraryLogoResponse>> {
205
+ return Requests.processRoute(MediaRoute.routes.createLibraryLogo, request, {}, params);
206
+ }
207
+
208
+ /**
209
+ * Validate a screenshot against Steam's requirements.
210
+ *
211
+ * @param request The screenshot validation request parameters.
212
+ * @param params Additional query parameters.
213
+ *
214
+ * @returns promise
215
+ */
216
+ public static validateScreenshot(request: ValidateScreenshotRequest, params?: Record<string, any>): AxiosPromise<Response<ScreenshotValidationResponse>> {
217
+ return Requests.processRoute(MediaRoute.routes.validateScreenshot, request, {}, params);
218
+ }
219
+
125
220
  /**
126
221
  * Get Steam capsule dimensions for a specific type.
127
222
  *
@@ -205,6 +300,37 @@ class Media {
205
300
 
206
301
  return info[capsuleType] || null;
207
302
  }
303
+
304
+ /**
305
+ * Get Steam screenshot requirements.
306
+ *
307
+ * @returns Screenshot requirements object.
308
+ */
309
+ public static getSteamScreenshotRequirements() {
310
+ return {
311
+ minWidth: 1920,
312
+ minHeight: 1080,
313
+ aspectRatio: 16 / 9,
314
+ minCount: 5,
315
+ format: 'Should be high-res, widescreen format',
316
+ content: 'Should show gameplay, not menus or concept art'
317
+ };
318
+ }
319
+
320
+ /**
321
+ * Get Steam library logo requirements.
322
+ *
323
+ * @returns Library logo requirements object.
324
+ */
325
+ public static getSteamLibraryLogoRequirements() {
326
+ return {
327
+ maxWidth: 1280,
328
+ maxHeight: 720,
329
+ format: 'PNG with transparent background',
330
+ requirement: 'Either 1280px wide and/or 720px tall',
331
+ content: 'Logo only, should be legible against any background'
332
+ };
333
+ }
208
334
  }
209
335
 
210
- export default Media;
336
+ export default Media;
@@ -7,6 +7,10 @@ class MediaRoute {
7
7
  getMedia: { url: '/media/{media_id}', method: HTTP_METHODS.GET },
8
8
  cropSteamCapsule: { url: '/media/crop-steam-capsule', method: HTTP_METHODS.POST },
9
9
  analyzeSteamCapsule: { url: '/media/analyze-steam-capsule', method: HTTP_METHODS.POST },
10
+ removeBackground: { url: '/media/remove-background', method: HTTP_METHODS.POST },
11
+ removeBackgroundAI: { url: '/media/remove-background-ai', method: HTTP_METHODS.POST },
12
+ createLibraryLogo: { url: '/media/create-library-logo', method: HTTP_METHODS.POST },
13
+ validateScreenshot: { url: '/media/validate-screenshot', method: HTTP_METHODS.POST },
10
14
  };
11
15
  }
12
16