glitch-javascript-sdk 1.9.4 → 1.9.6
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 +181 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/AIUsage.d.ts +23 -0
- package/dist/esm/api/Ads.d.ts +43 -0
- package/dist/esm/api/ShortLinks.d.ts +21 -0
- package/dist/esm/api/Titles.d.ts +16 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +181 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/AIUsageRoute.d.ts +7 -0
- package/dist/esm/routes/ShortLinksRoute.d.ts +7 -0
- package/dist/index.d.ts +101 -0
- package/package.json +1 -1
- package/src/api/AIUsage.ts +32 -0
- package/src/api/Ads.ts +63 -0
- package/src/api/ShortLinks.ts +41 -0
- package/src/api/Titles.ts +71 -9
- package/src/api/index.ts +5 -1
- package/src/index.ts +5 -1
- package/src/routes/AIUsageRoute.ts +11 -0
- package/src/routes/AdsRoute.ts +28 -0
- package/src/routes/ShortLinksRoute.ts +15 -0
- package/src/routes/TitlesRoute.ts +17 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
declare class AIUsage {
|
|
4
|
+
/**
|
|
5
|
+
* List all AI usage entries with optional filters (date range, service, model, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @see https://api.glitch.fun/api/documentation#/AI%20Usage/getAIUsage
|
|
8
|
+
*
|
|
9
|
+
* @param params Query parameters for filtering and grouping
|
|
10
|
+
* @returns AxiosPromise
|
|
11
|
+
*/
|
|
12
|
+
static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Get summarized AI usage statistics (token totals, cost, grouped by service/model).
|
|
15
|
+
*
|
|
16
|
+
* @see https://api.glitch.fun/api/documentation#/AI%20Usage/getAIUsageSummary
|
|
17
|
+
*
|
|
18
|
+
* @param params Query parameters for filtering by date range
|
|
19
|
+
* @returns AxiosPromise
|
|
20
|
+
*/
|
|
21
|
+
static summary<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
22
|
+
}
|
|
23
|
+
export default AIUsage;
|
package/dist/esm/api/Ads.d.ts
CHANGED
|
@@ -374,5 +374,48 @@ declare class Ads {
|
|
|
374
374
|
* @returns Fully-hydrated AdCampaign resource
|
|
375
375
|
*/
|
|
376
376
|
static syncSchedulerCampaigns<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
377
|
+
/**
|
|
378
|
+
* Get campaign performance summary.
|
|
379
|
+
*/
|
|
380
|
+
static getPerformanceSummary<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
381
|
+
/**
|
|
382
|
+
* Get spend and delivery metrics over time.
|
|
383
|
+
*/
|
|
384
|
+
static getSpendDeliveryReport<T>(params: {
|
|
385
|
+
start_date: string;
|
|
386
|
+
end_date: string;
|
|
387
|
+
group_by?: 'day' | 'week' | 'month';
|
|
388
|
+
community_id?: string;
|
|
389
|
+
platform?: string;
|
|
390
|
+
}): AxiosPromise<Response<T>>;
|
|
391
|
+
/**
|
|
392
|
+
* Compare performance across platforms.
|
|
393
|
+
*/
|
|
394
|
+
static getPlatformComparisonReport<T>(params?: {
|
|
395
|
+
start_date?: string;
|
|
396
|
+
end_date?: string;
|
|
397
|
+
community_id?: string;
|
|
398
|
+
}): AxiosPromise<Response<T>>;
|
|
399
|
+
/**
|
|
400
|
+
* Get performance metrics for individual ad creatives.
|
|
401
|
+
*/
|
|
402
|
+
static getCreativePerformanceReport<T>(params?: {
|
|
403
|
+
community_id?: string;
|
|
404
|
+
platform?: string;
|
|
405
|
+
start_date?: string;
|
|
406
|
+
end_date?: string;
|
|
407
|
+
limit?: number;
|
|
408
|
+
sort?: 'spend' | 'impressions' | 'clicks' | 'ctr' | 'cpm' | 'cpc';
|
|
409
|
+
order?: 'asc' | 'desc';
|
|
410
|
+
}): AxiosPromise<Response<T>>;
|
|
411
|
+
/**
|
|
412
|
+
* Get time-based performance metrics by hour and day of week.
|
|
413
|
+
*/
|
|
414
|
+
static getTimePerformanceReport<T>(params: {
|
|
415
|
+
start_date: string;
|
|
416
|
+
end_date: string;
|
|
417
|
+
community_id?: string;
|
|
418
|
+
platform?: string;
|
|
419
|
+
}): AxiosPromise<Response<T>>;
|
|
377
420
|
}
|
|
378
421
|
export default Ads;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
declare class ShortLinks {
|
|
4
|
+
/**
|
|
5
|
+
* List all short links with optional filters
|
|
6
|
+
*/
|
|
7
|
+
static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new short link
|
|
10
|
+
*/
|
|
11
|
+
static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get a specific short link by ID
|
|
14
|
+
*/
|
|
15
|
+
static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
16
|
+
/**
|
|
17
|
+
* Update a short link
|
|
18
|
+
*/
|
|
19
|
+
static update<T>(id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
20
|
+
}
|
|
21
|
+
export default ShortLinks;
|
package/dist/esm/api/Titles.d.ts
CHANGED
|
@@ -273,5 +273,21 @@ declare class Titles {
|
|
|
273
273
|
* @returns AxiosPromise
|
|
274
274
|
*/
|
|
275
275
|
static analyzeUtmAnalytics<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
276
|
+
/**
|
|
277
|
+
* List all chat sessions for a title.
|
|
278
|
+
*/
|
|
279
|
+
static chatListSessions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
280
|
+
/**
|
|
281
|
+
* Get a specific chat session and its messages.
|
|
282
|
+
*/
|
|
283
|
+
static chatShowSession<T>(title_id: string, session_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
284
|
+
/**
|
|
285
|
+
* Search messages across all sessions of a title.
|
|
286
|
+
*/
|
|
287
|
+
static chatListMessages<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
288
|
+
/**
|
|
289
|
+
* Update a specific chat message.
|
|
290
|
+
*/
|
|
291
|
+
static chatUpdateMessage<T>(title_id: string, message_id: string, data: object): AxiosPromise<Response<T>>;
|
|
276
292
|
}
|
|
277
293
|
export default Titles;
|
package/dist/esm/api/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ import Funnel from "./Funnel";
|
|
|
33
33
|
import SocialStats from "./SocialStats";
|
|
34
34
|
import Hashtags from "./Hashtags";
|
|
35
35
|
import WebsiteAnalytics from "./WebsiteAnalytics";
|
|
36
|
+
import ShortLinks from "./ShortLinks";
|
|
37
|
+
import AIUsage from "./AIUsage";
|
|
36
38
|
export { Ads };
|
|
37
39
|
export { Auth };
|
|
38
40
|
export { Competitions };
|
|
@@ -68,3 +70,5 @@ export { SocialStats };
|
|
|
68
70
|
export { Hashtags };
|
|
69
71
|
export { WebsiteAnalytics };
|
|
70
72
|
export { Fingerprinting };
|
|
73
|
+
export { ShortLinks };
|
|
74
|
+
export { AIUsage };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ import { SocialStats } from "./api";
|
|
|
33
33
|
import { Hashtags } from "./api";
|
|
34
34
|
import { WebsiteAnalytics } from "./api";
|
|
35
35
|
import { Fingerprinting } from "./api";
|
|
36
|
+
import { ShortLinks } from "./api";
|
|
37
|
+
import { AIUsage } from "./api";
|
|
36
38
|
import Requests from "./util/Requests";
|
|
37
39
|
import Parser from "./util/Parser";
|
|
38
40
|
import Session from "./util/Session";
|
|
@@ -87,6 +89,8 @@ declare class Glitch {
|
|
|
87
89
|
SocialStats: typeof SocialStats;
|
|
88
90
|
WebsiteAnalytics: typeof WebsiteAnalytics;
|
|
89
91
|
Fingerprinting: typeof Fingerprinting;
|
|
92
|
+
ShortLinks: typeof ShortLinks;
|
|
93
|
+
AIUsage: typeof AIUsage;
|
|
90
94
|
};
|
|
91
95
|
static util: {
|
|
92
96
|
Requests: typeof Requests;
|
package/dist/esm/index.js
CHANGED
|
@@ -6926,6 +6926,29 @@ var AdsRoute = /** @class */ (function () {
|
|
|
6926
6926
|
url: "/ads/campaigns/scheduler/{scheduler_id}/syncAll",
|
|
6927
6927
|
method: HTTP_METHODS.POST,
|
|
6928
6928
|
},
|
|
6929
|
+
// ----------------------------------------------------------------
|
|
6930
|
+
// AD REPORTS
|
|
6931
|
+
// ----------------------------------------------------------------
|
|
6932
|
+
getPerformanceSummary: {
|
|
6933
|
+
url: "/ads/reports/summary",
|
|
6934
|
+
method: HTTP_METHODS.GET,
|
|
6935
|
+
},
|
|
6936
|
+
getSpendDeliveryReport: {
|
|
6937
|
+
url: "/ads/reports/spend-delivery",
|
|
6938
|
+
method: HTTP_METHODS.GET,
|
|
6939
|
+
},
|
|
6940
|
+
getPlatformComparisonReport: {
|
|
6941
|
+
url: "/ads/reports/platform-comparison",
|
|
6942
|
+
method: HTTP_METHODS.GET,
|
|
6943
|
+
},
|
|
6944
|
+
getCreativePerformanceReport: {
|
|
6945
|
+
url: "/ads/reports/creative-performance",
|
|
6946
|
+
method: HTTP_METHODS.GET,
|
|
6947
|
+
},
|
|
6948
|
+
getTimePerformanceReport: {
|
|
6949
|
+
url: "/ads/reports/time-performance",
|
|
6950
|
+
method: HTTP_METHODS.GET,
|
|
6951
|
+
},
|
|
6929
6952
|
};
|
|
6930
6953
|
return AdsRoute;
|
|
6931
6954
|
}());
|
|
@@ -7492,6 +7515,39 @@ var Ads = /** @class */ (function () {
|
|
|
7492
7515
|
Ads.syncSchedulerCampaigns = function (scheduler_id, params) {
|
|
7493
7516
|
return Requests.processRoute(AdsRoute.routes.syncSchedulerCampaigns, undefined, { scheduler_id: scheduler_id }, params);
|
|
7494
7517
|
};
|
|
7518
|
+
// ----------------------------------------------------------------------
|
|
7519
|
+
// AD REPORTS
|
|
7520
|
+
// ----------------------------------------------------------------------
|
|
7521
|
+
/**
|
|
7522
|
+
* Get campaign performance summary.
|
|
7523
|
+
*/
|
|
7524
|
+
Ads.getPerformanceSummary = function (params) {
|
|
7525
|
+
return Requests.processRoute(AdsRoute.routes.getPerformanceSummary, undefined, undefined, params);
|
|
7526
|
+
};
|
|
7527
|
+
/**
|
|
7528
|
+
* Get spend and delivery metrics over time.
|
|
7529
|
+
*/
|
|
7530
|
+
Ads.getSpendDeliveryReport = function (params) {
|
|
7531
|
+
return Requests.processRoute(AdsRoute.routes.getSpendDeliveryReport, undefined, undefined, params);
|
|
7532
|
+
};
|
|
7533
|
+
/**
|
|
7534
|
+
* Compare performance across platforms.
|
|
7535
|
+
*/
|
|
7536
|
+
Ads.getPlatformComparisonReport = function (params) {
|
|
7537
|
+
return Requests.processRoute(AdsRoute.routes.getPlatformComparisonReport, undefined, undefined, params);
|
|
7538
|
+
};
|
|
7539
|
+
/**
|
|
7540
|
+
* Get performance metrics for individual ad creatives.
|
|
7541
|
+
*/
|
|
7542
|
+
Ads.getCreativePerformanceReport = function (params) {
|
|
7543
|
+
return Requests.processRoute(AdsRoute.routes.getCreativePerformanceReport, undefined, undefined, params);
|
|
7544
|
+
};
|
|
7545
|
+
/**
|
|
7546
|
+
* Get time-based performance metrics by hour and day of week.
|
|
7547
|
+
*/
|
|
7548
|
+
Ads.getTimePerformanceReport = function (params) {
|
|
7549
|
+
return Requests.processRoute(AdsRoute.routes.getTimePerformanceReport, undefined, undefined, params);
|
|
7550
|
+
};
|
|
7495
7551
|
return Ads;
|
|
7496
7552
|
}());
|
|
7497
7553
|
|
|
@@ -10815,6 +10871,22 @@ var TitlesRoute = /** @class */ (function () {
|
|
|
10815
10871
|
url: "/titles/{title_id}/utm/analysis",
|
|
10816
10872
|
method: HTTP_METHODS.GET,
|
|
10817
10873
|
},
|
|
10874
|
+
chatListSessions: {
|
|
10875
|
+
url: '/titles/{title_id}/chat/sessions',
|
|
10876
|
+
method: HTTP_METHODS.GET
|
|
10877
|
+
},
|
|
10878
|
+
chatShowSession: {
|
|
10879
|
+
url: '/titles/{title_id}/chat/sessions/{session_id}',
|
|
10880
|
+
method: HTTP_METHODS.GET
|
|
10881
|
+
},
|
|
10882
|
+
chatListMessages: {
|
|
10883
|
+
url: '/titles/{title_id}/chat/messages',
|
|
10884
|
+
method: HTTP_METHODS.GET
|
|
10885
|
+
},
|
|
10886
|
+
chatUpdateMessage: {
|
|
10887
|
+
url: '/titles/{title_id}/chat/messages/{message_id}',
|
|
10888
|
+
method: HTTP_METHODS.PUT
|
|
10889
|
+
},
|
|
10818
10890
|
};
|
|
10819
10891
|
return TitlesRoute;
|
|
10820
10892
|
}());
|
|
@@ -11170,6 +11242,30 @@ var Titles = /** @class */ (function () {
|
|
|
11170
11242
|
Titles.analyzeUtmAnalytics = function (title_id, params) {
|
|
11171
11243
|
return Requests.processRoute(TitlesRoute.routes.analyzeUtmAnalytics, {}, { title_id: title_id }, params);
|
|
11172
11244
|
};
|
|
11245
|
+
/**
|
|
11246
|
+
* List all chat sessions for a title.
|
|
11247
|
+
*/
|
|
11248
|
+
Titles.chatListSessions = function (title_id, params) {
|
|
11249
|
+
return Requests.processRoute(TitlesRoute.routes.chatListSessions, {}, { title_id: title_id }, params);
|
|
11250
|
+
};
|
|
11251
|
+
/**
|
|
11252
|
+
* Get a specific chat session and its messages.
|
|
11253
|
+
*/
|
|
11254
|
+
Titles.chatShowSession = function (title_id, session_id, params) {
|
|
11255
|
+
return Requests.processRoute(TitlesRoute.routes.chatShowSession, {}, { title_id: title_id, session_id: session_id }, params);
|
|
11256
|
+
};
|
|
11257
|
+
/**
|
|
11258
|
+
* Search messages across all sessions of a title.
|
|
11259
|
+
*/
|
|
11260
|
+
Titles.chatListMessages = function (title_id, params) {
|
|
11261
|
+
return Requests.processRoute(TitlesRoute.routes.chatListMessages, {}, { title_id: title_id }, params);
|
|
11262
|
+
};
|
|
11263
|
+
/**
|
|
11264
|
+
* Update a specific chat message.
|
|
11265
|
+
*/
|
|
11266
|
+
Titles.chatUpdateMessage = function (title_id, message_id, data) {
|
|
11267
|
+
return Requests.processRoute(TitlesRoute.routes.chatUpdateMessage, data, { title_id: title_id, message_id: message_id });
|
|
11268
|
+
};
|
|
11173
11269
|
return Titles;
|
|
11174
11270
|
}());
|
|
11175
11271
|
|
|
@@ -13975,6 +14071,88 @@ var WebsiteAnalytics = /** @class */ (function () {
|
|
|
13975
14071
|
return WebsiteAnalytics;
|
|
13976
14072
|
}());
|
|
13977
14073
|
|
|
14074
|
+
var ShortLinksRoute = /** @class */ (function () {
|
|
14075
|
+
function ShortLinksRoute() {
|
|
14076
|
+
}
|
|
14077
|
+
ShortLinksRoute.routes = {
|
|
14078
|
+
listShortLinks: { url: '/shortlinks', method: HTTP_METHODS.GET },
|
|
14079
|
+
createShortLink: { url: '/shortlinks', method: HTTP_METHODS.POST },
|
|
14080
|
+
viewShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.GET },
|
|
14081
|
+
updateShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.PUT },
|
|
14082
|
+
// Delete can be added if supported
|
|
14083
|
+
// deleteShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.DELETE }
|
|
14084
|
+
};
|
|
14085
|
+
return ShortLinksRoute;
|
|
14086
|
+
}());
|
|
14087
|
+
|
|
14088
|
+
var ShortLinks = /** @class */ (function () {
|
|
14089
|
+
function ShortLinks() {
|
|
14090
|
+
}
|
|
14091
|
+
/**
|
|
14092
|
+
* List all short links with optional filters
|
|
14093
|
+
*/
|
|
14094
|
+
ShortLinks.list = function (params) {
|
|
14095
|
+
return Requests.processRoute(ShortLinksRoute.routes.listShortLinks, undefined, undefined, params);
|
|
14096
|
+
};
|
|
14097
|
+
/**
|
|
14098
|
+
* Create a new short link
|
|
14099
|
+
*/
|
|
14100
|
+
ShortLinks.create = function (data, params) {
|
|
14101
|
+
return Requests.processRoute(ShortLinksRoute.routes.createShortLink, data, {}, params);
|
|
14102
|
+
};
|
|
14103
|
+
/**
|
|
14104
|
+
* Get a specific short link by ID
|
|
14105
|
+
*/
|
|
14106
|
+
ShortLinks.view = function (id, params) {
|
|
14107
|
+
return Requests.processRoute(ShortLinksRoute.routes.viewShortLink, {}, { id: id }, params);
|
|
14108
|
+
};
|
|
14109
|
+
/**
|
|
14110
|
+
* Update a short link
|
|
14111
|
+
*/
|
|
14112
|
+
ShortLinks.update = function (id, data, params) {
|
|
14113
|
+
return Requests.processRoute(ShortLinksRoute.routes.updateShortLink, data, { id: id }, params);
|
|
14114
|
+
};
|
|
14115
|
+
return ShortLinks;
|
|
14116
|
+
}());
|
|
14117
|
+
|
|
14118
|
+
var AIUsageRoute = /** @class */ (function () {
|
|
14119
|
+
function AIUsageRoute() {
|
|
14120
|
+
}
|
|
14121
|
+
AIUsageRoute.routes = {
|
|
14122
|
+
listUsage: { url: '/billing/ai-usage', method: HTTP_METHODS.GET },
|
|
14123
|
+
summaryUsage: { url: '/billing/ai-usage/summary', method: HTTP_METHODS.GET }
|
|
14124
|
+
};
|
|
14125
|
+
return AIUsageRoute;
|
|
14126
|
+
}());
|
|
14127
|
+
|
|
14128
|
+
var AIUsage = /** @class */ (function () {
|
|
14129
|
+
function AIUsage() {
|
|
14130
|
+
}
|
|
14131
|
+
/**
|
|
14132
|
+
* List all AI usage entries with optional filters (date range, service, model, etc.).
|
|
14133
|
+
*
|
|
14134
|
+
* @see https://api.glitch.fun/api/documentation#/AI%20Usage/getAIUsage
|
|
14135
|
+
*
|
|
14136
|
+
* @param params Query parameters for filtering and grouping
|
|
14137
|
+
* @returns AxiosPromise
|
|
14138
|
+
*/
|
|
14139
|
+
AIUsage.list = function (params) {
|
|
14140
|
+
return Requests.processRoute(AIUsageRoute.routes.listUsage, undefined, undefined, params);
|
|
14141
|
+
};
|
|
14142
|
+
/**
|
|
14143
|
+
* Get summarized AI usage statistics (token totals, cost, grouped by service/model).
|
|
14144
|
+
*
|
|
14145
|
+
* @see https://api.glitch.fun/api/documentation#/AI%20Usage/getAIUsageSummary
|
|
14146
|
+
*
|
|
14147
|
+
* @param params Query parameters for filtering by date range
|
|
14148
|
+
* @returns AxiosPromise
|
|
14149
|
+
*/
|
|
14150
|
+
AIUsage.summary = function (params) {
|
|
14151
|
+
return Requests.processRoute(AIUsageRoute.routes.summaryUsage, undefined, undefined, params);
|
|
14152
|
+
};
|
|
14153
|
+
return AIUsage;
|
|
14154
|
+
}());
|
|
14155
|
+
|
|
13978
14156
|
var Parser = /** @class */ (function () {
|
|
13979
14157
|
function Parser() {
|
|
13980
14158
|
}
|
|
@@ -14497,7 +14675,9 @@ var Glitch = /** @class */ (function () {
|
|
|
14497
14675
|
Funnel: Funnel,
|
|
14498
14676
|
SocialStats: SocialStats,
|
|
14499
14677
|
WebsiteAnalytics: WebsiteAnalytics,
|
|
14500
|
-
Fingerprinting: Fingerprinting
|
|
14678
|
+
Fingerprinting: Fingerprinting,
|
|
14679
|
+
ShortLinks: ShortLinks,
|
|
14680
|
+
AIUsage: AIUsage
|
|
14501
14681
|
};
|
|
14502
14682
|
Glitch.util = {
|
|
14503
14683
|
Requests: Requests,
|