glitch-javascript-sdk 1.5.1 → 1.5.2
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 +88 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/SocialStats.d.ts +48 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +88 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/SocialStatsRoute.d.ts +7 -0
- package/dist/index.d.ts +47 -0
- package/package.json +1 -1
- package/src/api/SocialStats.ts +65 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/MediaRoute.ts +1 -1
- package/src/routes/SocialStatsRoute.ts +35 -0
package/dist/index.d.ts
CHANGED
|
@@ -4329,6 +4329,52 @@ declare class Funnel {
|
|
|
4329
4329
|
static yearly<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4330
4330
|
}
|
|
4331
4331
|
|
|
4332
|
+
declare class SocialStats {
|
|
4333
|
+
/**
|
|
4334
|
+
* List all the social media account statistics, with optional filters.
|
|
4335
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
|
|
4336
|
+
*
|
|
4337
|
+
* @param params Optional query parameters:
|
|
4338
|
+
* - platform (string | string[]): Filter by platform(s)
|
|
4339
|
+
* - start_date (string): Filter records created on or after this date (YYYY-MM-DD)
|
|
4340
|
+
* - end_date (string): Filter records created on or before this date (YYYY-MM-DD)
|
|
4341
|
+
* - user_id (string): Filter by user ID
|
|
4342
|
+
* - title_promotion_schedule_id (string): Filter by TitlePromotionSchedule ID
|
|
4343
|
+
* @returns promise
|
|
4344
|
+
*/
|
|
4345
|
+
static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4346
|
+
/**
|
|
4347
|
+
* Get platform-level statistics, such as average follower count per platform.
|
|
4348
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
|
|
4349
|
+
*
|
|
4350
|
+
* @returns promise
|
|
4351
|
+
*/
|
|
4352
|
+
static platformStatistics<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4353
|
+
/**
|
|
4354
|
+
* Generate various reports for social media account statistics.
|
|
4355
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
|
|
4356
|
+
*
|
|
4357
|
+
* @param params Query parameters:
|
|
4358
|
+
* - report_type (string): Required (e.g. average_followers, growth, platform_breakdown)
|
|
4359
|
+
* - platform (string or string[]): Filter by platform(s)
|
|
4360
|
+
* - start_date (string): Filter from date (YYYY-MM-DD)
|
|
4361
|
+
* - end_date (string): Filter to date (YYYY-MM-DD)
|
|
4362
|
+
* - user_id (string): Filter by user ID
|
|
4363
|
+
* - title_promotion_schedule_id (string): Filter by schedule ID
|
|
4364
|
+
*
|
|
4365
|
+
* @returns promise
|
|
4366
|
+
*/
|
|
4367
|
+
static reports<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4368
|
+
/**
|
|
4369
|
+
* Retrieve a single social media account statistic record by its ID.
|
|
4370
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
|
|
4371
|
+
*
|
|
4372
|
+
* @param id The ID of the statistic record.
|
|
4373
|
+
* @returns promise
|
|
4374
|
+
*/
|
|
4375
|
+
static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4332
4378
|
interface Route {
|
|
4333
4379
|
url: string;
|
|
4334
4380
|
method: string;
|
|
@@ -4658,6 +4704,7 @@ declare class Glitch {
|
|
|
4658
4704
|
Media: typeof Media;
|
|
4659
4705
|
Scheduler: typeof Scheduler;
|
|
4660
4706
|
Funnel: typeof Funnel;
|
|
4707
|
+
SocialStats: typeof SocialStats;
|
|
4661
4708
|
};
|
|
4662
4709
|
static util: {
|
|
4663
4710
|
Requests: typeof Requests;
|
package/package.json
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/api/SocialStats.ts
|
|
2
|
+
import SocialStatsRoute from "../routes/SocialStatsRoute";
|
|
3
|
+
import Requests from "../util/Requests";
|
|
4
|
+
import Response from "../util/Response";
|
|
5
|
+
import { AxiosPromise } from "axios";
|
|
6
|
+
|
|
7
|
+
class SocialStats {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* List all the social media account statistics, with optional filters.
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
|
|
12
|
+
*
|
|
13
|
+
* @param params Optional query parameters:
|
|
14
|
+
* - platform (string | string[]): Filter by platform(s)
|
|
15
|
+
* - start_date (string): Filter records created on or after this date (YYYY-MM-DD)
|
|
16
|
+
* - end_date (string): Filter records created on or before this date (YYYY-MM-DD)
|
|
17
|
+
* - user_id (string): Filter by user ID
|
|
18
|
+
* - title_promotion_schedule_id (string): Filter by TitlePromotionSchedule ID
|
|
19
|
+
* @returns promise
|
|
20
|
+
*/
|
|
21
|
+
public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
22
|
+
return Requests.processRoute(SocialStatsRoute.routes.getStats, undefined, undefined, params);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get platform-level statistics, such as average follower count per platform.
|
|
27
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
|
|
28
|
+
*
|
|
29
|
+
* @returns promise
|
|
30
|
+
*/
|
|
31
|
+
public static platformStatistics<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
32
|
+
return Requests.processRoute(SocialStatsRoute.routes.getPlatformStatistics, undefined, undefined, params);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Generate various reports for social media account statistics.
|
|
37
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
|
|
38
|
+
*
|
|
39
|
+
* @param params Query parameters:
|
|
40
|
+
* - report_type (string): Required (e.g. average_followers, growth, platform_breakdown)
|
|
41
|
+
* - platform (string or string[]): Filter by platform(s)
|
|
42
|
+
* - start_date (string): Filter from date (YYYY-MM-DD)
|
|
43
|
+
* - end_date (string): Filter to date (YYYY-MM-DD)
|
|
44
|
+
* - user_id (string): Filter by user ID
|
|
45
|
+
* - title_promotion_schedule_id (string): Filter by schedule ID
|
|
46
|
+
*
|
|
47
|
+
* @returns promise
|
|
48
|
+
*/
|
|
49
|
+
public static reports<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
|
|
50
|
+
return Requests.processRoute(SocialStatsRoute.routes.getReports, undefined, undefined, params);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Retrieve a single social media account statistic record by its ID.
|
|
55
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
|
|
56
|
+
*
|
|
57
|
+
* @param id The ID of the statistic record.
|
|
58
|
+
* @returns promise
|
|
59
|
+
*/
|
|
60
|
+
public static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
61
|
+
return Requests.processRoute(SocialStatsRoute.routes.getStatById, {}, { id: id }, params);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default SocialStats;
|
package/src/api/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import PlayTests from "./PlayTests";
|
|
|
28
28
|
import Media from "./Media";
|
|
29
29
|
import Scheduler from "./Scheduler";
|
|
30
30
|
import Funnel from "./Funnel";
|
|
31
|
+
import SocialStats from "./SocialStats";
|
|
31
32
|
|
|
32
33
|
export {Auth};
|
|
33
34
|
export {Competitions};
|
|
@@ -58,4 +59,5 @@ export {Newsletters};
|
|
|
58
59
|
export {PlayTests};
|
|
59
60
|
export {Media};
|
|
60
61
|
export {Scheduler};
|
|
61
|
-
export {Funnel};
|
|
62
|
+
export {Funnel};
|
|
63
|
+
export {SocialStats};
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {PlayTests} from "./api";
|
|
|
32
32
|
import {Media} from "./api";
|
|
33
33
|
import {Scheduler} from "./api";
|
|
34
34
|
import {Funnel} from "./api";
|
|
35
|
+
import {SocialStats} from "./api";
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
@@ -95,6 +96,7 @@ class Glitch {
|
|
|
95
96
|
Media : Media,
|
|
96
97
|
Scheduler : Scheduler,
|
|
97
98
|
Funnel: Funnel,
|
|
99
|
+
SocialStats : SocialStats
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
public static util = {
|
package/src/routes/MediaRoute.ts
CHANGED
|
@@ -4,7 +4,7 @@ import HTTP_METHODS from "../constants/HttpMethods";
|
|
|
4
4
|
class MediaRoute {
|
|
5
5
|
public static routes: { [key: string]: Route } = {
|
|
6
6
|
upload: { url: '/media', method: HTTP_METHODS.POST },
|
|
7
|
-
getMedia: { url: '/media/{
|
|
7
|
+
getMedia: { url: '/media/{media_id}', method: HTTP_METHODS.GET },
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/routes/SocialStatsRoute.ts
|
|
2
|
+
import Route from "./interface";
|
|
3
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
4
|
+
|
|
5
|
+
class SocialStatsRoute {
|
|
6
|
+
|
|
7
|
+
public static routes: { [key: string]: Route } = {
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve a list of social statistics with optional filters.
|
|
10
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
|
|
11
|
+
*/
|
|
12
|
+
getStats: { url: '/socialstats', method: HTTP_METHODS.GET },
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Retrieve platform-level statistics (e.g., average followers).
|
|
16
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
|
|
17
|
+
*/
|
|
18
|
+
getPlatformStatistics: { url: '/socialstats/statistics', method: HTTP_METHODS.GET },
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generate reports with various insights based on report_type and filters.
|
|
22
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
|
|
23
|
+
*/
|
|
24
|
+
getReports: { url: '/socialstats/reports', method: HTTP_METHODS.GET },
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Retrieve a single social media account statistic record by its ID.
|
|
28
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
|
|
29
|
+
*/
|
|
30
|
+
getStatById: { url: '/socialstats/{id}', method: HTTP_METHODS.GET },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default SocialStatsRoute;
|