glitch-javascript-sdk 2.0.3 → 2.0.4

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
@@ -3733,6 +3733,51 @@ declare class Titles {
3733
3733
  * Update a specific chat message.
3734
3734
  */
3735
3735
  static chatUpdateMessage<T>(title_id: string, message_id: string, data: object): AxiosPromise<Response<T>>;
3736
+ /**
3737
+ * List all purchase events for a specific title.
3738
+ * Matches GET /titles/{title_id}/purchases
3739
+ */
3740
+ static listPurchases<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3741
+ /**
3742
+ * Retrieve a single purchase record by ID.
3743
+ * Matches GET /titles/{title_id}/purchases/{purchase_id}
3744
+ */
3745
+ static viewPurchase<T>(title_id: string, purchase_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3746
+ /**
3747
+ * Create a new purchase record.
3748
+ * Matches POST /titles/{title_id}/purchases
3749
+ */
3750
+ static createPurchase<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
3751
+ /**
3752
+ * Get a summary of total revenue, grouped by day or purchase_type.
3753
+ * Matches GET /titles/{title_id}/purchases/summary
3754
+ */
3755
+ static purchaseSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3756
+ /**
3757
+ * Revenue by time (daily, weekly, or monthly).
3758
+ * Matches GET /titles/{title_id}/purchases/reports/time
3759
+ */
3760
+ static purchaseRevenueByTime<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3761
+ /**
3762
+ * 30-day LTV (Lifetime Value) per install.
3763
+ * Matches GET /titles/{title_id}/purchases/reports/ltv30
3764
+ */
3765
+ static purchaseLtv30<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3766
+ /**
3767
+ * Show breakdown of revenue per currency, with optional USD conversion.
3768
+ * Matches GET /titles/{title_id}/purchases/reports/currency
3769
+ */
3770
+ static purchaseCurrencyBreakdown<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3771
+ /**
3772
+ * Distribution of installs by total revenue, plus a histogram array.
3773
+ * Matches GET /titles/{title_id}/purchases/reports/install-distribution
3774
+ */
3775
+ static installRevenueDistribution<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3776
+ /**
3777
+ * Stats by item SKU, purchase type, and repeat purchase analysis.
3778
+ * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
3779
+ */
3780
+ static itemAndPurchaseTypeStats<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3736
3781
  }
3737
3782
 
3738
3783
  declare class Campaigns {
@@ -5765,6 +5810,26 @@ declare class ShortLinks {
5765
5810
  * Update a short link
5766
5811
  */
5767
5812
  static update<T>(id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
5813
+ /**
5814
+ * Get click-summary report
5815
+ * - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
5816
+ */
5817
+ static clickSummary<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5818
+ /**
5819
+ * Get geo & device breakdown report
5820
+ * - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
5821
+ */
5822
+ static geoDeviceBreakdown<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5823
+ /**
5824
+ * Get time-series report
5825
+ * - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
5826
+ */
5827
+ static timeSeries<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5828
+ /**
5829
+ * Get referrer & UTM report
5830
+ * - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
5831
+ */
5832
+ static referrerReport<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5768
5833
  }
5769
5834
 
5770
5835
  declare class AIUsage {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -36,6 +36,58 @@ class ShortLinks {
36
36
  // public static delete<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
37
37
  // return Requests.processRoute(ShortLinksRoute.routes.deleteShortLink, {}, { id }, params);
38
38
  // }
39
+
40
+ /**
41
+ * Get click-summary report
42
+ * - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
43
+ */
44
+ public static clickSummary<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
45
+ return Requests.processRoute(
46
+ ShortLinksRoute.routes.clickSummary,
47
+ undefined,
48
+ undefined,
49
+ params
50
+ );
51
+ }
52
+
53
+ /**
54
+ * Get geo & device breakdown report
55
+ * - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
56
+ */
57
+ public static geoDeviceBreakdown<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
58
+ return Requests.processRoute(
59
+ ShortLinksRoute.routes.geoDeviceBreakdown,
60
+ undefined,
61
+ undefined,
62
+ params
63
+ );
64
+ }
65
+
66
+ /**
67
+ * Get time-series report
68
+ * - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
69
+ */
70
+ public static timeSeries<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
71
+ return Requests.processRoute(
72
+ ShortLinksRoute.routes.timeSeries,
73
+ undefined,
74
+ undefined,
75
+ params
76
+ );
77
+ }
78
+
79
+ /**
80
+ * Get referrer & UTM report
81
+ * - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
82
+ */
83
+ public static referrerReport<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
84
+ return Requests.processRoute(
85
+ ShortLinksRoute.routes.referrerReport,
86
+ undefined,
87
+ undefined,
88
+ params
89
+ );
90
+ }
39
91
  }
40
92
 
41
93
  export default ShortLinks;
package/src/api/Titles.ts CHANGED
@@ -552,6 +552,152 @@ class Titles {
552
552
  );
553
553
  }
554
554
 
555
+ /**
556
+ * List all purchase events for a specific title.
557
+ * Matches GET /titles/{title_id}/purchases
558
+ */
559
+ public static listPurchases<T>(
560
+ title_id: string,
561
+ params?: Record<string, any>
562
+ ): AxiosPromise<Response<T>> {
563
+ return Requests.processRoute(
564
+ TitlesRoute.routes.purchasesList,
565
+ {},
566
+ { title_id },
567
+ params
568
+ );
569
+ }
570
+
571
+ /**
572
+ * Retrieve a single purchase record by ID.
573
+ * Matches GET /titles/{title_id}/purchases/{purchase_id}
574
+ */
575
+ public static viewPurchase<T>(
576
+ title_id: string,
577
+ purchase_id: string,
578
+ params?: Record<string, any>
579
+ ): AxiosPromise<Response<T>> {
580
+ return Requests.processRoute(
581
+ TitlesRoute.routes.purchasesShow,
582
+ {},
583
+ { title_id, purchase_id },
584
+ params
585
+ );
586
+ }
587
+
588
+ /**
589
+ * Create a new purchase record.
590
+ * Matches POST /titles/{title_id}/purchases
591
+ */
592
+ public static createPurchase<T>(
593
+ title_id: string,
594
+ data: object,
595
+ params?: Record<string, any>
596
+ ): AxiosPromise<Response<T>> {
597
+ return Requests.processRoute(
598
+ TitlesRoute.routes.purchasesCreate,
599
+ data,
600
+ { title_id },
601
+ params
602
+ );
603
+ }
604
+
605
+ /**
606
+ * Get a summary of total revenue, grouped by day or purchase_type.
607
+ * Matches GET /titles/{title_id}/purchases/summary
608
+ */
609
+ public static purchaseSummary<T>(
610
+ title_id: string,
611
+ params?: Record<string, any>
612
+ ): AxiosPromise<Response<T>> {
613
+ return Requests.processRoute(
614
+ TitlesRoute.routes.purchasesSummary,
615
+ {},
616
+ { title_id },
617
+ params
618
+ );
619
+ }
620
+
621
+ /**
622
+ * Revenue by time (daily, weekly, or monthly).
623
+ * Matches GET /titles/{title_id}/purchases/reports/time
624
+ */
625
+ public static purchaseRevenueByTime<T>(
626
+ title_id: string,
627
+ params?: Record<string, any>
628
+ ): AxiosPromise<Response<T>> {
629
+ return Requests.processRoute(
630
+ TitlesRoute.routes.purchasesTimeReport,
631
+ {},
632
+ { title_id },
633
+ params
634
+ );
635
+ }
636
+
637
+ /**
638
+ * 30-day LTV (Lifetime Value) per install.
639
+ * Matches GET /titles/{title_id}/purchases/reports/ltv30
640
+ */
641
+ public static purchaseLtv30<T>(
642
+ title_id: string,
643
+ params?: Record<string, any>
644
+ ): AxiosPromise<Response<T>> {
645
+ return Requests.processRoute(
646
+ TitlesRoute.routes.purchasesLtv30Report,
647
+ {},
648
+ { title_id },
649
+ params
650
+ );
651
+ }
652
+
653
+ /**
654
+ * Show breakdown of revenue per currency, with optional USD conversion.
655
+ * Matches GET /titles/{title_id}/purchases/reports/currency
656
+ */
657
+ public static purchaseCurrencyBreakdown<T>(
658
+ title_id: string,
659
+ params?: Record<string, any>
660
+ ): AxiosPromise<Response<T>> {
661
+ return Requests.processRoute(
662
+ TitlesRoute.routes.purchasesCurrencyBreakdown,
663
+ {},
664
+ { title_id },
665
+ params
666
+ );
667
+ }
668
+
669
+ /**
670
+ * Distribution of installs by total revenue, plus a histogram array.
671
+ * Matches GET /titles/{title_id}/purchases/reports/install-distribution
672
+ */
673
+ public static installRevenueDistribution<T>(
674
+ title_id: string,
675
+ params?: Record<string, any>
676
+ ): AxiosPromise<Response<T>> {
677
+ return Requests.processRoute(
678
+ TitlesRoute.routes.purchasesInstallDistribution,
679
+ {},
680
+ { title_id },
681
+ params
682
+ );
683
+ }
684
+
685
+ /**
686
+ * Stats by item SKU, purchase type, and repeat purchase analysis.
687
+ * Matches GET /titles/{title_id}/purchases/reports/item-type-stats
688
+ */
689
+ public static itemAndPurchaseTypeStats<T>(
690
+ title_id: string,
691
+ params?: Record<string, any>
692
+ ): AxiosPromise<Response<T>> {
693
+ return Requests.processRoute(
694
+ TitlesRoute.routes.purchasesItemTypeStats,
695
+ {},
696
+ { title_id },
697
+ params
698
+ );
699
+ }
700
+
555
701
 
556
702
 
557
703
  }
@@ -9,6 +9,11 @@ class ShortLinksRoute {
9
9
  updateShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.PUT },
10
10
  // Delete can be added if supported
11
11
  // deleteShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.DELETE }
12
+
13
+ clickSummary: { url: '/shortlinks/reports/click-summary', method: HTTP_METHODS.GET },
14
+ geoDeviceBreakdown:{ url: '/shortlinks/reports/geo-device', method: HTTP_METHODS.GET },
15
+ timeSeries: { url: '/shortlinks/reports/time-series', method: HTTP_METHODS.GET },
16
+ referrerReport: { url: '/shortlinks/reports/referrer', method: HTTP_METHODS.GET },
12
17
  };
13
18
  }
14
19
 
@@ -93,6 +93,49 @@ class TitlesRoute {
93
93
  method: HTTP_METHODS.PUT
94
94
  },
95
95
 
96
+ // ─────────────────────────────────────────────────────────────────
97
+ // Purchase/Revenue Endpoints
98
+ // ─────────────────────────────────────────────────────────────────
99
+ purchasesList: {
100
+ url: "/titles/{title_id}/purchases",
101
+ method: HTTP_METHODS.GET,
102
+ },
103
+ purchasesShow: {
104
+ url: "/titles/{title_id}/purchases/{purchase_id}",
105
+ method: HTTP_METHODS.GET,
106
+ },
107
+ purchasesCreate: {
108
+ url: "/titles/{title_id}/purchases",
109
+ method: HTTP_METHODS.POST,
110
+ },
111
+ purchasesSummary: {
112
+ url: "/titles/{title_id}/purchases/summary",
113
+ method: HTTP_METHODS.GET,
114
+ },
115
+
116
+ // Advanced analytics sub-routes
117
+ purchasesTimeReport: {
118
+ url: "/titles/{title_id}/purchases/reports/time",
119
+ method: HTTP_METHODS.GET,
120
+ },
121
+ purchasesLtv30Report: {
122
+ url: "/titles/{title_id}/purchases/reports/ltv30",
123
+ method: HTTP_METHODS.GET,
124
+ },
125
+ purchasesCurrencyBreakdown: {
126
+ url: "/titles/{title_id}/purchases/reports/currency",
127
+ method: HTTP_METHODS.GET,
128
+ },
129
+ purchasesInstallDistribution: {
130
+ url: "/titles/{title_id}/purchases/reports/install-distribution",
131
+ method: HTTP_METHODS.GET,
132
+ },
133
+ purchasesItemTypeStats: {
134
+ url: "/titles/{title_id}/purchases/reports/item-type-stats",
135
+ method: HTTP_METHODS.GET,
136
+ },
137
+
138
+
96
139
  };
97
140
 
98
141
  }