glitch-javascript-sdk 1.5.0 → 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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class SocialStatsRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default SocialStatsRoute;
package/dist/index.d.ts CHANGED
@@ -4101,6 +4101,18 @@ declare class Scheduler {
4101
4101
  * @returns promise
4102
4102
  */
4103
4103
  static deleteUpdate<T>(scheduler_id: string, update_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4104
+ /**
4105
+ * Schedule title update.
4106
+ *
4107
+ * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitleUpdate
4108
+ *
4109
+ * @param scheduler_id The ID of the promotion schedule.
4110
+ * @param update_id The ID of the title update.
4111
+ * @param data The data to update.
4112
+ *
4113
+ * @returns promise
4114
+ */
4115
+ static scheduleUpdate<T>(scheduler_id: string, update_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4104
4116
  /**
4105
4117
  * Clear Twitter OAuth credentials from a promotion schedule.
4106
4118
  *
@@ -4317,6 +4329,52 @@ declare class Funnel {
4317
4329
  static yearly<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
4318
4330
  }
4319
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
+
4320
4378
  interface Route {
4321
4379
  url: string;
4322
4380
  method: string;
@@ -4646,6 +4704,7 @@ declare class Glitch {
4646
4704
  Media: typeof Media;
4647
4705
  Scheduler: typeof Scheduler;
4648
4706
  Funnel: typeof Funnel;
4707
+ SocialStats: typeof SocialStats;
4649
4708
  };
4650
4709
  static util: {
4651
4710
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -165,6 +165,21 @@ class Scheduler {
165
165
  return Requests.processRoute(SchedulerRoute.routes.deleteUpdate, {}, { scheduler_id, update_id }, params);
166
166
  }
167
167
 
168
+ /**
169
+ * Schedule title update.
170
+ *
171
+ * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitleUpdate
172
+ *
173
+ * @param scheduler_id The ID of the promotion schedule.
174
+ * @param update_id The ID of the title update.
175
+ * @param data The data to update.
176
+ *
177
+ * @returns promise
178
+ */
179
+ public static scheduleUpdate<T>(scheduler_id: string, update_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
180
+ return Requests.processRoute(SchedulerRoute.routes.scheduleUpdate, data, { scheduler_id, update_id }, params);
181
+ }
182
+
168
183
  /**
169
184
  * Clear Twitter OAuth credentials from a promotion schedule.
170
185
  *
@@ -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 = {
@@ -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/{meda_id}', method: HTTP_METHODS.GET },
7
+ getMedia: { url: '/media/{media_id}', method: HTTP_METHODS.GET },
8
8
  };
9
9
  }
10
10
 
@@ -17,6 +17,7 @@ class SchedulerRoute {
17
17
  getUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.GET },
18
18
  updateUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.PUT },
19
19
  deleteUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.DELETE },
20
+ scheduleUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}/schedule', method: HTTP_METHODS.POST },
20
21
 
21
22
  testTone: { url: '/schedulers/{scheduler_id}/tone', method: HTTP_METHODS.POST },
22
23
  getSchedulerReports: { url: '/schedulers/{scheduler_id}/reports', method: HTTP_METHODS.GET },
@@ -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;