glitch-javascript-sdk 1.5.5 → 1.5.7

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
@@ -2862,6 +2862,38 @@ declare class Titles {
2862
2862
  * Remove media from a title.
2863
2863
  */
2864
2864
  static removeMedia<T>(title_id: string, media_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2865
+ /**
2866
+ * Update the ordering of media items (images, videos, etc.) for a title.
2867
+ *
2868
+ * @see https://api.glitch.fun/api/documentation#/Titles/updateMediaOrder
2869
+ *
2870
+ * @param title_id The ID of the title to update
2871
+ * @param media_order An array of objects, each containing:
2872
+ * - media_id: string (the UUID of the media)
2873
+ * - order: number (the new order/index)
2874
+ * @returns Promise containing the server response
2875
+ */
2876
+ static updateMediaOrder<T>(title_id: string, media_order: {
2877
+ media_id: string;
2878
+ order: number;
2879
+ }[]): AxiosPromise<Response<T>>;
2880
+ /**
2881
+ * Upload a CSV/Excel file containing wishlist data for a title.
2882
+ *
2883
+ * @param title_id The UUID of the title
2884
+ * @param file The CSV or Excel file
2885
+ * @param data Any additional form data, e.g. platform
2886
+ * @returns AxiosPromise
2887
+ */
2888
+ static importWishlist<T>(title_id: string, file: File | Blob, data?: Record<string, any>, params?: Record<string, any>): AxiosPromise<Response<T>>;
2889
+ /**
2890
+ * Retrieve the wishlist data for a specific title.
2891
+ *
2892
+ * @param title_id The UUID of the title
2893
+ * @param params Optional query params, e.g. { platform: 'steam', start_date: '2025-01-01', end_date: '2025-01-31'}
2894
+ * @returns AxiosPromise
2895
+ */
2896
+ static getWishlist<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2865
2897
  }
2866
2898
 
2867
2899
  declare class Campaigns {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Titles.ts CHANGED
@@ -196,10 +196,10 @@ class Titles {
196
196
  return Requests.uploadBlob(url, 'image', blob, data);
197
197
  }
198
198
 
199
- /**
200
- * Add media to a title.
201
- */
202
- public static addMedia<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
199
+ /**
200
+ * Add media to a title.
201
+ */
202
+ public static addMedia<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
203
203
  return Requests.processRoute(TitlesRoute.routes.addMedia, data, { title_id: title_id }, params);
204
204
  }
205
205
 
@@ -210,6 +210,58 @@ class Titles {
210
210
  return Requests.processRoute(TitlesRoute.routes.removeMedia, {}, { title_id: title_id, media_id: media_id }, params);
211
211
  }
212
212
 
213
+ /**
214
+ * Update the ordering of media items (images, videos, etc.) for a title.
215
+ *
216
+ * @see https://api.glitch.fun/api/documentation#/Titles/updateMediaOrder
217
+ *
218
+ * @param title_id The ID of the title to update
219
+ * @param media_order An array of objects, each containing:
220
+ * - media_id: string (the UUID of the media)
221
+ * - order: number (the new order/index)
222
+ * @returns Promise containing the server response
223
+ */
224
+ public static updateMediaOrder<T>(title_id: string, media_order: { media_id: string, order: number }[]): AxiosPromise<Response<T>> {
225
+ return Requests.processRoute(
226
+ TitlesRoute.routes.updateMediaOrder,
227
+ { media_order },
228
+ { title_id: title_id }
229
+ );
230
+ }
231
+
232
+ /**
233
+ * Upload a CSV/Excel file containing wishlist data for a title.
234
+ *
235
+ * @param title_id The UUID of the title
236
+ * @param file The CSV or Excel file
237
+ * @param data Any additional form data, e.g. platform
238
+ * @returns AxiosPromise
239
+ */
240
+ public static importWishlist<T>(
241
+ title_id: string,
242
+ file: File | Blob,
243
+ data?: Record<string, any>,
244
+ params?: Record<string, any>
245
+ ): AxiosPromise<Response<T>> {
246
+ let url = TitlesRoute.routes.importWishlist.url.replace('{title_id}', title_id);
247
+ return Requests.uploadFile(url, 'file', file, data, params);
248
+ }
249
+
250
+ /**
251
+ * Retrieve the wishlist data for a specific title.
252
+ *
253
+ * @param title_id The UUID of the title
254
+ * @param params Optional query params, e.g. { platform: 'steam', start_date: '2025-01-01', end_date: '2025-01-31'}
255
+ * @returns AxiosPromise
256
+ */
257
+ public static getWishlist<T>(
258
+ title_id: string,
259
+ params?: Record<string, any>
260
+ ): AxiosPromise<Response<T>> {
261
+ let url = TitlesRoute.routes.getWishlist.url.replace('{title_id}', title_id);
262
+ return Requests.processRoute(TitlesRoute.routes.getWishlist, {}, { title_id }, params);
263
+ }
264
+
213
265
  }
214
266
 
215
267
  export default Titles;
@@ -17,6 +17,9 @@ class TitlesRoute {
17
17
  removeAdministrator : { url: '/titles/{title_id}/removeAdministrator/{user_id}', method: HTTP_METHODS.DELETE },
18
18
  addMedia: { url: '/titles/{title_id}/addMedia', method: HTTP_METHODS.POST },
19
19
  removeMedia: { url: '/titles/{title_id}/removeMedia/{media_id}', method: HTTP_METHODS.DELETE },
20
+ updateMediaOrder: { url: '/titles/{title_id}/updateMediaOrder', method: HTTP_METHODS.POST },
21
+ importWishlist: { url: '/titles/{title_id}/wishlist/import', method: HTTP_METHODS.POST },
22
+ getWishlist: { url: '/titles/{title_id}/wishlist', method: HTTP_METHODS.GET },
20
23
  };
21
24
 
22
25
  }