glitch-javascript-sdk 3.5.3 → 3.7.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.
- package/dist/cjs/index.js +89 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/GameAdvertising.d.ts +88 -0
- package/dist/esm/api/Users.d.ts +49 -4
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +89 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/GameAdvertisingRoute.d.ts +11 -0
- package/dist/index.d.ts +136 -4
- package/package.json +2 -2
- package/src/api/GameAdvertising.ts +130 -0
- package/src/api/Titles.ts +1 -1
- package/src/api/Users.ts +53 -4
- package/src/api/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/routes/GameAdvertisingRoute.ts +25 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { AxiosPromise } from 'axios';
|
|
2
|
+
import Response from '../util/Response';
|
|
3
|
+
export interface GameAdEventPayload {
|
|
4
|
+
/** Opaque token returned by the server-created advertising manifest. */
|
|
5
|
+
token: string;
|
|
6
|
+
/** Client idempotency UUID. Reuse is valid only within the same ad session. */
|
|
7
|
+
event_uuid?: string;
|
|
8
|
+
/** Provider that produced or attempted the event. */
|
|
9
|
+
provider: string;
|
|
10
|
+
/** Stable Glitch placement name, such as game_banner or game_video. */
|
|
11
|
+
placement: string;
|
|
12
|
+
/** Normalized creative/ad format. */
|
|
13
|
+
format: 'banner' | 'video' | 'interstitial' | 'rewarded' | 'in_game_image' | 'in_game_video' | 'other';
|
|
14
|
+
/** Normalized SDK/ad lifecycle event. */
|
|
15
|
+
event_type: 'sdk_ready' | 'request_started' | 'loaded' | 'channel_registered' | 'measurement' | 'no_fill' | 'fallback_shown' | 'started' | 'impression' | 'viewable' | 'clicked' | 'completed' | 'skipped' | 'closed' | 'paused_game' | 'resumed_game' | 'error';
|
|
16
|
+
/** Optional provider-native event or impression identifier. */
|
|
17
|
+
provider_event_id?: string;
|
|
18
|
+
/** Non-sensitive provider diagnostics and event context. */
|
|
19
|
+
metadata?: Record<string, any>;
|
|
20
|
+
/** ISO 8601 client-observed timestamp. Defaults to server receipt time. */
|
|
21
|
+
occurred_at?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Provider-neutral intrinsic-ad surface declared by a game developer. */
|
|
24
|
+
export interface GameInGameAdPlacement {
|
|
25
|
+
id?: string;
|
|
26
|
+
title_id?: string;
|
|
27
|
+
provider?: 'anzu';
|
|
28
|
+
placement_key: string;
|
|
29
|
+
channel_name: string;
|
|
30
|
+
surface_type: 'mesh' | 'sprite' | 'ui_image' | 'raw_image' | 'html' | 'electron_shell';
|
|
31
|
+
scene_name?: string | null;
|
|
32
|
+
aspect_ratio: number;
|
|
33
|
+
allow_images: boolean;
|
|
34
|
+
allow_videos: boolean;
|
|
35
|
+
allow_audio?: boolean;
|
|
36
|
+
is_dynamic: boolean;
|
|
37
|
+
is_clickable: boolean;
|
|
38
|
+
shrink_to_fit: boolean;
|
|
39
|
+
fallback_media_url?: string | null;
|
|
40
|
+
status: 'active' | 'disabled';
|
|
41
|
+
metadata?: Record<string, any> | null;
|
|
42
|
+
}
|
|
43
|
+
/** Public delivery identity for a provider and runtime platform. */
|
|
44
|
+
export interface GameAdProviderApp {
|
|
45
|
+
id?: string;
|
|
46
|
+
title_id?: string | null;
|
|
47
|
+
provider: 'anzu';
|
|
48
|
+
platform: 'web' | 'electron_macos' | 'electron_windows' | 'electron_linux' | 'unity_webgl' | 'cocos_web' | 'construct_web';
|
|
49
|
+
app_key: string;
|
|
50
|
+
bundle_id?: string | null;
|
|
51
|
+
mode: 'integration' | 'production';
|
|
52
|
+
integration_type: 'managed' | 'direct';
|
|
53
|
+
status: 'active' | 'disabled' | 'pending';
|
|
54
|
+
metadata?: Record<string, any> | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Typed client for platform-served game advertising.
|
|
58
|
+
*
|
|
59
|
+
* These endpoints manage publisher inventory displayed around playable games;
|
|
60
|
+
* they are intentionally separate from APIs used to buy advertising campaigns.
|
|
61
|
+
*/
|
|
62
|
+
declare class GameAdvertising {
|
|
63
|
+
/** Return developer-visible ad-earnings settings for a title. */
|
|
64
|
+
static settings<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
65
|
+
/** Update developer ad-earnings activation and optional title provider ID. */
|
|
66
|
+
static updateSettings<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
67
|
+
/** Resolve ad eligibility and create an expiring provider manifest/session. */
|
|
68
|
+
static createSession<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
69
|
+
/** Store one normalized, idempotent event for an advertising session. */
|
|
70
|
+
static storeEvent<T>(title_id: string, session_id: string, data: GameAdEventPayload): AxiosPromise<Response<T>>;
|
|
71
|
+
/** Return developer-visible estimated/finalized earnings and delivery totals. */
|
|
72
|
+
static revenueSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
73
|
+
/** Return every intrinsic-ad surface configured for a title. */
|
|
74
|
+
static inGamePlacements<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
75
|
+
/** Atomically replace a title's provider-neutral intrinsic-ad surfaces. */
|
|
76
|
+
static replaceInGamePlacements<T>(title_id: string, placements: GameInGameAdPlacement[]): AxiosPromise<Response<T>>;
|
|
77
|
+
/** Return site-admin delivery settings, aggregate metrics, and recent revenue. */
|
|
78
|
+
static adminDashboard<T>(): AxiosPromise<Response<T>>;
|
|
79
|
+
/** Partially update platform-wide providers and delivery frequency. */
|
|
80
|
+
static adminUpdateSettings<T>(data: object): AxiosPromise<Response<T>>;
|
|
81
|
+
/** Import or reconcile one provider revenue report row. */
|
|
82
|
+
static adminStoreRevenue<T>(data: object): AxiosPromise<Response<T>>;
|
|
83
|
+
/** Return public provider app keys and platform mappings for site admins. */
|
|
84
|
+
static adminProviderApps<T>(): AxiosPromise<Response<T>>;
|
|
85
|
+
/** Create or update a provider app mapping without accepting report secrets. */
|
|
86
|
+
static adminUpsertProviderApp<T>(data: GameAdProviderApp): AxiosPromise<Response<T>>;
|
|
87
|
+
}
|
|
88
|
+
export default GameAdvertising;
|
package/dist/esm/api/Users.d.ts
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
import Response from "../util/Response";
|
|
2
2
|
import { AxiosPromise } from "axios";
|
|
3
|
+
/** Human-readable earning categories returned by influencer payout APIs. */
|
|
4
|
+
export type InfluencerPayoutSourceType = "campaign_compensation" | "ad_revenue_share" | "subscription_residual" | "manual_adjustment";
|
|
5
|
+
/** Auditable metrics and creator-content attribution attached to a payout. */
|
|
6
|
+
export interface InfluencerPayoutBreakdown {
|
|
7
|
+
label?: string;
|
|
8
|
+
payment_method?: "flat" | "performance" | "hybrid";
|
|
9
|
+
provider?: string;
|
|
10
|
+
period_start?: string;
|
|
11
|
+
period_end?: string;
|
|
12
|
+
impressions?: number;
|
|
13
|
+
clicks?: number;
|
|
14
|
+
short_link_id?: string | null;
|
|
15
|
+
short_link_click_id?: string | null;
|
|
16
|
+
social_media_post_id?: string | null;
|
|
17
|
+
tracking_link_label?: string | null;
|
|
18
|
+
social_platform?: string | null;
|
|
19
|
+
social_post_url?: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** One campaign or advertising earning payable to the authenticated influencer. */
|
|
22
|
+
export interface InfluencerPayout {
|
|
23
|
+
id: string;
|
|
24
|
+
user_id: string;
|
|
25
|
+
campaign_id: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
currency: string;
|
|
28
|
+
status: "pending" | "completed" | "failed";
|
|
29
|
+
payout_date?: string | null;
|
|
30
|
+
source_type: InfluencerPayoutSourceType;
|
|
31
|
+
source_label: string;
|
|
32
|
+
source_reference_id?: string | null;
|
|
33
|
+
breakdown?: InfluencerPayoutBreakdown;
|
|
34
|
+
campaign?: Record<string, any>;
|
|
35
|
+
}
|
|
36
|
+
/** Optional filters for the authenticated influencer's payout history. */
|
|
37
|
+
export interface InfluencerPayoutQuery {
|
|
38
|
+
campaign_id?: string;
|
|
39
|
+
month?: number;
|
|
40
|
+
year?: number;
|
|
41
|
+
amount?: number;
|
|
42
|
+
status?: "pending" | "completed" | "failed";
|
|
43
|
+
source_type?: InfluencerPayoutSourceType;
|
|
44
|
+
orderBy?: "created_at" | "amount";
|
|
45
|
+
orderDirection?: "asc" | "desc";
|
|
46
|
+
}
|
|
3
47
|
declare class Users {
|
|
4
48
|
/**
|
|
5
49
|
* List all the users.
|
|
@@ -42,16 +86,17 @@ declare class Users {
|
|
|
42
86
|
*/
|
|
43
87
|
static getCampaignInvites<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
44
88
|
/**
|
|
45
|
-
* Gets payouts from
|
|
89
|
+
* Gets the authenticated influencer's payouts from campaigns and attributed
|
|
90
|
+
* game advertising. Advertising revenue is returned as a separate additive
|
|
91
|
+
* source with provider-period metrics and tracking-link/social-post IDs.
|
|
46
92
|
*
|
|
47
93
|
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
48
94
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param data The data to update.
|
|
95
|
+
* @param params Optional campaign, date, status, source, and ordering filters.
|
|
51
96
|
*
|
|
52
97
|
* @returns promise
|
|
53
98
|
*/
|
|
54
|
-
static getPayouts<T>(params?:
|
|
99
|
+
static getPayouts<T = InfluencerPayout[]>(params?: InfluencerPayoutQuery): AxiosPromise<Response<T>>;
|
|
55
100
|
/**
|
|
56
101
|
* Sync the current influencer's information.
|
|
57
102
|
*
|
package/dist/esm/api/index.d.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
|
export { Ads };
|
|
55
56
|
export { AccessKeys };
|
|
56
57
|
export { Auth };
|
|
@@ -104,3 +105,4 @@ export { PrDirectory };
|
|
|
104
105
|
export { AdminReports };
|
|
105
106
|
export { AdminUsers };
|
|
106
107
|
export { MarketResearch };
|
|
108
|
+
export { GameAdvertising };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ import { PrDirectory } from './api';
|
|
|
51
51
|
import { AdminReports } from './api';
|
|
52
52
|
import { AdminUsers } from './api';
|
|
53
53
|
import { MarketResearch } from './api';
|
|
54
|
+
import { GameAdvertising } from './api';
|
|
54
55
|
import Requests from "./util/Requests";
|
|
55
56
|
import Parser from "./util/Parser";
|
|
56
57
|
import Session from "./util/Session";
|
|
@@ -123,6 +124,7 @@ declare class Glitch {
|
|
|
123
124
|
AdminReports: typeof AdminReports;
|
|
124
125
|
AdminUsers: typeof AdminUsers;
|
|
125
126
|
MarketResearch: typeof MarketResearch;
|
|
127
|
+
GameAdvertising: typeof GameAdvertising;
|
|
126
128
|
};
|
|
127
129
|
static util: {
|
|
128
130
|
Requests: typeof Requests;
|
package/dist/esm/index.js
CHANGED
|
@@ -9045,12 +9045,13 @@ var Users = /** @class */ (function () {
|
|
|
9045
9045
|
return Requests.processRoute(UserRoutes.routes.getCampaignInvites, {}, undefined, params);
|
|
9046
9046
|
};
|
|
9047
9047
|
/**
|
|
9048
|
-
* Gets payouts from
|
|
9048
|
+
* Gets the authenticated influencer's payouts from campaigns and attributed
|
|
9049
|
+
* game advertising. Advertising revenue is returned as a separate additive
|
|
9050
|
+
* source with provider-period metrics and tracking-link/social-post IDs.
|
|
9049
9051
|
*
|
|
9050
9052
|
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
9051
9053
|
*
|
|
9052
|
-
* @param
|
|
9053
|
-
* @param data The data to update.
|
|
9054
|
+
* @param params Optional campaign, date, status, source, and ordering filters.
|
|
9054
9055
|
*
|
|
9055
9056
|
* @returns promise
|
|
9056
9057
|
*/
|
|
@@ -20958,6 +20959,90 @@ var MarketResearch = /** @class */ (function () {
|
|
|
20958
20959
|
return MarketResearch;
|
|
20959
20960
|
}());
|
|
20960
20961
|
|
|
20962
|
+
var GameAdvertisingRoute = /** @class */ (function () {
|
|
20963
|
+
function GameAdvertisingRoute() {
|
|
20964
|
+
}
|
|
20965
|
+
/**
|
|
20966
|
+
* Route templates for publisher game-ad inventory, telemetry, earnings, and
|
|
20967
|
+
* site administration. Placeholders are expanded by Requests.processRoute.
|
|
20968
|
+
*/
|
|
20969
|
+
GameAdvertisingRoute.routes = {
|
|
20970
|
+
settings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.GET },
|
|
20971
|
+
updateSettings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.PUT },
|
|
20972
|
+
createSession: { url: '/titles/{title_id}/advertising/sessions', method: HTTP_METHODS.POST },
|
|
20973
|
+
storeEvent: { url: '/titles/{title_id}/advertising/sessions/{session_id}/events', method: HTTP_METHODS.POST },
|
|
20974
|
+
revenueSummary: { url: '/titles/{title_id}/advertising/revenue-summary', method: HTTP_METHODS.GET },
|
|
20975
|
+
inGamePlacements: { url: '/titles/{title_id}/advertising/in-game/placements', method: HTTP_METHODS.GET },
|
|
20976
|
+
replaceInGamePlacements: { url: '/titles/{title_id}/advertising/in-game/placements', method: HTTP_METHODS.PUT },
|
|
20977
|
+
adminDashboard: { url: '/admin/game-advertising', method: HTTP_METHODS.GET },
|
|
20978
|
+
adminUpdateSettings: { url: '/admin/game-advertising/settings', method: HTTP_METHODS.PUT },
|
|
20979
|
+
adminStoreRevenue: { url: '/admin/game-advertising/revenue', method: HTTP_METHODS.POST },
|
|
20980
|
+
adminProviderApps: { url: '/admin/game-advertising/provider-apps', method: HTTP_METHODS.GET },
|
|
20981
|
+
adminUpsertProviderApp: { url: '/admin/game-advertising/provider-apps', method: HTTP_METHODS.PUT },
|
|
20982
|
+
};
|
|
20983
|
+
return GameAdvertisingRoute;
|
|
20984
|
+
}());
|
|
20985
|
+
|
|
20986
|
+
/**
|
|
20987
|
+
* Typed client for platform-served game advertising.
|
|
20988
|
+
*
|
|
20989
|
+
* These endpoints manage publisher inventory displayed around playable games;
|
|
20990
|
+
* they are intentionally separate from APIs used to buy advertising campaigns.
|
|
20991
|
+
*/
|
|
20992
|
+
var GameAdvertising = /** @class */ (function () {
|
|
20993
|
+
function GameAdvertising() {
|
|
20994
|
+
}
|
|
20995
|
+
/** Return developer-visible ad-earnings settings for a title. */
|
|
20996
|
+
GameAdvertising.settings = function (title_id) {
|
|
20997
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.settings, undefined, { title_id: title_id });
|
|
20998
|
+
};
|
|
20999
|
+
/** Update developer ad-earnings activation and optional title provider ID. */
|
|
21000
|
+
GameAdvertising.updateSettings = function (title_id, data) {
|
|
21001
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.updateSettings, data, { title_id: title_id });
|
|
21002
|
+
};
|
|
21003
|
+
/** Resolve ad eligibility and create an expiring provider manifest/session. */
|
|
21004
|
+
GameAdvertising.createSession = function (title_id, data) {
|
|
21005
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.createSession, data, { title_id: title_id });
|
|
21006
|
+
};
|
|
21007
|
+
/** Store one normalized, idempotent event for an advertising session. */
|
|
21008
|
+
GameAdvertising.storeEvent = function (title_id, session_id, data) {
|
|
21009
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.storeEvent, data, { title_id: title_id, session_id: session_id });
|
|
21010
|
+
};
|
|
21011
|
+
/** Return developer-visible estimated/finalized earnings and delivery totals. */
|
|
21012
|
+
GameAdvertising.revenueSummary = function (title_id, params) {
|
|
21013
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.revenueSummary, undefined, { title_id: title_id }, params);
|
|
21014
|
+
};
|
|
21015
|
+
/** Return every intrinsic-ad surface configured for a title. */
|
|
21016
|
+
GameAdvertising.inGamePlacements = function (title_id) {
|
|
21017
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.inGamePlacements, undefined, { title_id: title_id });
|
|
21018
|
+
};
|
|
21019
|
+
/** Atomically replace a title's provider-neutral intrinsic-ad surfaces. */
|
|
21020
|
+
GameAdvertising.replaceInGamePlacements = function (title_id, placements) {
|
|
21021
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.replaceInGamePlacements, { placements: placements }, { title_id: title_id });
|
|
21022
|
+
};
|
|
21023
|
+
/** Return site-admin delivery settings, aggregate metrics, and recent revenue. */
|
|
21024
|
+
GameAdvertising.adminDashboard = function () {
|
|
21025
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminDashboard);
|
|
21026
|
+
};
|
|
21027
|
+
/** Partially update platform-wide providers and delivery frequency. */
|
|
21028
|
+
GameAdvertising.adminUpdateSettings = function (data) {
|
|
21029
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminUpdateSettings, data);
|
|
21030
|
+
};
|
|
21031
|
+
/** Import or reconcile one provider revenue report row. */
|
|
21032
|
+
GameAdvertising.adminStoreRevenue = function (data) {
|
|
21033
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminStoreRevenue, data);
|
|
21034
|
+
};
|
|
21035
|
+
/** Return public provider app keys and platform mappings for site admins. */
|
|
21036
|
+
GameAdvertising.adminProviderApps = function () {
|
|
21037
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminProviderApps);
|
|
21038
|
+
};
|
|
21039
|
+
/** Create or update a provider app mapping without accepting report secrets. */
|
|
21040
|
+
GameAdvertising.adminUpsertProviderApp = function (data) {
|
|
21041
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminUpsertProviderApp, data);
|
|
21042
|
+
};
|
|
21043
|
+
return GameAdvertising;
|
|
21044
|
+
}());
|
|
21045
|
+
|
|
20961
21046
|
var Parser = /** @class */ (function () {
|
|
20962
21047
|
function Parser() {
|
|
20963
21048
|
}
|
|
@@ -21507,6 +21592,7 @@ var Glitch = /** @class */ (function () {
|
|
|
21507
21592
|
AdminReports: AdminReports,
|
|
21508
21593
|
AdminUsers: AdminUsers,
|
|
21509
21594
|
MarketResearch: MarketResearch,
|
|
21595
|
+
GameAdvertising: GameAdvertising,
|
|
21510
21596
|
};
|
|
21511
21597
|
Glitch.util = {
|
|
21512
21598
|
Requests: Requests,
|