glitch-javascript-sdk 1.5.1 → 1.5.3
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 +101 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/SocialPosts.d.ts +10 -0
- 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 +101 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/SocialStatsRoute.d.ts +7 -0
- package/dist/index.d.ts +57 -0
- package/package.json +1 -1
- package/src/api/SocialPosts.ts +14 -0
- 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/SocialPostsRoute.ts +1 -0
- package/src/routes/SocialStatsRoute.ts +35 -0
package/dist/index.d.ts
CHANGED
|
@@ -2699,6 +2699,16 @@ declare class SocialPosts {
|
|
|
2699
2699
|
* @returns promise
|
|
2700
2700
|
*/
|
|
2701
2701
|
static reports<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2702
|
+
/**
|
|
2703
|
+
* Update the information about a post impressions, for posts who API do not give view counts.
|
|
2704
|
+
*
|
|
2705
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
|
|
2706
|
+
*
|
|
2707
|
+
* @param post_id The id fo the post to retrieve.
|
|
2708
|
+
*
|
|
2709
|
+
* @returns promise
|
|
2710
|
+
*/
|
|
2711
|
+
static updatePostImpressions<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2702
2712
|
}
|
|
2703
2713
|
|
|
2704
2714
|
declare class Titles {
|
|
@@ -4329,6 +4339,52 @@ declare class Funnel {
|
|
|
4329
4339
|
static yearly<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4330
4340
|
}
|
|
4331
4341
|
|
|
4342
|
+
declare class SocialStats {
|
|
4343
|
+
/**
|
|
4344
|
+
* List all the social media account statistics, with optional filters.
|
|
4345
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
|
|
4346
|
+
*
|
|
4347
|
+
* @param params Optional query parameters:
|
|
4348
|
+
* - platform (string | string[]): Filter by platform(s)
|
|
4349
|
+
* - start_date (string): Filter records created on or after this date (YYYY-MM-DD)
|
|
4350
|
+
* - end_date (string): Filter records created on or before this date (YYYY-MM-DD)
|
|
4351
|
+
* - user_id (string): Filter by user ID
|
|
4352
|
+
* - title_promotion_schedule_id (string): Filter by TitlePromotionSchedule ID
|
|
4353
|
+
* @returns promise
|
|
4354
|
+
*/
|
|
4355
|
+
static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4356
|
+
/**
|
|
4357
|
+
* Get platform-level statistics, such as average follower count per platform.
|
|
4358
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
|
|
4359
|
+
*
|
|
4360
|
+
* @returns promise
|
|
4361
|
+
*/
|
|
4362
|
+
static platformStatistics<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4363
|
+
/**
|
|
4364
|
+
* Generate various reports for social media account statistics.
|
|
4365
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
|
|
4366
|
+
*
|
|
4367
|
+
* @param params Query parameters:
|
|
4368
|
+
* - report_type (string): Required (e.g. average_followers, growth, platform_breakdown)
|
|
4369
|
+
* - platform (string or string[]): Filter by platform(s)
|
|
4370
|
+
* - start_date (string): Filter from date (YYYY-MM-DD)
|
|
4371
|
+
* - end_date (string): Filter to date (YYYY-MM-DD)
|
|
4372
|
+
* - user_id (string): Filter by user ID
|
|
4373
|
+
* - title_promotion_schedule_id (string): Filter by schedule ID
|
|
4374
|
+
*
|
|
4375
|
+
* @returns promise
|
|
4376
|
+
*/
|
|
4377
|
+
static reports<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4378
|
+
/**
|
|
4379
|
+
* Retrieve a single social media account statistic record by its ID.
|
|
4380
|
+
* @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
|
|
4381
|
+
*
|
|
4382
|
+
* @param id The ID of the statistic record.
|
|
4383
|
+
* @returns promise
|
|
4384
|
+
*/
|
|
4385
|
+
static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4332
4388
|
interface Route {
|
|
4333
4389
|
url: string;
|
|
4334
4390
|
method: string;
|
|
@@ -4658,6 +4714,7 @@ declare class Glitch {
|
|
|
4658
4714
|
Media: typeof Media;
|
|
4659
4715
|
Scheduler: typeof Scheduler;
|
|
4660
4716
|
Funnel: typeof Funnel;
|
|
4717
|
+
SocialStats: typeof SocialStats;
|
|
4661
4718
|
};
|
|
4662
4719
|
static util: {
|
|
4663
4720
|
Requests: typeof Requests;
|
package/package.json
CHANGED
package/src/api/SocialPosts.ts
CHANGED
|
@@ -151,6 +151,20 @@ class SocialPosts {
|
|
|
151
151
|
return Requests.processRoute(SocialPostsRoute.routes.reports, undefined, undefined, params);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Update the information about a post impressions, for posts who API do not give view counts.
|
|
156
|
+
*
|
|
157
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
|
|
158
|
+
*
|
|
159
|
+
* @param post_id The id fo the post to retrieve.
|
|
160
|
+
*
|
|
161
|
+
* @returns promise
|
|
162
|
+
*/
|
|
163
|
+
public static updatePostImpressions<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
164
|
+
|
|
165
|
+
return Requests.processRoute(SocialPostsRoute.routes.updatePostImpressions, data, { post_id: post_id }, params);
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
export default SocialPosts;
|
|
@@ -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
|
|
|
@@ -15,6 +15,7 @@ class SocialPostsRoute {
|
|
|
15
15
|
removeMedia: { url: '/socialposts/{post_id}/removeMedia/{media_id}', method: HTTP_METHODS.DELETE },
|
|
16
16
|
reschedule: { url: '/socialposts/{post_id}/reschedule', method: HTTP_METHODS.POST },
|
|
17
17
|
reports: { url: '/socialposts/{post_id}/reports', method: HTTP_METHODS.GET },
|
|
18
|
+
updatePostImpressions : { url: '/socialposts/{post_id}/impressions', method: HTTP_METHODS.PUT },
|
|
18
19
|
|
|
19
20
|
};
|
|
20
21
|
|
|
@@ -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;
|