glitch-javascript-sdk 1.0.1 → 1.0.3

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,29 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Games {
4
+ /**
5
+ * Get a list of Games available on he platform.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGames
8
+ *
9
+ * @returns promise
10
+ */
11
+ static listGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ /**
13
+ * Retrieve information on a single game.
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGameById
16
+ *
17
+ * @returns promise
18
+ */
19
+ static viewGame<T>(game_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
20
+ /**
21
+ * Generates campaign data for this game.
22
+ *
23
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/generateCampaign
24
+ *
25
+ * @returns promise
26
+ */
27
+ static createCampaignData<T>(game_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
28
+ }
29
+ export default Games;
@@ -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
  export { Auth };
24
25
  export { Competitions };
25
26
  export { Communities };
@@ -42,3 +43,4 @@ export { Subscriptions };
42
43
  export { Messages };
43
44
  export { Feedback };
44
45
  export { Influencers };
46
+ export { Games };
@@ -37,7 +37,7 @@ declare class Config {
37
37
  */
38
38
  static setCommunity(community: Record<string, any>): void;
39
39
  /**
40
- * Sets the root level domain so data can accessed across
40
+ * Sets the root level domain so data can be accessed across
41
41
  * multiple subdomains
42
42
  *
43
43
  * @param domain The domain ie: example.com
@@ -20,6 +20,7 @@ import { Subscriptions } from "./api";
20
20
  import { Messages } from "./api";
21
21
  import { Feedback } from "./api";
22
22
  import { Influencers } from "./api";
23
+ import { Games } from "./api";
23
24
  import Requests from "./util/Requests";
24
25
  import Parser from "./util/Parser";
25
26
  import Session from "./util/Session";
@@ -45,6 +46,7 @@ declare class Glitch {
45
46
  Communities: typeof Communities;
46
47
  Users: typeof Users;
47
48
  Events: typeof Events;
49
+ Games: typeof Games;
48
50
  Feedback: typeof Feedback;
49
51
  Influencers: typeof Influencers;
50
52
  Teams: typeof Teams;
package/dist/esm/index.js CHANGED
@@ -5716,12 +5716,16 @@ var Config = /** @class */ (function () {
5716
5716
  LabelManager.initialize(community);
5717
5717
  };
5718
5718
  /**
5719
- * Sets the root level domain so data can accessed across
5719
+ * Sets the root level domain so data can be accessed across
5720
5720
  * multiple subdomains
5721
5721
  *
5722
5722
  * @param domain The domain ie: example.com
5723
5723
  */
5724
5724
  Config.setRootDomain = function (domain) {
5725
+ if (!domain) {
5726
+ console.error("setRootDomain: domain is undefined or null");
5727
+ return;
5728
+ }
5725
5729
  var parts = domain.split('.');
5726
5730
  if (parts.length > 2) {
5727
5731
  parts.shift();
@@ -9863,6 +9867,53 @@ var Influencers = /** @class */ (function () {
9863
9867
  return Influencers;
9864
9868
  }());
9865
9869
 
9870
+ var GamesRoutes = /** @class */ (function () {
9871
+ function GamesRoutes() {
9872
+ }
9873
+ GamesRoutes.routes = {
9874
+ listGames: { url: '/games', method: HTTP_METHODS.GET },
9875
+ viewGame: { url: '/games/{game_id}', method: HTTP_METHODS.GET },
9876
+ createCampaignData: { url: '/games/{game_id}/generateCampaign', method: HTTP_METHODS.POST },
9877
+ };
9878
+ return GamesRoutes;
9879
+ }());
9880
+
9881
+ var Games = /** @class */ (function () {
9882
+ function Games() {
9883
+ }
9884
+ /**
9885
+ * Get a list of Games available on he platform.
9886
+ *
9887
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGames
9888
+ *
9889
+ * @returns promise
9890
+ */
9891
+ Games.listGames = function (params) {
9892
+ return Requests.processRoute(GamesRoutes.routes.listGames, undefined, undefined, params);
9893
+ };
9894
+ /**
9895
+ * Retrieve information on a single game.
9896
+ *
9897
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/getExternalGameById
9898
+ *
9899
+ * @returns promise
9900
+ */
9901
+ Games.viewGame = function (game_id, params) {
9902
+ return Requests.processRoute(GamesRoutes.routes.viewGame, undefined, { game_id: game_id }, params);
9903
+ };
9904
+ /**
9905
+ * Generates campaign data for this game.
9906
+ *
9907
+ * @see https://api.glitch.fun/api/documentation#/ExternalGames/generateCampaign
9908
+ *
9909
+ * @returns promise
9910
+ */
9911
+ Games.createCampaignData = function (game_id, data, params) {
9912
+ return Requests.processRoute(GamesRoutes.routes.createCampaignData, data, { game_id: game_id }, params);
9913
+ };
9914
+ return Games;
9915
+ }());
9916
+
9866
9917
  var Parser = /** @class */ (function () {
9867
9918
  function Parser() {
9868
9919
  }
@@ -10266,6 +10317,7 @@ var Glitch = /** @class */ (function () {
10266
10317
  Communities: Communities,
10267
10318
  Users: Users,
10268
10319
  Events: Events,
10320
+ Games: Games,
10269
10321
  Feedback: Feedback,
10270
10322
  Influencers: Influencers,
10271
10323
  Teams: Teams,