glitch-javascript-sdk 1.0.2 → 1.0.4

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 GamesRoutes {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default GamesRoutes;
package/dist/index.d.ts CHANGED
@@ -973,6 +973,17 @@ declare class Users {
973
973
  * @returns promise
974
974
  */
975
975
  static syncInfluencer<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
976
+ /**
977
+ * Create profile data for an influencer based on their synced information and social media posts.
978
+ *
979
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/generateUserInfluencerProfile
980
+ *
981
+ * @param user_id The id of the user to update.
982
+ * @param data The data to update.
983
+ *
984
+ * @returns promise
985
+ */
986
+ static generateInfluencerProfile<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
976
987
  /**
977
988
  * Will follow and unfollow a user. If the user is not being following, it will follow the user. If they are following, it will unfollow the user. The current JWT is used for the follower.
978
989
  *
@@ -2966,6 +2977,41 @@ declare class Influencers {
2966
2977
  * @returns promise
2967
2978
  */
2968
2979
  static viewInfluencer<T>(influencer_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2980
+ /**
2981
+ * Generate a profile for an influencer based on their data.
2982
+ *
2983
+ * @see https://api.glitch.fun/api/documentation#/Influencers/generateInfluencerProfile
2984
+ *
2985
+ * @returns promise
2986
+ */
2987
+ static generateProfile<T>(influencer_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2988
+ }
2989
+
2990
+ declare class Games {
2991
+ /**
2992
+ * Get a list of Games available on he platform.
2993
+ *
2994
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGames
2995
+ *
2996
+ * @returns promise
2997
+ */
2998
+ static listGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2999
+ /**
3000
+ * Retrieve information on a single game.
3001
+ *
3002
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGameById
3003
+ *
3004
+ * @returns promise
3005
+ */
3006
+ static viewGame<T>(game_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3007
+ /**
3008
+ * Generates campaign data for this game.
3009
+ *
3010
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/generateCampaign
3011
+ *
3012
+ * @returns promise
3013
+ */
3014
+ static createCampaignData<T>(game_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
2969
3015
  }
2970
3016
 
2971
3017
  interface Route {
@@ -3273,6 +3319,7 @@ declare class Glitch {
3273
3319
  Communities: typeof Communities;
3274
3320
  Users: typeof Users;
3275
3321
  Events: typeof Events;
3322
+ Games: typeof Games;
3276
3323
  Feedback: typeof Feedback;
3277
3324
  Influencers: typeof Influencers;
3278
3325
  Teams: typeof Teams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,43 @@
1
+ import GamesRoutes from "../routes/GamesRoutes";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class Games {
7
+
8
+ /**
9
+ * Get a list of Games available on he platform.
10
+ *
11
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGames
12
+ *
13
+ * @returns promise
14
+ */
15
+ public static listGames<T>(params?: Record<string, any>) : AxiosPromise<Response<T>> {
16
+ return Requests.processRoute(GamesRoutes.routes.listGames, undefined, undefined, params);
17
+ }
18
+
19
+ /**
20
+ * Retrieve information on a single game.
21
+ *
22
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGameById
23
+ *
24
+ * @returns promise
25
+ */
26
+ public static viewGame<T>(game_id : string, params?: Record<string, any>) : AxiosPromise<Response<T>> {
27
+ return Requests.processRoute(GamesRoutes.routes.viewGame, undefined, {game_id : game_id}, params);
28
+ }
29
+
30
+ /**
31
+ * Generates campaign data for this game.
32
+ *
33
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/generateCampaign
34
+ *
35
+ * @returns promise
36
+ */
37
+ public static createCampaignData<T>(game_id : string, data?: object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
38
+ return Requests.processRoute(GamesRoutes.routes.createCampaignData, data, {game_id : game_id}, params);
39
+ }
40
+
41
+ }
42
+
43
+ export default Games;
@@ -27,6 +27,17 @@ class Influencers {
27
27
  return Requests.processRoute(InfluencerRoutes.routes.viewInfluencer, undefined, {influencer_id : influencer_id}, params);
28
28
  }
29
29
 
30
+ /**
31
+ * Generate a profile for an influencer based on their data.
32
+ *
33
+ * @see https://api.glitch.fun/api/documentation#/Influencers/generateInfluencerProfile
34
+ *
35
+ * @returns promise
36
+ */
37
+ public static generateProfile<T>(influencer_id : string, params?: Record<string, any>) : AxiosPromise<Response<T>> {
38
+ return Requests.processRoute(InfluencerRoutes.routes.generateProfile, undefined, {influencer_id : influencer_id}, params);
39
+ }
40
+
30
41
  }
31
42
 
32
43
  export default Influencers;
package/src/api/Users.ts CHANGED
@@ -91,6 +91,22 @@ class Users {
91
91
  return Requests.processRoute(UserRoutes.routes.syncInfluencer, {}, undefined, params);
92
92
  }
93
93
 
94
+ /**
95
+ * Create profile data for an influencer based on their synced information and social media posts.
96
+ *
97
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/generateUserInfluencerProfile
98
+ *
99
+ * @param user_id The id of the user to update.
100
+ * @param data The data to update.
101
+ *
102
+ * @returns promise
103
+ */
104
+ public static generateInfluencerProfile<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
105
+
106
+ return Requests.processRoute(UserRoutes.routes.generateInfluencerProfile, {}, undefined, params);
107
+ }
108
+
109
+
94
110
  /**
95
111
  * Will follow and unfollow a user. If the user is not being following, it will follow the user. If they are following, it will unfollow the user. The current JWT is used for the follower.
96
112
  *
package/src/api/index.ts CHANGED
@@ -20,6 +20,7 @@ import Subscriptions from "./Subscriptions";
20
20
  import Messages from "./Messages";
21
21
  import Feedback from "./Feedback";
22
22
  import Influencers from "./Influencers";
23
+ import Games from "./Games";
23
24
 
24
25
  export {Auth};
25
26
  export {Competitions};
@@ -42,4 +43,5 @@ export {Campaigns};
42
43
  export {Subscriptions};
43
44
  export {Messages};
44
45
  export {Feedback};
45
- export {Influencers};
46
+ export {Influencers};
47
+ export {Games};
package/src/index.ts CHANGED
@@ -24,6 +24,7 @@ import {Subscriptions} from "./api";
24
24
  import {Messages} from "./api";
25
25
  import {Feedback} from "./api";
26
26
  import {Influencers} from "./api";
27
+ import {Games} from "./api";
27
28
 
28
29
 
29
30
 
@@ -63,6 +64,7 @@ class Glitch {
63
64
  Communities : Communities,
64
65
  Users: Users,
65
66
  Events: Events,
67
+ Games : Games,
66
68
  Feedback : Feedback,
67
69
  Influencers : Influencers,
68
70
  Teams: Teams,
@@ -0,0 +1,14 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class GamesRoutes {
5
+
6
+ public static routes: { [key: string]: Route } = {
7
+ listGames: { url: '/games', method: HTTP_METHODS.GET },
8
+ viewGame: { url: '/games/{game_id}', method: HTTP_METHODS.GET },
9
+ createCampaignData: { url: '/games/{game_id}/generateCampaign', method: HTTP_METHODS.POST },
10
+ };
11
+
12
+ }
13
+
14
+ export default GamesRoutes;
@@ -6,6 +6,8 @@ class InfluencerRoutes {
6
6
  public static routes: { [key: string]: Route } = {
7
7
  listInfluencers: { url: '/influencers', method: HTTP_METHODS.GET },
8
8
  viewInfluencer: { url: '/influencers/{influencer_id}', method: HTTP_METHODS.GET },
9
+ generateProfile: { url: '/influencers/{influencer_id}/generateProfile', method: HTTP_METHODS.POST },
10
+
9
11
  };
10
12
 
11
13
  }
@@ -10,6 +10,7 @@ class UserRoutes {
10
10
  profile :{ url: '/users/{user_id}/profile', method: HTTP_METHODS.GET },
11
11
  me : { url: '/users/me', method: HTTP_METHODS.GET },
12
12
  syncInfluencer : { url: '/users/syncInfluencer', method: HTTP_METHODS.POST },
13
+ generateInfluencerProfile : { url: '/users/generateInfluencerProfile', method: HTTP_METHODS.POST },
13
14
  oneTimeToken : { url: '/users/oneTimeToken', method: HTTP_METHODS.GET },
14
15
  uploadAvatar : { url: '/users/uploadAvatarImage', method: HTTP_METHODS.POST },
15
16
  uploadBanner : { url: '/users/uploadBannerImage', method: HTTP_METHODS.POST },