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,11 @@
|
|
|
1
|
+
import Route from './interface';
|
|
2
|
+
declare class GameAdvertisingRoute {
|
|
3
|
+
/**
|
|
4
|
+
* Route templates for publisher game-ad inventory, telemetry, earnings, and
|
|
5
|
+
* site administration. Placeholders are expanded by Requests.processRoute.
|
|
6
|
+
*/
|
|
7
|
+
static routes: {
|
|
8
|
+
[key: string]: Route;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export default GameAdvertisingRoute;
|
package/dist/index.d.ts
CHANGED
|
@@ -1893,6 +1893,50 @@ declare class Communities {
|
|
|
1893
1893
|
static saveInfluencerToPool<T>(community_id: string, data: object): AxiosPromise<Response<T>>;
|
|
1894
1894
|
}
|
|
1895
1895
|
|
|
1896
|
+
/** Human-readable earning categories returned by influencer payout APIs. */
|
|
1897
|
+
type InfluencerPayoutSourceType = "campaign_compensation" | "ad_revenue_share" | "subscription_residual" | "manual_adjustment";
|
|
1898
|
+
/** Auditable metrics and creator-content attribution attached to a payout. */
|
|
1899
|
+
interface InfluencerPayoutBreakdown {
|
|
1900
|
+
label?: string;
|
|
1901
|
+
payment_method?: "flat" | "performance" | "hybrid";
|
|
1902
|
+
provider?: string;
|
|
1903
|
+
period_start?: string;
|
|
1904
|
+
period_end?: string;
|
|
1905
|
+
impressions?: number;
|
|
1906
|
+
clicks?: number;
|
|
1907
|
+
short_link_id?: string | null;
|
|
1908
|
+
short_link_click_id?: string | null;
|
|
1909
|
+
social_media_post_id?: string | null;
|
|
1910
|
+
tracking_link_label?: string | null;
|
|
1911
|
+
social_platform?: string | null;
|
|
1912
|
+
social_post_url?: string | null;
|
|
1913
|
+
}
|
|
1914
|
+
/** One campaign or advertising earning payable to the authenticated influencer. */
|
|
1915
|
+
interface InfluencerPayout {
|
|
1916
|
+
id: string;
|
|
1917
|
+
user_id: string;
|
|
1918
|
+
campaign_id: string;
|
|
1919
|
+
amount: number;
|
|
1920
|
+
currency: string;
|
|
1921
|
+
status: "pending" | "completed" | "failed";
|
|
1922
|
+
payout_date?: string | null;
|
|
1923
|
+
source_type: InfluencerPayoutSourceType;
|
|
1924
|
+
source_label: string;
|
|
1925
|
+
source_reference_id?: string | null;
|
|
1926
|
+
breakdown?: InfluencerPayoutBreakdown;
|
|
1927
|
+
campaign?: Record<string, any>;
|
|
1928
|
+
}
|
|
1929
|
+
/** Optional filters for the authenticated influencer's payout history. */
|
|
1930
|
+
interface InfluencerPayoutQuery {
|
|
1931
|
+
campaign_id?: string;
|
|
1932
|
+
month?: number;
|
|
1933
|
+
year?: number;
|
|
1934
|
+
amount?: number;
|
|
1935
|
+
status?: "pending" | "completed" | "failed";
|
|
1936
|
+
source_type?: InfluencerPayoutSourceType;
|
|
1937
|
+
orderBy?: "created_at" | "amount";
|
|
1938
|
+
orderDirection?: "asc" | "desc";
|
|
1939
|
+
}
|
|
1896
1940
|
declare class Users {
|
|
1897
1941
|
/**
|
|
1898
1942
|
* List all the users.
|
|
@@ -1935,16 +1979,17 @@ declare class Users {
|
|
|
1935
1979
|
*/
|
|
1936
1980
|
static getCampaignInvites<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1937
1981
|
/**
|
|
1938
|
-
* Gets payouts from
|
|
1982
|
+
* Gets the authenticated influencer's payouts from campaigns and attributed
|
|
1983
|
+
* game advertising. Advertising revenue is returned as a separate additive
|
|
1984
|
+
* source with provider-period metrics and tracking-link/social-post IDs.
|
|
1939
1985
|
*
|
|
1940
1986
|
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
1941
1987
|
*
|
|
1942
|
-
* @param
|
|
1943
|
-
* @param data The data to update.
|
|
1988
|
+
* @param params Optional campaign, date, status, source, and ordering filters.
|
|
1944
1989
|
*
|
|
1945
1990
|
* @returns promise
|
|
1946
1991
|
*/
|
|
1947
|
-
static getPayouts<T>(params?:
|
|
1992
|
+
static getPayouts<T = InfluencerPayout[]>(params?: InfluencerPayoutQuery): AxiosPromise<Response<T>>;
|
|
1948
1993
|
/**
|
|
1949
1994
|
* Sync the current influencer's information.
|
|
1950
1995
|
*
|
|
@@ -11027,6 +11072,92 @@ declare class MarketResearch {
|
|
|
11027
11072
|
static exportGame(game_id: string, params?: Record<string, any>): AxiosPromise<Blob>;
|
|
11028
11073
|
}
|
|
11029
11074
|
|
|
11075
|
+
interface GameAdEventPayload {
|
|
11076
|
+
/** Opaque token returned by the server-created advertising manifest. */
|
|
11077
|
+
token: string;
|
|
11078
|
+
/** Client idempotency UUID. Reuse is valid only within the same ad session. */
|
|
11079
|
+
event_uuid?: string;
|
|
11080
|
+
/** Provider that produced or attempted the event. */
|
|
11081
|
+
provider: string;
|
|
11082
|
+
/** Stable Glitch placement name, such as game_banner or game_video. */
|
|
11083
|
+
placement: string;
|
|
11084
|
+
/** Normalized creative/ad format. */
|
|
11085
|
+
format: 'banner' | 'video' | 'interstitial' | 'rewarded' | 'in_game_image' | 'in_game_video' | 'other';
|
|
11086
|
+
/** Normalized SDK/ad lifecycle event. */
|
|
11087
|
+
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';
|
|
11088
|
+
/** Optional provider-native event or impression identifier. */
|
|
11089
|
+
provider_event_id?: string;
|
|
11090
|
+
/** Non-sensitive provider diagnostics and event context. */
|
|
11091
|
+
metadata?: Record<string, any>;
|
|
11092
|
+
/** ISO 8601 client-observed timestamp. Defaults to server receipt time. */
|
|
11093
|
+
occurred_at?: string;
|
|
11094
|
+
}
|
|
11095
|
+
/** Provider-neutral intrinsic-ad surface declared by a game developer. */
|
|
11096
|
+
interface GameInGameAdPlacement {
|
|
11097
|
+
id?: string;
|
|
11098
|
+
title_id?: string;
|
|
11099
|
+
provider?: 'anzu';
|
|
11100
|
+
placement_key: string;
|
|
11101
|
+
channel_name: string;
|
|
11102
|
+
surface_type: 'mesh' | 'sprite' | 'ui_image' | 'raw_image' | 'html' | 'electron_shell';
|
|
11103
|
+
scene_name?: string | null;
|
|
11104
|
+
aspect_ratio: number;
|
|
11105
|
+
allow_images: boolean;
|
|
11106
|
+
allow_videos: boolean;
|
|
11107
|
+
allow_audio?: boolean;
|
|
11108
|
+
is_dynamic: boolean;
|
|
11109
|
+
is_clickable: boolean;
|
|
11110
|
+
shrink_to_fit: boolean;
|
|
11111
|
+
fallback_media_url?: string | null;
|
|
11112
|
+
status: 'active' | 'disabled';
|
|
11113
|
+
metadata?: Record<string, any> | null;
|
|
11114
|
+
}
|
|
11115
|
+
/** Public delivery identity for a provider and runtime platform. */
|
|
11116
|
+
interface GameAdProviderApp {
|
|
11117
|
+
id?: string;
|
|
11118
|
+
title_id?: string | null;
|
|
11119
|
+
provider: 'anzu';
|
|
11120
|
+
platform: 'web' | 'electron_macos' | 'electron_windows' | 'electron_linux' | 'unity_webgl' | 'cocos_web' | 'construct_web';
|
|
11121
|
+
app_key: string;
|
|
11122
|
+
bundle_id?: string | null;
|
|
11123
|
+
mode: 'integration' | 'production';
|
|
11124
|
+
integration_type: 'managed' | 'direct';
|
|
11125
|
+
status: 'active' | 'disabled' | 'pending';
|
|
11126
|
+
metadata?: Record<string, any> | null;
|
|
11127
|
+
}
|
|
11128
|
+
/**
|
|
11129
|
+
* Typed client for platform-served game advertising.
|
|
11130
|
+
*
|
|
11131
|
+
* These endpoints manage publisher inventory displayed around playable games;
|
|
11132
|
+
* they are intentionally separate from APIs used to buy advertising campaigns.
|
|
11133
|
+
*/
|
|
11134
|
+
declare class GameAdvertising {
|
|
11135
|
+
/** Return developer-visible ad-earnings settings for a title. */
|
|
11136
|
+
static settings<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
11137
|
+
/** Update developer ad-earnings activation and optional title provider ID. */
|
|
11138
|
+
static updateSettings<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
11139
|
+
/** Resolve ad eligibility and create an expiring provider manifest/session. */
|
|
11140
|
+
static createSession<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
|
|
11141
|
+
/** Store one normalized, idempotent event for an advertising session. */
|
|
11142
|
+
static storeEvent<T>(title_id: string, session_id: string, data: GameAdEventPayload): AxiosPromise<Response<T>>;
|
|
11143
|
+
/** Return developer-visible estimated/finalized earnings and delivery totals. */
|
|
11144
|
+
static revenueSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
11145
|
+
/** Return every intrinsic-ad surface configured for a title. */
|
|
11146
|
+
static inGamePlacements<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
11147
|
+
/** Atomically replace a title's provider-neutral intrinsic-ad surfaces. */
|
|
11148
|
+
static replaceInGamePlacements<T>(title_id: string, placements: GameInGameAdPlacement[]): AxiosPromise<Response<T>>;
|
|
11149
|
+
/** Return site-admin delivery settings, aggregate metrics, and recent revenue. */
|
|
11150
|
+
static adminDashboard<T>(): AxiosPromise<Response<T>>;
|
|
11151
|
+
/** Partially update platform-wide providers and delivery frequency. */
|
|
11152
|
+
static adminUpdateSettings<T>(data: object): AxiosPromise<Response<T>>;
|
|
11153
|
+
/** Import or reconcile one provider revenue report row. */
|
|
11154
|
+
static adminStoreRevenue<T>(data: object): AxiosPromise<Response<T>>;
|
|
11155
|
+
/** Return public provider app keys and platform mappings for site admins. */
|
|
11156
|
+
static adminProviderApps<T>(): AxiosPromise<Response<T>>;
|
|
11157
|
+
/** Create or update a provider app mapping without accepting report secrets. */
|
|
11158
|
+
static adminUpsertProviderApp<T>(data: GameAdProviderApp): AxiosPromise<Response<T>>;
|
|
11159
|
+
}
|
|
11160
|
+
|
|
11030
11161
|
interface Route {
|
|
11031
11162
|
url: string;
|
|
11032
11163
|
method: string;
|
|
@@ -11397,6 +11528,7 @@ declare class Glitch {
|
|
|
11397
11528
|
AdminReports: typeof AdminReports;
|
|
11398
11529
|
AdminUsers: typeof AdminUsers;
|
|
11399
11530
|
MarketResearch: typeof MarketResearch;
|
|
11531
|
+
GameAdvertising: typeof GameAdvertising;
|
|
11400
11532
|
};
|
|
11401
11533
|
static util: {
|
|
11402
11534
|
Requests: typeof Requests;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glitch-javascript-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.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": "
|
|
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,130 @@
|
|
|
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
|
+
/** Opaque token returned by the server-created advertising manifest. */
|
|
8
|
+
token: string;
|
|
9
|
+
/** Client idempotency UUID. Reuse is valid only within the same ad session. */
|
|
10
|
+
event_uuid?: string;
|
|
11
|
+
/** Provider that produced or attempted the event. */
|
|
12
|
+
provider: string;
|
|
13
|
+
/** Stable Glitch placement name, such as game_banner or game_video. */
|
|
14
|
+
placement: string;
|
|
15
|
+
/** Normalized creative/ad format. */
|
|
16
|
+
format: 'banner' | 'video' | 'interstitial' | 'rewarded' | 'in_game_image' | 'in_game_video' | 'other';
|
|
17
|
+
/** Normalized SDK/ad lifecycle event. */
|
|
18
|
+
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';
|
|
19
|
+
/** Optional provider-native event or impression identifier. */
|
|
20
|
+
provider_event_id?: string;
|
|
21
|
+
/** Non-sensitive provider diagnostics and event context. */
|
|
22
|
+
metadata?: Record<string, any>;
|
|
23
|
+
/** ISO 8601 client-observed timestamp. Defaults to server receipt time. */
|
|
24
|
+
occurred_at?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Provider-neutral intrinsic-ad surface declared by a game developer. */
|
|
28
|
+
export interface GameInGameAdPlacement {
|
|
29
|
+
id?: string;
|
|
30
|
+
title_id?: string;
|
|
31
|
+
provider?: 'anzu';
|
|
32
|
+
placement_key: string;
|
|
33
|
+
channel_name: string;
|
|
34
|
+
surface_type: 'mesh' | 'sprite' | 'ui_image' | 'raw_image' | 'html' | 'electron_shell';
|
|
35
|
+
scene_name?: string | null;
|
|
36
|
+
aspect_ratio: number;
|
|
37
|
+
allow_images: boolean;
|
|
38
|
+
allow_videos: boolean;
|
|
39
|
+
allow_audio?: boolean;
|
|
40
|
+
is_dynamic: boolean;
|
|
41
|
+
is_clickable: boolean;
|
|
42
|
+
shrink_to_fit: boolean;
|
|
43
|
+
fallback_media_url?: string | null;
|
|
44
|
+
status: 'active' | 'disabled';
|
|
45
|
+
metadata?: Record<string, any> | null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Public delivery identity for a provider and runtime platform. */
|
|
49
|
+
export interface GameAdProviderApp {
|
|
50
|
+
id?: string;
|
|
51
|
+
title_id?: string | null;
|
|
52
|
+
provider: 'anzu';
|
|
53
|
+
platform: 'web' | 'electron_macos' | 'electron_windows' | 'electron_linux' | 'unity_webgl' | 'cocos_web' | 'construct_web';
|
|
54
|
+
app_key: string;
|
|
55
|
+
bundle_id?: string | null;
|
|
56
|
+
mode: 'integration' | 'production';
|
|
57
|
+
integration_type: 'managed' | 'direct';
|
|
58
|
+
status: 'active' | 'disabled' | 'pending';
|
|
59
|
+
metadata?: Record<string, any> | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Typed client for platform-served game advertising.
|
|
64
|
+
*
|
|
65
|
+
* These endpoints manage publisher inventory displayed around playable games;
|
|
66
|
+
* they are intentionally separate from APIs used to buy advertising campaigns.
|
|
67
|
+
*/
|
|
68
|
+
class GameAdvertising {
|
|
69
|
+
/** Return developer-visible ad-earnings settings for a title. */
|
|
70
|
+
public static settings<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
71
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.settings, undefined, { title_id });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Update developer ad-earnings activation and optional title provider ID. */
|
|
75
|
+
public static updateSettings<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
76
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.updateSettings, data, { title_id });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Resolve ad eligibility and create an expiring provider manifest/session. */
|
|
80
|
+
public static createSession<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
|
|
81
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.createSession, data, { title_id });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Store one normalized, idempotent event for an advertising session. */
|
|
85
|
+
public static storeEvent<T>(title_id: string, session_id: string, data: GameAdEventPayload): AxiosPromise<Response<T>> {
|
|
86
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.storeEvent, data, { title_id, session_id });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Return developer-visible estimated/finalized earnings and delivery totals. */
|
|
90
|
+
public static revenueSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
91
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.revenueSummary, undefined, { title_id }, params);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Return every intrinsic-ad surface configured for a title. */
|
|
95
|
+
public static inGamePlacements<T>(title_id: string): AxiosPromise<Response<T>> {
|
|
96
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.inGamePlacements, undefined, { title_id });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Atomically replace a title's provider-neutral intrinsic-ad surfaces. */
|
|
100
|
+
public static replaceInGamePlacements<T>(title_id: string, placements: GameInGameAdPlacement[]): AxiosPromise<Response<T>> {
|
|
101
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.replaceInGamePlacements, { placements }, { title_id });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Return site-admin delivery settings, aggregate metrics, and recent revenue. */
|
|
105
|
+
public static adminDashboard<T>(): AxiosPromise<Response<T>> {
|
|
106
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminDashboard);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Partially update platform-wide providers and delivery frequency. */
|
|
110
|
+
public static adminUpdateSettings<T>(data: object): AxiosPromise<Response<T>> {
|
|
111
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminUpdateSettings, data);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Import or reconcile one provider revenue report row. */
|
|
115
|
+
public static adminStoreRevenue<T>(data: object): AxiosPromise<Response<T>> {
|
|
116
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminStoreRevenue, data);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Return public provider app keys and platform mappings for site admins. */
|
|
120
|
+
public static adminProviderApps<T>(): AxiosPromise<Response<T>> {
|
|
121
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminProviderApps);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Create or update a provider app mapping without accepting report secrets. */
|
|
125
|
+
public static adminUpsertProviderApp<T>(data: GameAdProviderApp): AxiosPromise<Response<T>> {
|
|
126
|
+
return Requests.processRoute(GameAdvertisingRoute.routes.adminUpsertProviderApp, data);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
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/Users.ts
CHANGED
|
@@ -4,6 +4,54 @@ import Requests from "../util/Requests";
|
|
|
4
4
|
import Response from "../util/Response";
|
|
5
5
|
import { AxiosPromise } from "axios";
|
|
6
6
|
|
|
7
|
+
/** Human-readable earning categories returned by influencer payout APIs. */
|
|
8
|
+
export type InfluencerPayoutSourceType = "campaign_compensation" | "ad_revenue_share" | "subscription_residual" | "manual_adjustment";
|
|
9
|
+
|
|
10
|
+
/** Auditable metrics and creator-content attribution attached to a payout. */
|
|
11
|
+
export interface InfluencerPayoutBreakdown {
|
|
12
|
+
label?: string;
|
|
13
|
+
payment_method?: "flat" | "performance" | "hybrid";
|
|
14
|
+
provider?: string;
|
|
15
|
+
period_start?: string;
|
|
16
|
+
period_end?: string;
|
|
17
|
+
impressions?: number;
|
|
18
|
+
clicks?: number;
|
|
19
|
+
short_link_id?: string | null;
|
|
20
|
+
short_link_click_id?: string | null;
|
|
21
|
+
social_media_post_id?: string | null;
|
|
22
|
+
tracking_link_label?: string | null;
|
|
23
|
+
social_platform?: string | null;
|
|
24
|
+
social_post_url?: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** One campaign or advertising earning payable to the authenticated influencer. */
|
|
28
|
+
export interface InfluencerPayout {
|
|
29
|
+
id: string;
|
|
30
|
+
user_id: string;
|
|
31
|
+
campaign_id: string;
|
|
32
|
+
amount: number;
|
|
33
|
+
currency: string;
|
|
34
|
+
status: "pending" | "completed" | "failed";
|
|
35
|
+
payout_date?: string | null;
|
|
36
|
+
source_type: InfluencerPayoutSourceType;
|
|
37
|
+
source_label: string;
|
|
38
|
+
source_reference_id?: string | null;
|
|
39
|
+
breakdown?: InfluencerPayoutBreakdown;
|
|
40
|
+
campaign?: Record<string, any>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Optional filters for the authenticated influencer's payout history. */
|
|
44
|
+
export interface InfluencerPayoutQuery {
|
|
45
|
+
campaign_id?: string;
|
|
46
|
+
month?: number;
|
|
47
|
+
year?: number;
|
|
48
|
+
amount?: number;
|
|
49
|
+
status?: "pending" | "completed" | "failed";
|
|
50
|
+
source_type?: InfluencerPayoutSourceType;
|
|
51
|
+
orderBy?: "created_at" | "amount";
|
|
52
|
+
orderDirection?: "asc" | "desc";
|
|
53
|
+
}
|
|
54
|
+
|
|
7
55
|
class Users {
|
|
8
56
|
|
|
9
57
|
/**
|
|
@@ -62,16 +110,17 @@ class Users {
|
|
|
62
110
|
}
|
|
63
111
|
|
|
64
112
|
/**
|
|
65
|
-
* Gets payouts from
|
|
113
|
+
* Gets the authenticated influencer's payouts from campaigns and attributed
|
|
114
|
+
* game advertising. Advertising revenue is returned as a separate additive
|
|
115
|
+
* source with provider-period metrics and tracking-link/social-post IDs.
|
|
66
116
|
*
|
|
67
117
|
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
68
118
|
*
|
|
69
|
-
* @param
|
|
70
|
-
* @param data The data to update.
|
|
119
|
+
* @param params Optional campaign, date, status, source, and ordering filters.
|
|
71
120
|
*
|
|
72
121
|
* @returns promise
|
|
73
122
|
*/
|
|
74
|
-
public static getPayouts<T>(params?:
|
|
123
|
+
public static getPayouts<T = InfluencerPayout[]>(params?: InfluencerPayoutQuery): AxiosPromise<Response<T>> {
|
|
75
124
|
|
|
76
125
|
return Requests.processRoute(UserRoutes.routes.getPayouts, {}, undefined, params);
|
|
77
126
|
}
|
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,25 @@
|
|
|
1
|
+
import Route from './interface';
|
|
2
|
+
import HTTP_METHODS from '../constants/HttpMethods';
|
|
3
|
+
|
|
4
|
+
class GameAdvertisingRoute {
|
|
5
|
+
/**
|
|
6
|
+
* Route templates for publisher game-ad inventory, telemetry, earnings, and
|
|
7
|
+
* site administration. Placeholders are expanded by Requests.processRoute.
|
|
8
|
+
*/
|
|
9
|
+
public static routes: { [key: string]: Route } = {
|
|
10
|
+
settings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.GET },
|
|
11
|
+
updateSettings: { url: '/titles/{title_id}/advertising/settings', method: HTTP_METHODS.PUT },
|
|
12
|
+
createSession: { url: '/titles/{title_id}/advertising/sessions', method: HTTP_METHODS.POST },
|
|
13
|
+
storeEvent: { url: '/titles/{title_id}/advertising/sessions/{session_id}/events', method: HTTP_METHODS.POST },
|
|
14
|
+
revenueSummary: { url: '/titles/{title_id}/advertising/revenue-summary', method: HTTP_METHODS.GET },
|
|
15
|
+
inGamePlacements: { url: '/titles/{title_id}/advertising/in-game/placements', method: HTTP_METHODS.GET },
|
|
16
|
+
replaceInGamePlacements: { url: '/titles/{title_id}/advertising/in-game/placements', method: HTTP_METHODS.PUT },
|
|
17
|
+
adminDashboard: { url: '/admin/game-advertising', method: HTTP_METHODS.GET },
|
|
18
|
+
adminUpdateSettings: { url: '/admin/game-advertising/settings', method: HTTP_METHODS.PUT },
|
|
19
|
+
adminStoreRevenue: { url: '/admin/game-advertising/revenue', method: HTTP_METHODS.POST },
|
|
20
|
+
adminProviderApps: { url: '/admin/game-advertising/provider-apps', method: HTTP_METHODS.GET },
|
|
21
|
+
adminUpsertProviderApp: { url: '/admin/game-advertising/provider-apps', method: HTTP_METHODS.PUT },
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default GameAdvertisingRoute;
|