glitch-javascript-sdk 1.6.4 → 1.6.6

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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class HashtagRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default HashtagRoute;
package/dist/index.d.ts CHANGED
@@ -1223,6 +1223,19 @@ declare class Communities {
1223
1223
  * @param params Optional date-range filter (start_date, end_date, etc.)
1224
1224
  */
1225
1225
  static newsletterSubscriberTrend<T>(community_id: string, newsletter_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1226
+ /**
1227
+ * Export subscribers for a specific newsletter.
1228
+ * The file is generated asynchronously on the server and
1229
+ * the user is emailed a link to download the file.
1230
+ *
1231
+ * @param community_id The ID of the community.
1232
+ * @param newsletter_id The ID of the newsletter.
1233
+ * @param data Export options (format: 'csv' or 'xlsx').
1234
+ * @returns Promise
1235
+ */
1236
+ static exportNewsletterSubscribers<T>(community_id: string, newsletter_id: string, data: {
1237
+ format: 'csv' | 'xlsx';
1238
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
1226
1239
  }
1227
1240
 
1228
1241
  declare class Users {
@@ -2943,6 +2956,17 @@ declare class Titles {
2943
2956
  * Revoke a specific token by ID.
2944
2957
  */
2945
2958
  static revokeTitleToken<T>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
2959
+ /**
2960
+ * Search for Titles using Meilisearch or fallback based on the query and filters.
2961
+ *
2962
+ * @see https://api.glitch.fun/api/documentation#/Titles/searchTitles
2963
+ *
2964
+ * @param params Object of query params:
2965
+ * - q?: string, filters?: string,
2966
+ * - sort_by?: string, sort_order?: 'asc'|'desc',
2967
+ * - page?: number, per_page?: number
2968
+ */
2969
+ static search<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2946
2970
  }
2947
2971
 
2948
2972
  declare class Campaigns {
@@ -4491,6 +4515,23 @@ declare class SocialStats {
4491
4515
  static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4492
4516
  }
4493
4517
 
4518
+ declare class Hashtags {
4519
+ /**
4520
+ * List all the hashtags
4521
+ *
4522
+ *
4523
+ * @returns A promise
4524
+ */
4525
+ static list<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4526
+ /**
4527
+ * Get the top hashtags for a title, campaign, or schedule.
4528
+ *
4529
+ * @param params - e.g. { title_id: '...', limit: 10, sort: 'sum_views', start_date: 'YYYY-MM-DD', end_date: 'YYYY-MM-DD' }
4530
+ * @returns AxiosPromise of an array of aggregated hashtags
4531
+ */
4532
+ static top<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4533
+ }
4534
+
4494
4535
  interface Route {
4495
4536
  url: string;
4496
4537
  method: string;
@@ -4798,6 +4839,7 @@ declare class Glitch {
4798
4839
  Events: typeof Events;
4799
4840
  Games: typeof Games;
4800
4841
  GameShows: typeof GameShows;
4842
+ Hashtags: typeof Hashtags;
4801
4843
  Feedback: typeof Feedback;
4802
4844
  Influencers: typeof Influencers;
4803
4845
  Teams: typeof Teams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -850,7 +850,29 @@ class Communities {
850
850
  );
851
851
  }
852
852
 
853
-
853
+ /**
854
+ * Export subscribers for a specific newsletter.
855
+ * The file is generated asynchronously on the server and
856
+ * the user is emailed a link to download the file.
857
+ *
858
+ * @param community_id The ID of the community.
859
+ * @param newsletter_id The ID of the newsletter.
860
+ * @param data Export options (format: 'csv' or 'xlsx').
861
+ * @returns Promise
862
+ */
863
+ public static exportNewsletterSubscribers<T>(
864
+ community_id: string,
865
+ newsletter_id: string,
866
+ data: { format: 'csv' | 'xlsx' },
867
+ params?: Record<string, any>
868
+ ): AxiosPromise<Response<T>> {
869
+ return Requests.processRoute(
870
+ CommunitiesRoute.routes.exportNewsletterSubscribers,
871
+ data,
872
+ { community_id, newsletter_id },
873
+ params
874
+ );
875
+ }
854
876
 
855
877
 
856
878
  }
@@ -0,0 +1,31 @@
1
+ import AuthRoutes from "../routes/AuthRoute";
2
+ import HashtagRoute from "../routes/HashtagRoute";
3
+ import Requests from "../util/Requests";
4
+ import Response from "../util/Response";
5
+ import { AxiosPromise } from "axios";
6
+
7
+ class Hashtags {
8
+
9
+ /**
10
+ * List all the hashtags
11
+ *
12
+ *
13
+ * @returns A promise
14
+ */
15
+ public static list<T>(data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
16
+ return Requests.processRoute(HashtagRoute.routes.list, data, {}, params);
17
+ }
18
+
19
+ /**
20
+ * Get the top hashtags for a title, campaign, or schedule.
21
+ *
22
+ * @param params - e.g. { title_id: '...', limit: 10, sort: 'sum_views', start_date: 'YYYY-MM-DD', end_date: 'YYYY-MM-DD' }
23
+ * @returns AxiosPromise of an array of aggregated hashtags
24
+ */
25
+ public static top<T>(data? : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
26
+ return Requests.processRoute(HashtagRoute.routes.list, data, {}, params);
27
+ }
28
+
29
+ }
30
+
31
+ export default Hashtags;
package/src/api/Titles.ts CHANGED
@@ -238,7 +238,7 @@ class Titles {
238
238
  * @returns AxiosPromise
239
239
  */
240
240
  public static importWishlist<T>(
241
- title_id: string,
241
+ title_id: string,
242
242
  file: File | Blob,
243
243
  data?: Record<string, any>,
244
244
  params?: Record<string, any>
@@ -255,7 +255,7 @@ class Titles {
255
255
  * @returns AxiosPromise
256
256
  */
257
257
  public static getWishlist<T>(
258
- title_id: string,
258
+ title_id: string,
259
259
  params?: Record<string, any>
260
260
  ): AxiosPromise<Response<T>> {
261
261
  let url = TitlesRoute.routes.getWishlist.url.replace('{title_id}', title_id);
@@ -266,43 +266,57 @@ class Titles {
266
266
  * Create a new API token for a title.
267
267
  * Returns { full_token: string, token: TitleToken }.
268
268
  */
269
- public static createTitleToken<T>(
270
- title_id: string,
271
- data?: { expires_at?: string }
272
- ): AxiosPromise<Response<T>> {
273
- return Requests.processRoute(
274
- TitlesRoute.routes.createToken,
275
- data,
276
- { title_id }
277
- );
278
- }
279
-
280
- /**
281
- * List all tokens for a title.
282
- */
283
- public static listTitleTokens<T>(
284
- title_id: string
285
- ): AxiosPromise<Response<T>> {
286
- return Requests.processRoute(
287
- TitlesRoute.routes.listTokens,
288
- {},
289
- { title_id }
290
- );
291
- }
292
-
293
- /**
294
- * Revoke a specific token by ID.
295
- */
296
- public static revokeTitleToken<T>(
297
- title_id: string,
298
- token_id: string
299
- ): AxiosPromise<Response<T>> {
300
- return Requests.processRoute(
301
- TitlesRoute.routes.revokeToken,
302
- {},
303
- { title_id, token_id }
304
- );
305
- }
269
+ public static createTitleToken<T>(
270
+ title_id: string,
271
+ data?: { expires_at?: string }
272
+ ): AxiosPromise<Response<T>> {
273
+ return Requests.processRoute(
274
+ TitlesRoute.routes.createToken,
275
+ data,
276
+ { title_id }
277
+ );
278
+ }
279
+
280
+ /**
281
+ * List all tokens for a title.
282
+ */
283
+ public static listTitleTokens<T>(
284
+ title_id: string
285
+ ): AxiosPromise<Response<T>> {
286
+ return Requests.processRoute(
287
+ TitlesRoute.routes.listTokens,
288
+ {},
289
+ { title_id }
290
+ );
291
+ }
292
+
293
+ /**
294
+ * Revoke a specific token by ID.
295
+ */
296
+ public static revokeTitleToken<T>(
297
+ title_id: string,
298
+ token_id: string
299
+ ): AxiosPromise<Response<T>> {
300
+ return Requests.processRoute(
301
+ TitlesRoute.routes.revokeToken,
302
+ {},
303
+ { title_id, token_id }
304
+ );
305
+ }
306
+
307
+ /**
308
+ * Search for Titles using Meilisearch or fallback based on the query and filters.
309
+ *
310
+ * @see https://api.glitch.fun/api/documentation#/Titles/searchTitles
311
+ *
312
+ * @param params Object of query params:
313
+ * - q?: string, filters?: string,
314
+ * - sort_by?: string, sort_order?: 'asc'|'desc',
315
+ * - page?: number, per_page?: number
316
+ */
317
+ public static search<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
318
+ return Requests.processRoute(TitlesRoute.routes.search, {}, undefined, params);
319
+ }
306
320
 
307
321
  }
308
322
 
package/src/api/index.ts CHANGED
@@ -29,6 +29,7 @@ import Media from "./Media";
29
29
  import Scheduler from "./Scheduler";
30
30
  import Funnel from "./Funnel";
31
31
  import SocialStats from "./SocialStats";
32
+ import Hashtags from "./Hashtags";
32
33
 
33
34
  export {Auth};
34
35
  export {Competitions};
@@ -60,4 +61,5 @@ export {PlayTests};
60
61
  export {Media};
61
62
  export {Scheduler};
62
63
  export {Funnel};
63
- export {SocialStats};
64
+ export {SocialStats};
65
+ export {Hashtags};
package/src/index.ts CHANGED
@@ -33,6 +33,7 @@ import {Media} from "./api";
33
33
  import {Scheduler} from "./api";
34
34
  import {Funnel} from "./api";
35
35
  import {SocialStats} from "./api";
36
+ import {Hashtags} from "./api";
36
37
 
37
38
 
38
39
 
@@ -74,6 +75,7 @@ class Glitch {
74
75
  Events: Events,
75
76
  Games : Games,
76
77
  GameShows : GameShows,
78
+ Hashtags: Hashtags,
77
79
  Feedback : Feedback,
78
80
  Influencers : Influencers,
79
81
  Teams: Teams,
@@ -59,6 +59,11 @@ class CommunitiesRoute {
59
59
  method: HTTP_METHODS.GET
60
60
  },
61
61
 
62
+ exportNewsletterSubscribers: {
63
+ url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers/export',
64
+ method: HTTP_METHODS.POST
65
+ },
66
+
62
67
  // Campaigns
63
68
  listCampaigns: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns', method: HTTP_METHODS.GET },
64
69
  createCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns', method: HTTP_METHODS.POST },
@@ -0,0 +1,13 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class HashtagRoute {
5
+
6
+ public static routes: { [key: string]: Route } = {
7
+ list: { url: '/hashtags', method: HTTP_METHODS.GET },
8
+ top: { url: '/hashtags/top', method: HTTP_METHODS.GET },
9
+ };
10
+
11
+ }
12
+
13
+ export default HashtagRoute;
@@ -23,6 +23,7 @@ class TitlesRoute {
23
23
  createToken: { url: '/titles/{title_id}/tokens', method: HTTP_METHODS.POST },
24
24
  listTokens: { url: '/titles/{title_id}/tokens', method: HTTP_METHODS.GET },
25
25
  revokeToken: { url: '/titles/{title_id}/tokens/{token_id}', method: HTTP_METHODS.DELETE },
26
+ search: { url: '/titles/search', method: HTTP_METHODS.GET },
26
27
  };
27
28
 
28
29
  }