glitch-javascript-sdk 1.6.5 → 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.
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Hashtags.d.ts +19 -0
- package/dist/esm/api/Titles.d.ts +11 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +49 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/HashtagRoute.d.ts +7 -0
- package/dist/index.d.ts +29 -0
- package/package.json +1 -1
- package/src/api/Hashtags.ts +31 -0
- package/src/api/Titles.ts +53 -39
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/HashtagRoute.ts +13 -0
- package/src/routes/TitlesRoute.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -2956,6 +2956,17 @@ declare class Titles {
|
|
|
2956
2956
|
* Revoke a specific token by ID.
|
|
2957
2957
|
*/
|
|
2958
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>>;
|
|
2959
2970
|
}
|
|
2960
2971
|
|
|
2961
2972
|
declare class Campaigns {
|
|
@@ -4504,6 +4515,23 @@ declare class SocialStats {
|
|
|
4504
4515
|
static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4505
4516
|
}
|
|
4506
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
|
+
|
|
4507
4535
|
interface Route {
|
|
4508
4536
|
url: string;
|
|
4509
4537
|
method: string;
|
|
@@ -4811,6 +4839,7 @@ declare class Glitch {
|
|
|
4811
4839
|
Events: typeof Events;
|
|
4812
4840
|
Games: typeof Games;
|
|
4813
4841
|
GameShows: typeof GameShows;
|
|
4842
|
+
Hashtags: typeof Hashtags;
|
|
4814
4843
|
Feedback: typeof Feedback;
|
|
4815
4844
|
Influencers: typeof Influencers;
|
|
4816
4845
|
Teams: typeof Teams;
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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;
|
|
@@ -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
|
}
|