glitch-javascript-sdk 1.5.7 → 1.5.9

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/index.d.ts CHANGED
@@ -1197,6 +1197,24 @@ declare class Communities {
1197
1197
  * @returns Promise
1198
1198
  */
1199
1199
  static registerNewsletterSubscriber<T>(community_id: string, newsletter_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1200
+ /**
1201
+ * Get newsletter overall reports (subscriber changes, unsubscribes, etc.).
1202
+ *
1203
+ * @param community_id The ID of the community.
1204
+ * @param newsletter_id The ID of the newsletter.
1205
+ * @param params Optional query params (start_date, end_date, etc).
1206
+ * @returns Promise with aggregated data
1207
+ */
1208
+ static newsletterReports<T>(community_id: string, newsletter_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1209
+ /**
1210
+ * Get campaign-level stats for a newsletter.
1211
+ *
1212
+ * @param community_id The ID of the community.
1213
+ * @param newsletter_id The ID of the newsletter.
1214
+ * @param params Optional query params (start_date, end_date, etc).
1215
+ * @returns Promise with campaign stats
1216
+ */
1217
+ static newsletterCampaignReports<T>(community_id: string, newsletter_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1200
1218
  }
1201
1219
 
1202
1220
  declare class Users {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -788,6 +788,68 @@ class Communities {
788
788
  return Requests.processRoute(CommunitiesRoute.routes.registerNewsletterSubscriber, data, { community_id, newsletter_id }, params);
789
789
  }
790
790
 
791
+ /**
792
+ * Get newsletter overall reports (subscriber changes, unsubscribes, etc.).
793
+ *
794
+ * @param community_id The ID of the community.
795
+ * @param newsletter_id The ID of the newsletter.
796
+ * @param params Optional query params (start_date, end_date, etc).
797
+ * @returns Promise with aggregated data
798
+ */
799
+ public static newsletterReports<T>(
800
+ community_id: string,
801
+ newsletter_id: string,
802
+ params?: Record<string, any>
803
+ ): AxiosPromise<Response<T>> {
804
+ return Requests.processRoute(
805
+ CommunitiesRoute.routes.newsletterReports,
806
+ undefined,
807
+ { community_id, newsletter_id },
808
+ params
809
+ );
810
+ }
811
+
812
+ /**
813
+ * Get campaign-level stats for a newsletter.
814
+ *
815
+ * @param community_id The ID of the community.
816
+ * @param newsletter_id The ID of the newsletter.
817
+ * @param params Optional query params (start_date, end_date, etc).
818
+ * @returns Promise with campaign stats
819
+ */
820
+ public static newsletterCampaignReports<T>(
821
+ community_id: string,
822
+ newsletter_id: string,
823
+ params?: Record<string, any>
824
+ ): AxiosPromise<Response<T>> {
825
+ return Requests.processRoute(
826
+ CommunitiesRoute.routes.newsletterCampaignReports,
827
+ undefined,
828
+ { community_id, newsletter_id },
829
+ params
830
+ );
831
+ }
832
+
833
+ /**
834
+ * Retrieves daily subscriber trend data for the specified newsletter.
835
+ *
836
+ * @param community_id The UUID of the community
837
+ * @param newsletter_id The UUID of the newsletter
838
+ * @param params Optional date-range filter (start_date, end_date, etc.)
839
+ */
840
+ public static newsletterSubscriberTrend<T>(
841
+ community_id: string,
842
+ newsletter_id: string,
843
+ params?: Record<string, any>
844
+ ): AxiosPromise<Response<T>> {
845
+ return Requests.processRoute(
846
+ CommunitiesRoute.routes.newsletterSubscriberTrend,
847
+ undefined, // no body data
848
+ { community_id, newsletter_id },
849
+ params
850
+ );
851
+ }
852
+
791
853
 
792
854
 
793
855
 
@@ -45,6 +45,19 @@ class CommunitiesRoute {
45
45
  deleteNewsletter: { url: '/communities/{community_id}/newsletters/{newsletter_id}', method: HTTP_METHODS.DELETE },
46
46
  importNewsletterSubscribers: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers/import', method: HTTP_METHODS.POST },
47
47
  uploadNewsletterBannerImage: { url: '/communities/{community_id}/newsletters/{newsletter_id}/uploadBannerImage', method: HTTP_METHODS.POST },
48
+ newsletterReports: {
49
+ url: '/communities/{community_id}/newsletters/{newsletter_id}/reports',
50
+ method: HTTP_METHODS.GET
51
+ },
52
+ newsletterCampaignReports: {
53
+ url: '/communities/{community_id}/newsletters/{newsletter_id}/reports/campaign',
54
+ method: HTTP_METHODS.GET
55
+ },
56
+
57
+ newsletterSubscriberTrend: {
58
+ url: '/communities/{community_id}/newsletters/{newsletter_id}/reports/subscriber_trend',
59
+ method: HTTP_METHODS.GET
60
+ },
48
61
 
49
62
  // Campaigns
50
63
  listCampaigns: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns', method: HTTP_METHODS.GET },