glitch-javascript-sdk 3.5.3 → 3.6.0

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 GameAdvertisingRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default GameAdvertisingRoute;
package/dist/index.d.ts CHANGED
@@ -11027,6 +11027,28 @@ declare class MarketResearch {
11027
11027
  static exportGame(game_id: string, params?: Record<string, any>): AxiosPromise<Blob>;
11028
11028
  }
11029
11029
 
11030
+ interface GameAdEventPayload {
11031
+ token: string;
11032
+ event_uuid?: string;
11033
+ provider: string;
11034
+ placement: string;
11035
+ format: 'banner' | 'video' | 'interstitial' | 'rewarded' | 'other';
11036
+ event_type: 'sdk_ready' | 'request_started' | 'loaded' | 'no_fill' | 'started' | 'impression' | 'viewable' | 'clicked' | 'completed' | 'skipped' | 'closed' | 'paused_game' | 'resumed_game' | 'error';
11037
+ provider_event_id?: string;
11038
+ metadata?: Record<string, any>;
11039
+ occurred_at?: string;
11040
+ }
11041
+ declare class GameAdvertising {
11042
+ static settings<T>(title_id: string): AxiosPromise<Response<T>>;
11043
+ static updateSettings<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
11044
+ static createSession<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
11045
+ static storeEvent<T>(title_id: string, session_id: string, data: GameAdEventPayload): AxiosPromise<Response<T>>;
11046
+ static revenueSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
11047
+ static adminDashboard<T>(): AxiosPromise<Response<T>>;
11048
+ static adminUpdateSettings<T>(data: object): AxiosPromise<Response<T>>;
11049
+ static adminStoreRevenue<T>(data: object): AxiosPromise<Response<T>>;
11050
+ }
11051
+
11030
11052
  interface Route {
11031
11053
  url: string;
11032
11054
  method: string;
@@ -11397,6 +11419,7 @@ declare class Glitch {
11397
11419
  AdminReports: typeof AdminReports;
11398
11420
  AdminUsers: typeof AdminUsers;
11399
11421
  MarketResearch: typeof MarketResearch;
11422
+ GameAdvertising: typeof GameAdvertising;
11400
11423
  };
11401
11424
  static util: {
11402
11425
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "types": "dist/index.d.ts",
15
15
  "scripts": {
16
- "test": "echo \"Error: no test specified\" && exit 1",
16
+ "test": "node scripts/test-game-advertising-routes.cjs",
17
17
  "build": "rm -Rf dist && rollup -c --bundleConfigAsCjs",
18
18
  "build-docs": "rm -rf docs && typedoc --tsconfig tsconfig.json src/"
19
19
  },
@@ -0,0 +1,52 @@
1
+ import { AxiosPromise } from 'axios';
2
+ import GameAdvertisingRoute from '../routes/GameAdvertisingRoute';
3
+ import Requests from '../util/Requests';
4
+ import Response from '../util/Response';
5
+
6
+ export interface GameAdEventPayload {
7
+ token: string;
8
+ event_uuid?: string;
9
+ provider: string;
10
+ placement: string;
11
+ format: 'banner' | 'video' | 'interstitial' | 'rewarded' | 'other';
12
+ event_type: 'sdk_ready' | 'request_started' | 'loaded' | 'no_fill' | 'started' | 'impression' | 'viewable' | 'clicked' | 'completed' | 'skipped' | 'closed' | 'paused_game' | 'resumed_game' | 'error';
13
+ provider_event_id?: string;
14
+ metadata?: Record<string, any>;
15
+ occurred_at?: string;
16
+ }
17
+
18
+ class GameAdvertising {
19
+ public static settings<T>(title_id: string): AxiosPromise<Response<T>> {
20
+ return Requests.processRoute(GameAdvertisingRoute.routes.settings, undefined, { title_id });
21
+ }
22
+
23
+ public static updateSettings<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
24
+ return Requests.processRoute(GameAdvertisingRoute.routes.updateSettings, data, { title_id });
25
+ }
26
+
27
+ public static createSession<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
28
+ return Requests.processRoute(GameAdvertisingRoute.routes.createSession, data, { title_id });
29
+ }
30
+
31
+ public static storeEvent<T>(title_id: string, session_id: string, data: GameAdEventPayload): AxiosPromise<Response<T>> {
32
+ return Requests.processRoute(GameAdvertisingRoute.routes.storeEvent, data, { title_id, session_id });
33
+ }
34
+
35
+ public static revenueSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
36
+ return Requests.processRoute(GameAdvertisingRoute.routes.revenueSummary, undefined, { title_id }, params);
37
+ }
38
+
39
+ public static adminDashboard<T>(): AxiosPromise<Response<T>> {
40
+ return Requests.processRoute(GameAdvertisingRoute.routes.adminDashboard);
41
+ }
42
+
43
+ public static adminUpdateSettings<T>(data: object): AxiosPromise<Response<T>> {
44
+ return Requests.processRoute(GameAdvertisingRoute.routes.adminUpdateSettings, data);
45
+ }
46
+
47
+ public static adminStoreRevenue<T>(data: object): AxiosPromise<Response<T>> {
48
+ return Requests.processRoute(GameAdvertisingRoute.routes.adminStoreRevenue, data);
49
+ }
50
+ }
51
+
52
+ export default GameAdvertising;
package/src/api/Titles.ts CHANGED
@@ -1316,7 +1316,7 @@ class Titles {
1316
1316
  }
1317
1317
 
1318
1318
  /**
1319
- * Get a consolidated report of all earnings for a title, including
1319
+ * Get a consolidated report of all earnings for a title, including
1320
1320
  * playtime payouts, direct premium purchases, and rentals (minus refunds).
1321
1321
  *
1322
1322
  * @param title_id The UUID of the title.
package/src/api/index.ts CHANGED
@@ -51,6 +51,7 @@ import PrDirectory from "./PrDirectory";
51
51
  import AdminReports from "./AdminReports";
52
52
  import AdminUsers from "./AdminUsers";
53
53
  import MarketResearch from "./MarketResearch";
54
+ import GameAdvertising from './GameAdvertising';
54
55
 
55
56
  export {Ads};
56
57
  export {AccessKeys};
@@ -105,3 +106,4 @@ export {PrDirectory};
105
106
  export {AdminReports};
106
107
  export {AdminUsers};
107
108
  export {MarketResearch};
109
+ export {GameAdvertising};
package/src/index.ts CHANGED
@@ -55,6 +55,7 @@ import {PrDirectory} from './api';
55
55
  import {AdminReports} from './api';
56
56
  import {AdminUsers} from './api';
57
57
  import {MarketResearch} from './api';
58
+ import {GameAdvertising} from './api';
58
59
 
59
60
  import Requests from "./util/Requests";
60
61
  import Parser from "./util/Parser";
@@ -139,6 +140,7 @@ class Glitch {
139
140
  AdminReports : AdminReports,
140
141
  AdminUsers : AdminUsers,
141
142
  MarketResearch : MarketResearch,
143
+ GameAdvertising: GameAdvertising,
142
144
  }
143
145
 
144
146
  public static util = {
@@ -0,0 +1,17 @@
1
+ import Route from './interface';
2
+ import HTTP_METHODS from '../constants/HttpMethods';
3
+
4
+ class GameAdvertisingRoute {
5
+ public static routes: { [key: string]: Route } = {
6
+ settings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.GET },
7
+ updateSettings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.PUT },
8
+ createSession: { url: '/titles/{title_id}/advertising/sessions', method: HTTP_METHODS.POST },
9
+ storeEvent: { url: '/titles/{title_id}/advertising/sessions/{session_id}/events', method: HTTP_METHODS.POST },
10
+ revenueSummary: { url: '/titles/{title_id}/advertising/revenue-summary', method: HTTP_METHODS.GET },
11
+ adminDashboard: { url: '/admin/game-advertising', method: HTTP_METHODS.GET },
12
+ adminUpdateSettings: { url: '/admin/game-advertising/settings', method: HTTP_METHODS.PUT },
13
+ adminStoreRevenue: { url: '/admin/game-advertising/revenue', method: HTTP_METHODS.POST },
14
+ };
15
+ }
16
+
17
+ export default GameAdvertisingRoute;