glitch-javascript-sdk 2.6.2 → 2.6.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
@@ -5430,6 +5430,62 @@ 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
+ static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5437
+ /**
5438
+ * Create a new newsletter campaign draft (Admin only).
5439
+ */
5440
+ static createCampaign<T>(data: object): AxiosPromise<Response<T>>;
5441
+ /**
5442
+ * Retrieve a specific newsletter campaign (Admin only).
5443
+ */
5444
+ static viewCampaign<T>(id: string): AxiosPromise<Response<T>>;
5445
+ /**
5446
+ * Update a newsletter campaign draft (Admin only).
5447
+ */
5448
+ static updateCampaign<T>(id: string, data: object): AxiosPromise<Response<T>>;
5449
+ /**
5450
+ * Delete a newsletter campaign (Admin only).
5451
+ */
5452
+ static deleteCampaign<T>(id: string): AxiosPromise<Response<T>>;
5453
+ /**
5454
+ * Get high-level analytics for a specific campaign (Admin only).
5455
+ */
5456
+ static getCampaignStats<T>(id: string): AxiosPromise<Response<T>>;
5457
+ /**
5458
+ * Get detailed delivery and open logs for a campaign (Admin only).
5459
+ */
5460
+ static getCampaignLogs<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
5461
+ /**
5462
+ * Trigger the delivery of a newsletter campaign to all active subscribers (Admin only).
5463
+ */
5464
+ static sendCampaign<T>(id: string): AxiosPromise<Response<T>>;
5465
+ /**
5466
+ * Send a test email of a campaign to a specific address (Admin only).
5467
+ */
5468
+ static sendTestEmail<T>(id: string, email: string): AxiosPromise<Response<T>>;
5469
+ /**
5470
+ * List all newsletter subscribers (Admin only).
5471
+ */
5472
+ static listSubscribers<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5473
+ /**
5474
+ * Manually create a new newsletter subscriber (Admin only).
5475
+ */
5476
+ static createSubscriber<T>(data: object): AxiosPromise<Response<T>>;
5477
+ /**
5478
+ * Retrieve a specific subscriber's details (Admin only).
5479
+ */
5480
+ static viewSubscriber<T>(id: string): AxiosPromise<Response<T>>;
5481
+ /**
5482
+ * Update a subscriber's information or status (Admin only).
5483
+ */
5484
+ static updateSubscriber<T>(id: string, data: object): AxiosPromise<Response<T>>;
5485
+ /**
5486
+ * Permanently delete a subscriber from the system (Admin only).
5487
+ */
5488
+ static deleteSubscriber<T>(id: string): AxiosPromise<Response<T>>;
5433
5489
  }
5434
5490
 
5435
5491
  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.4",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -49,6 +49,110 @@ class Newsletters {
49
49
  return Requests.processRoute(NewslettersRoutes.routes.joinDiscordMarketplaceWaitlist, data, undefined, params);
50
50
  }
51
51
 
52
+ // --- ADMINISTRATIVE CAMPAIGN METHODS ---
53
+
54
+ /**
55
+ * List all newsletter campaigns (Admin only).
56
+ */
57
+ public static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
58
+ return Requests.processRoute(NewslettersRoutes.routes.listCampaigns, undefined, undefined, params);
59
+ }
60
+
61
+ /**
62
+ * Create a new newsletter campaign draft (Admin only).
63
+ */
64
+ public static createCampaign<T>(data: object): AxiosPromise<Response<T>> {
65
+ return Requests.processRoute(NewslettersRoutes.routes.createCampaign, data);
66
+ }
67
+
68
+ /**
69
+ * Retrieve a specific newsletter campaign (Admin only).
70
+ */
71
+ public static viewCampaign<T>(id: string): AxiosPromise<Response<T>> {
72
+ return Requests.processRoute(NewslettersRoutes.routes.viewCampaign, undefined, { id });
73
+ }
74
+
75
+ /**
76
+ * Update a newsletter campaign draft (Admin only).
77
+ */
78
+ public static updateCampaign<T>(id: string, data: object): AxiosPromise<Response<T>> {
79
+ return Requests.processRoute(NewslettersRoutes.routes.updateCampaign, data, { id });
80
+ }
81
+
82
+ /**
83
+ * Delete a newsletter campaign (Admin only).
84
+ */
85
+ public static deleteCampaign<T>(id: string): AxiosPromise<Response<T>> {
86
+ return Requests.processRoute(NewslettersRoutes.routes.deleteCampaign, undefined, { id });
87
+ }
88
+
89
+ /**
90
+ * Get high-level analytics for a specific campaign (Admin only).
91
+ */
92
+ public static getCampaignStats<T>(id: string): AxiosPromise<Response<T>> {
93
+ return Requests.processRoute(NewslettersRoutes.routes.getCampaignStats, undefined, { id });
94
+ }
95
+
96
+ /**
97
+ * Get detailed delivery and open logs for a campaign (Admin only).
98
+ */
99
+ public static getCampaignLogs<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
100
+ return Requests.processRoute(NewslettersRoutes.routes.getCampaignLogs, undefined, { id }, params);
101
+ }
102
+
103
+ /**
104
+ * Trigger the delivery of a newsletter campaign to all active subscribers (Admin only).
105
+ */
106
+ public static sendCampaign<T>(id: string): AxiosPromise<Response<T>> {
107
+ return Requests.processRoute(NewslettersRoutes.routes.sendCampaign, undefined, { id });
108
+ }
109
+
110
+ /**
111
+ * Send a test email of a campaign to a specific address (Admin only).
112
+ */
113
+ public static sendTestEmail<T>(id: string, email: string): AxiosPromise<Response<T>> {
114
+ return Requests.processRoute(NewslettersRoutes.routes.sendTest, { email }, { id });
115
+ }
116
+
117
+
118
+ // --- ADMINISTRATIVE SUBSCRIBER METHODS ---
119
+
120
+ /**
121
+ * List all newsletter subscribers (Admin only).
122
+ */
123
+ public static listSubscribers<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
124
+ return Requests.processRoute(NewslettersRoutes.routes.listSubscribers, undefined, undefined, params);
125
+ }
126
+
127
+ /**
128
+ * Manually create a new newsletter subscriber (Admin only).
129
+ */
130
+ public static createSubscriber<T>(data: object): AxiosPromise<Response<T>> {
131
+ return Requests.processRoute(NewslettersRoutes.routes.createSubscriber, data);
132
+ }
133
+
134
+ /**
135
+ * Retrieve a specific subscriber's details (Admin only).
136
+ */
137
+ public static viewSubscriber<T>(id: string): AxiosPromise<Response<T>> {
138
+ return Requests.processRoute(NewslettersRoutes.routes.viewSubscriber, undefined, { id });
139
+ }
140
+
141
+ /**
142
+ * Update a subscriber's information or status (Admin only).
143
+ */
144
+ public static updateSubscriber<T>(id: string, data: object): AxiosPromise<Response<T>> {
145
+ return Requests.processRoute(NewslettersRoutes.routes.updateSubscriber, data, { id });
146
+ }
147
+
148
+ /**
149
+ * Permanently delete a subscriber from the system (Admin only).
150
+ */
151
+ public static deleteSubscriber<T>(id: string): AxiosPromise<Response<T>> {
152
+ return Requests.processRoute(NewslettersRoutes.routes.deleteSubscriber, undefined, { id });
153
+ }
154
+
155
+
52
156
 
53
157
  }
54
158
 
@@ -8,6 +8,26 @@ 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
+ // --- Admin Campaign Management ---
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
+ deleteCampaign: { url: '/admin/newsletters/campaigns/{id}', method: HTTP_METHODS.DELETE },
18
+
19
+ // --- Admin Campaign Actions & Analytics ---
20
+ getCampaignStats: { url: '/admin/newsletters/campaigns/{id}/stats', method: HTTP_METHODS.GET },
21
+ getCampaignLogs: { url: '/admin/newsletters/campaigns/{id}/logs', method: HTTP_METHODS.GET },
22
+ sendCampaign: { url: '/admin/newsletters/campaigns/{id}/send', method: HTTP_METHODS.POST },
23
+ sendTest: { url: '/admin/newsletters/campaigns/{id}/test', method: HTTP_METHODS.POST },
24
+
25
+ // --- Admin Subscriber Management ---
26
+ listSubscribers: { url: '/admin/newsletters/subscribers', method: HTTP_METHODS.GET },
27
+ createSubscriber: { url: '/admin/newsletters/subscribers', method: HTTP_METHODS.POST },
28
+ viewSubscriber: { url: '/admin/newsletters/subscribers/{id}', method: HTTP_METHODS.GET },
29
+ updateSubscriber: { url: '/admin/newsletters/subscribers/{id}', method: HTTP_METHODS.PUT },
30
+ deleteSubscriber: { url: '/admin/newsletters/subscribers/{id}', method: HTTP_METHODS.DELETE },
11
31
  };
12
32
 
13
33
  }