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.
@@ -107,5 +107,15 @@ declare class SocialPosts {
107
107
  * @returns promise
108
108
  */
109
109
  static reports<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
110
+ /**
111
+ * Update the information about a post impressions, for posts who API do not give view counts.
112
+ *
113
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
114
+ *
115
+ * @param post_id The id fo the post to retrieve.
116
+ *
117
+ * @returns promise
118
+ */
119
+ static updatePostImpressions<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
110
120
  }
111
121
  export default SocialPosts;
@@ -0,0 +1,48 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class SocialStats {
4
+ /**
5
+ * List all the social media account statistics, with optional filters.
6
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
7
+ *
8
+ * @param params Optional query parameters:
9
+ * - platform (string | string[]): Filter by platform(s)
10
+ * - start_date (string): Filter records created on or after this date (YYYY-MM-DD)
11
+ * - end_date (string): Filter records created on or before this date (YYYY-MM-DD)
12
+ * - user_id (string): Filter by user ID
13
+ * - title_promotion_schedule_id (string): Filter by TitlePromotionSchedule ID
14
+ * @returns promise
15
+ */
16
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
17
+ /**
18
+ * Get platform-level statistics, such as average follower count per platform.
19
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
20
+ *
21
+ * @returns promise
22
+ */
23
+ static platformStatistics<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
24
+ /**
25
+ * Generate various reports for social media account statistics.
26
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
27
+ *
28
+ * @param params Query parameters:
29
+ * - report_type (string): Required (e.g. average_followers, growth, platform_breakdown)
30
+ * - platform (string or string[]): Filter by platform(s)
31
+ * - start_date (string): Filter from date (YYYY-MM-DD)
32
+ * - end_date (string): Filter to date (YYYY-MM-DD)
33
+ * - user_id (string): Filter by user ID
34
+ * - title_promotion_schedule_id (string): Filter by schedule ID
35
+ *
36
+ * @returns promise
37
+ */
38
+ static reports<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
39
+ /**
40
+ * Retrieve a single social media account statistic record by its ID.
41
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
42
+ *
43
+ * @param id The ID of the statistic record.
44
+ * @returns promise
45
+ */
46
+ static view<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
47
+ }
48
+ export default SocialStats;
@@ -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
  export { Auth };
32
33
  export { Competitions };
33
34
  export { Communities };
@@ -58,3 +59,4 @@ export { PlayTests };
58
59
  export { Media };
59
60
  export { Scheduler };
60
61
  export { Funnel };
62
+ export { SocialStats };
@@ -28,6 +28,7 @@ import { PlayTests } from "./api";
28
28
  import { Media } from "./api";
29
29
  import { Scheduler } from "./api";
30
30
  import { Funnel } from "./api";
31
+ import { SocialStats } from "./api";
31
32
  import Requests from "./util/Requests";
32
33
  import Parser from "./util/Parser";
33
34
  import Session from "./util/Session";
@@ -77,6 +78,7 @@ declare class Glitch {
77
78
  Media: typeof Media;
78
79
  Scheduler: typeof Scheduler;
79
80
  Funnel: typeof Funnel;
81
+ SocialStats: typeof SocialStats;
80
82
  };
81
83
  static util: {
82
84
  Requests: typeof Requests;
package/dist/esm/index.js CHANGED
@@ -9362,6 +9362,7 @@ var SocialPostsRoute = /** @class */ (function () {
9362
9362
  removeMedia: { url: '/socialposts/{post_id}/removeMedia/{media_id}', method: HTTP_METHODS.DELETE },
9363
9363
  reschedule: { url: '/socialposts/{post_id}/reschedule', method: HTTP_METHODS.POST },
9364
9364
  reports: { url: '/socialposts/{post_id}/reports', method: HTTP_METHODS.GET },
9365
+ updatePostImpressions: { url: '/socialposts/{post_id}/impressions', method: HTTP_METHODS.PUT },
9365
9366
  };
9366
9367
  return SocialPostsRoute;
9367
9368
  }());
@@ -9497,6 +9498,18 @@ var SocialPosts = /** @class */ (function () {
9497
9498
  SocialPosts.reports = function (params) {
9498
9499
  return Requests.processRoute(SocialPostsRoute.routes.reports, undefined, undefined, params);
9499
9500
  };
9501
+ /**
9502
+ * Update the information about a post impressions, for posts who API do not give view counts.
9503
+ *
9504
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
9505
+ *
9506
+ * @param post_id The id fo the post to retrieve.
9507
+ *
9508
+ * @returns promise
9509
+ */
9510
+ SocialPosts.updatePostImpressions = function (post_id, data, params) {
9511
+ return Requests.processRoute(SocialPostsRoute.routes.updatePostImpressions, data, { post_id: post_id }, params);
9512
+ };
9500
9513
  return SocialPosts;
9501
9514
  }());
9502
9515
 
@@ -11280,7 +11293,7 @@ var MediaRoute = /** @class */ (function () {
11280
11293
  }
11281
11294
  MediaRoute.routes = {
11282
11295
  upload: { url: '/media', method: HTTP_METHODS.POST },
11283
- getMedia: { url: '/media/{meda_id}', method: HTTP_METHODS.GET },
11296
+ getMedia: { url: '/media/{media_id}', method: HTTP_METHODS.GET },
11284
11297
  };
11285
11298
  return MediaRoute;
11286
11299
  }());
@@ -11834,6 +11847,92 @@ var Funnel = /** @class */ (function () {
11834
11847
  return Funnel;
11835
11848
  }());
11836
11849
 
11850
+ var SocialStatsRoute = /** @class */ (function () {
11851
+ function SocialStatsRoute() {
11852
+ }
11853
+ SocialStatsRoute.routes = {
11854
+ /**
11855
+ * Retrieve a list of social statistics with optional filters.
11856
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
11857
+ */
11858
+ getStats: { url: '/socialstats', method: HTTP_METHODS.GET },
11859
+ /**
11860
+ * Retrieve platform-level statistics (e.g., average followers).
11861
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
11862
+ */
11863
+ getPlatformStatistics: { url: '/socialstats/statistics', method: HTTP_METHODS.GET },
11864
+ /**
11865
+ * Generate reports with various insights based on report_type and filters.
11866
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
11867
+ */
11868
+ getReports: { url: '/socialstats/reports', method: HTTP_METHODS.GET },
11869
+ /**
11870
+ * Retrieve a single social media account statistic record by its ID.
11871
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
11872
+ */
11873
+ getStatById: { url: '/socialstats/{id}', method: HTTP_METHODS.GET },
11874
+ };
11875
+ return SocialStatsRoute;
11876
+ }());
11877
+
11878
+ // src/api/SocialStats.ts
11879
+ var SocialStats = /** @class */ (function () {
11880
+ function SocialStats() {
11881
+ }
11882
+ /**
11883
+ * List all the social media account statistics, with optional filters.
11884
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics
11885
+ *
11886
+ * @param params Optional query parameters:
11887
+ * - platform (string | string[]): Filter by platform(s)
11888
+ * - start_date (string): Filter records created on or after this date (YYYY-MM-DD)
11889
+ * - end_date (string): Filter records created on or before this date (YYYY-MM-DD)
11890
+ * - user_id (string): Filter by user ID
11891
+ * - title_promotion_schedule_id (string): Filter by TitlePromotionSchedule ID
11892
+ * @returns promise
11893
+ */
11894
+ SocialStats.list = function (params) {
11895
+ return Requests.processRoute(SocialStatsRoute.routes.getStats, undefined, undefined, params);
11896
+ };
11897
+ /**
11898
+ * Get platform-level statistics, such as average follower count per platform.
11899
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/platformStatistics
11900
+ *
11901
+ * @returns promise
11902
+ */
11903
+ SocialStats.platformStatistics = function (params) {
11904
+ return Requests.processRoute(SocialStatsRoute.routes.getPlatformStatistics, undefined, undefined, params);
11905
+ };
11906
+ /**
11907
+ * Generate various reports for social media account statistics.
11908
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/reports
11909
+ *
11910
+ * @param params Query parameters:
11911
+ * - report_type (string): Required (e.g. average_followers, growth, platform_breakdown)
11912
+ * - platform (string or string[]): Filter by platform(s)
11913
+ * - start_date (string): Filter from date (YYYY-MM-DD)
11914
+ * - end_date (string): Filter to date (YYYY-MM-DD)
11915
+ * - user_id (string): Filter by user ID
11916
+ * - title_promotion_schedule_id (string): Filter by schedule ID
11917
+ *
11918
+ * @returns promise
11919
+ */
11920
+ SocialStats.reports = function (params) {
11921
+ return Requests.processRoute(SocialStatsRoute.routes.getReports, undefined, undefined, params);
11922
+ };
11923
+ /**
11924
+ * Retrieve a single social media account statistic record by its ID.
11925
+ * @see https://api.glitch.fun/api/documentation#/SocialMediaAccountStatistics/show
11926
+ *
11927
+ * @param id The ID of the statistic record.
11928
+ * @returns promise
11929
+ */
11930
+ SocialStats.view = function (id, params) {
11931
+ return Requests.processRoute(SocialStatsRoute.routes.getStatById, {}, { id: id }, params);
11932
+ };
11933
+ return SocialStats;
11934
+ }());
11935
+
11837
11936
  var Parser = /** @class */ (function () {
11838
11937
  function Parser() {
11839
11938
  }
@@ -12261,6 +12360,7 @@ var Glitch = /** @class */ (function () {
12261
12360
  Media: Media,
12262
12361
  Scheduler: Scheduler,
12263
12362
  Funnel: Funnel,
12363
+ SocialStats: SocialStats
12264
12364
  };
12265
12365
  Glitch.util = {
12266
12366
  Requests: Requests,