glitch-javascript-sdk 1.6.5 → 1.6.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.
@@ -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
@@ -2766,6 +2766,14 @@ declare class SocialPosts {
2766
2766
  * @returns promise
2767
2767
  */
2768
2768
  static updatePostImpressions<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2769
+ /**
2770
+ * Get reports on all the the short links
2771
+ *
2772
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
2773
+ *
2774
+ * @returns promise
2775
+ */
2776
+ static shortLinkReports<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2769
2777
  }
2770
2778
 
2771
2779
  declare class Titles {
@@ -2956,6 +2964,17 @@ declare class Titles {
2956
2964
  * Revoke a specific token by ID.
2957
2965
  */
2958
2966
  static revokeTitleToken<T>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
2967
+ /**
2968
+ * Search for Titles using Meilisearch or fallback based on the query and filters.
2969
+ *
2970
+ * @see https://api.glitch.fun/api/documentation#/Titles/searchTitles
2971
+ *
2972
+ * @param params Object of query params:
2973
+ * - q?: string, filters?: string,
2974
+ * - sort_by?: string, sort_order?: 'asc'|'desc',
2975
+ * - page?: number, per_page?: number
2976
+ */
2977
+ static search<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2959
2978
  }
2960
2979
 
2961
2980
  declare class Campaigns {
@@ -4504,6 +4523,23 @@ declare class SocialStats {
4504
4523
  static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4505
4524
  }
4506
4525
 
4526
+ declare class Hashtags {
4527
+ /**
4528
+ * List all the hashtags
4529
+ *
4530
+ *
4531
+ * @returns A promise
4532
+ */
4533
+ static list<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4534
+ /**
4535
+ * Get the top hashtags for a title, campaign, or schedule.
4536
+ *
4537
+ * @param params - e.g. { title_id: '...', limit: 10, sort: 'sum_views', start_date: 'YYYY-MM-DD', end_date: 'YYYY-MM-DD' }
4538
+ * @returns AxiosPromise of an array of aggregated hashtags
4539
+ */
4540
+ static top<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4541
+ }
4542
+
4507
4543
  interface Route {
4508
4544
  url: string;
4509
4545
  method: string;
@@ -4811,6 +4847,7 @@ declare class Glitch {
4811
4847
  Events: typeof Events;
4812
4848
  Games: typeof Games;
4813
4849
  GameShows: typeof GameShows;
4850
+ Hashtags: typeof Hashtags;
4814
4851
  Feedback: typeof Feedback;
4815
4852
  Influencers: typeof Influencers;
4816
4853
  Teams: typeof Teams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.6.5",
3
+ "version": "1.6.7",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -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.top, data, {}, params);
27
+ }
28
+
29
+ }
30
+
31
+ export default Hashtags;
@@ -179,6 +179,17 @@ class SocialPosts {
179
179
  return Requests.processRoute(SocialPostsRoute.routes.updatePostImpressions, data, { post_id: post_id }, params);
180
180
  }
181
181
 
182
+ /**
183
+ * Get reports on all the the short links
184
+ *
185
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
186
+ *
187
+ * @returns promise
188
+ */
189
+ public static shortLinkReports<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
190
+ return Requests.processRoute(SocialPostsRoute.routes.shortLinkReports, undefined, undefined, params);
191
+ }
192
+
182
193
  }
183
194
 
184
195
  export default SocialPosts;
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,
@@ -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;
@@ -17,6 +17,7 @@ class SocialPostsRoute {
17
17
  reschedule: { url: '/socialposts/{post_id}/reschedule', method: HTTP_METHODS.POST },
18
18
  reports: { url: '/socialposts/{post_id}/reports', method: HTTP_METHODS.GET },
19
19
  updatePostImpressions : { url: '/socialposts/{post_id}/impressions', method: HTTP_METHODS.PUT },
20
+ shortLinkReports: { url: '/socialposts/shortlinks/reports', method: HTTP_METHODS.GET },
20
21
 
21
22
  };
22
23
 
@@ -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
  }