glitch-javascript-sdk 1.5.6 → 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,10 +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
+ */
2865
2876
  static updateMediaOrder<T>(title_id: string, media_order: {
2866
2877
  media_id: string;
2867
2878
  order: number;
2868
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>>;
2869
2897
  }
2870
2898
 
2871
2899
  declare class Campaigns {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.5.6",
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
@@ -210,6 +210,17 @@ 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
+ */
213
224
  public static updateMediaOrder<T>(title_id: string, media_order: { media_id: string, order: number }[]): AxiosPromise<Response<T>> {
214
225
  return Requests.processRoute(
215
226
  TitlesRoute.routes.updateMediaOrder,
@@ -218,6 +229,39 @@ class Titles {
218
229
  );
219
230
  }
220
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
+
221
265
  }
222
266
 
223
267
  export default Titles;
@@ -18,7 +18,8 @@ class TitlesRoute {
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
20
  updateMediaOrder: { url: '/titles/{title_id}/updateMediaOrder', method: HTTP_METHODS.POST },
21
-
21
+ importWishlist: { url: '/titles/{title_id}/wishlist/import', method: HTTP_METHODS.POST },
22
+ getWishlist: { url: '/titles/{title_id}/wishlist', method: HTTP_METHODS.GET },
22
23
  };
23
24
 
24
25
  }