glitch-javascript-sdk 2.6.2 → 2.6.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/index.d.ts CHANGED
@@ -5430,6 +5430,90 @@ declare class Newsletters {
5430
5430
  * @param data { name, email, game, categories[] }
5431
5431
  */
5432
5432
  static joinDiscordMarketplaceWaitlist<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
5433
+ /**
5434
+ * List all newsletter campaigns (Admin only).
5435
+ *
5436
+ * @param params Query parameters for pagination and filtering.
5437
+ * @returns Promise
5438
+ */
5439
+ static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5440
+ /**
5441
+ * Create a new newsletter campaign draft (Admin only).
5442
+ *
5443
+ * @param data { subject, content_html, content_json }
5444
+ * @returns Promise
5445
+ */
5446
+ static createCampaign<T>(data: object): AxiosPromise<Response<T>>;
5447
+ /**
5448
+ * Retrieve a specific newsletter campaign (Admin only).
5449
+ *
5450
+ * @param id The UUID of the campaign.
5451
+ * @returns Promise
5452
+ */
5453
+ static viewCampaign<T>(id: string): AxiosPromise<Response<T>>;
5454
+ /**
5455
+ * Update a newsletter campaign draft (Admin only).
5456
+ *
5457
+ * @param id The UUID of the campaign.
5458
+ * @param data The updated campaign data.
5459
+ * @returns Promise
5460
+ */
5461
+ static updateCampaign<T>(id: string, data: object): AxiosPromise<Response<T>>;
5462
+ /**
5463
+ * Get analytics for a specific campaign (Admin only).
5464
+ * Returns open rates, click rates, and human vs proxy metrics.
5465
+ *
5466
+ * @param id The UUID of the campaign.
5467
+ * @returns Promise
5468
+ */
5469
+ static getCampaignStats<T>(id: string): AxiosPromise<Response<T>>;
5470
+ /**
5471
+ * Trigger the delivery of a newsletter campaign to all active subscribers (Admin only).
5472
+ *
5473
+ * @param id The UUID of the campaign.
5474
+ * @returns Promise
5475
+ */
5476
+ static sendCampaign<T>(id: string): AxiosPromise<Response<T>>;
5477
+ /**
5478
+ * List all newsletter subscribers (Admin only).
5479
+ *
5480
+ * @param params Query parameters for pagination and filtering.
5481
+ * @returns Promise
5482
+ */
5483
+ static listSubscribers<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5484
+ /**
5485
+ * Delete a newsletter campaign (Admin only).
5486
+ */
5487
+ static deleteCampaign<T>(id: string): AxiosPromise<Response<T>>;
5488
+ /**
5489
+ * Send a test email of a campaign to a specific address (Admin only).
5490
+ */
5491
+ static sendTestEmail<T>(id: string, email: string): AxiosPromise<Response<T>>;
5492
+ /**
5493
+ * Get detailed delivery and open logs for a campaign (Admin only).
5494
+ */
5495
+ static getDetailedLogs<T>(id: string, params?: object): AxiosPromise<Response<T>>;
5496
+ /**
5497
+ * Manually create a new subscriber (Admin only).
5498
+ */
5499
+ static createSubscriber<T>(data: object): AxiosPromise<Response<T>>;
5500
+ /**
5501
+ * Update a subscriber's details or status (Admin only).
5502
+ */
5503
+ static updateSubscriber<T>(id: string, data: object): AxiosPromise<Response<T>>;
5504
+ /**
5505
+ * Delete a subscriber (Admin only).
5506
+ */
5507
+ static deleteSubscriber<T>(id: string): AxiosPromise<Response<T>>;
5508
+ /**
5509
+ * Retrieve a specific subscriber's details (Admin only).
5510
+ *
5511
+ * @see https://api.glitch.fun/api/documentation#/Newsletter%20Admin/showNewsletterSubscriber
5512
+ *
5513
+ * @param id The UUID of the subscriber.
5514
+ * @returns Promise
5515
+ */
5516
+ static viewSubscriber<T>(id: string): AxiosPromise<Response<T>>;
5433
5517
  }
5434
5518
 
5435
5519
  declare class PlayTests {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -49,6 +49,134 @@ class Newsletters {
49
49
  return Requests.processRoute(NewslettersRoutes.routes.joinDiscordMarketplaceWaitlist, data, undefined, params);
50
50
  }
51
51
 
52
+ /**
53
+ * List all newsletter campaigns (Admin only).
54
+ *
55
+ * @param params Query parameters for pagination and filtering.
56
+ * @returns Promise
57
+ */
58
+ public static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
59
+ return Requests.processRoute(NewslettersRoutes.routes.listCampaigns, undefined, undefined, params);
60
+ }
61
+
62
+ /**
63
+ * Create a new newsletter campaign draft (Admin only).
64
+ *
65
+ * @param data { subject, content_html, content_json }
66
+ * @returns Promise
67
+ */
68
+ public static createCampaign<T>(data: object): AxiosPromise<Response<T>> {
69
+ return Requests.processRoute(NewslettersRoutes.routes.createCampaign, data);
70
+ }
71
+
72
+ /**
73
+ * Retrieve a specific newsletter campaign (Admin only).
74
+ *
75
+ * @param id The UUID of the campaign.
76
+ * @returns Promise
77
+ */
78
+ public static viewCampaign<T>(id: string): AxiosPromise<Response<T>> {
79
+ return Requests.processRoute(NewslettersRoutes.routes.viewCampaign, undefined, { id });
80
+ }
81
+
82
+ /**
83
+ * Update a newsletter campaign draft (Admin only).
84
+ *
85
+ * @param id The UUID of the campaign.
86
+ * @param data The updated campaign data.
87
+ * @returns Promise
88
+ */
89
+ public static updateCampaign<T>(id: string, data: object): AxiosPromise<Response<T>> {
90
+ return Requests.processRoute(NewslettersRoutes.routes.updateCampaign, data, { id });
91
+ }
92
+
93
+ /**
94
+ * Get analytics for a specific campaign (Admin only).
95
+ * Returns open rates, click rates, and human vs proxy metrics.
96
+ *
97
+ * @param id The UUID of the campaign.
98
+ * @returns Promise
99
+ */
100
+ public static getCampaignStats<T>(id: string): AxiosPromise<Response<T>> {
101
+ return Requests.processRoute(NewslettersRoutes.routes.getStats, undefined, { id });
102
+ }
103
+
104
+ /**
105
+ * Trigger the delivery of a newsletter campaign to all active subscribers (Admin only).
106
+ *
107
+ * @param id The UUID of the campaign.
108
+ * @returns Promise
109
+ */
110
+ public static sendCampaign<T>(id: string): AxiosPromise<Response<T>> {
111
+ return Requests.processRoute(NewslettersRoutes.routes.sendCampaign, undefined, { id });
112
+ }
113
+
114
+ /**
115
+ * List all newsletter subscribers (Admin only).
116
+ *
117
+ * @param params Query parameters for pagination and filtering.
118
+ * @returns Promise
119
+ */
120
+ public static listSubscribers<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
121
+ return Requests.processRoute(NewslettersRoutes.routes.listSubscribers, undefined, undefined, params);
122
+ }
123
+
124
+ /**
125
+ * Delete a newsletter campaign (Admin only).
126
+ */
127
+ public static deleteCampaign<T>(id: string): AxiosPromise<Response<T>> {
128
+ return Requests.processRoute(NewslettersRoutes.routes.deleteCampaign, undefined, { id });
129
+ }
130
+
131
+ /**
132
+ * Send a test email of a campaign to a specific address (Admin only).
133
+ */
134
+ public static sendTestEmail<T>(id: string, email: string): AxiosPromise<Response<T>> {
135
+ return Requests.processRoute(NewslettersRoutes.routes.sendTest, { email }, { id });
136
+ }
137
+
138
+ /**
139
+ * Get detailed delivery and open logs for a campaign (Admin only).
140
+ */
141
+ public static getDetailedLogs<T>(id: string, params?: object): AxiosPromise<Response<T>> {
142
+ return Requests.processRoute(NewslettersRoutes.routes.getLogs, undefined, { id }, params);
143
+ }
144
+
145
+ /**
146
+ * Manually create a new subscriber (Admin only).
147
+ */
148
+ public static createSubscriber<T>(data: object): AxiosPromise<Response<T>> {
149
+ return Requests.processRoute(NewslettersRoutes.routes.createSubscriber, data);
150
+ }
151
+
152
+ /**
153
+ * Update a subscriber's details or status (Admin only).
154
+ */
155
+ public static updateSubscriber<T>(id: string, data: object): AxiosPromise<Response<T>> {
156
+ return Requests.processRoute(NewslettersRoutes.routes.updateSubscriber, data, { id });
157
+ }
158
+
159
+ /**
160
+ * Delete a subscriber (Admin only).
161
+ */
162
+ public static deleteSubscriber<T>(id: string): AxiosPromise<Response<T>> {
163
+ return Requests.processRoute(NewslettersRoutes.routes.deleteSubscriber, undefined, { id });
164
+ }
165
+
166
+
167
+ /**
168
+ * Retrieve a specific subscriber's details (Admin only).
169
+ *
170
+ * @see https://api.glitch.fun/api/documentation#/Newsletter%20Admin/showNewsletterSubscriber
171
+ *
172
+ * @param id The UUID of the subscriber.
173
+ * @returns Promise
174
+ */
175
+ public static viewSubscriber<T>(id: string): AxiosPromise<Response<T>> {
176
+ return Requests.processRoute(NewslettersRoutes.routes.viewSubscriber, undefined, { id });
177
+ }
178
+
179
+
52
180
 
53
181
  }
54
182
 
@@ -8,6 +8,21 @@ class NewslettersRoutes {
8
8
  joinCourseWaitlist: { url: '/newsletters/joinCourseWaitlist', method: HTTP_METHODS.POST },
9
9
  joinRaffleWaitlist: { url: '/newsletters/joinRaffleWaitlist', method: HTTP_METHODS.POST },
10
10
  joinDiscordMarketplaceWaitlist: { url: '/newsletters/joinDiscordMarketplaceWaitlist', method: HTTP_METHODS.POST },
11
+
12
+ // --- New Admin Routes ---
13
+ listCampaigns: { url: '/admin/newsletters/campaigns', method: HTTP_METHODS.GET },
14
+ createCampaign: { url: '/admin/newsletters/campaigns', method: HTTP_METHODS.POST },
15
+ viewCampaign: { url: '/admin/newsletters/campaigns/{id}', method: HTTP_METHODS.GET },
16
+ updateCampaign: { url: '/admin/newsletters/campaigns/{id}', method: HTTP_METHODS.PUT },
17
+ getStats: { url: '/admin/newsletters/campaigns/{id}/stats', method: HTTP_METHODS.GET },
18
+ sendCampaign: { url: '/admin/newsletters/campaigns/{id}/send', method: HTTP_METHODS.POST },
19
+ listSubscribers: { url: '/admin/newsletters/subscribers', method: HTTP_METHODS.GET },
20
+
21
+ // --- Subscriber Management (Admin) ---
22
+ createSubscriber: { url: '/admin/newsletters/subscribers', method: HTTP_METHODS.POST },
23
+ viewSubscriber: { url: '/admin/newsletters/subscribers/{id}', method: HTTP_METHODS.GET },
24
+ updateSubscriber: { url: '/admin/newsletters/subscribers/{id}', method: HTTP_METHODS.PUT },
25
+ deleteSubscriber: { url: '/admin/newsletters/subscribers/{id}', method: HTTP_METHODS.DELETE },
11
26
  };
12
27
 
13
28
  }