glitch-javascript-sdk 1.5.9 → 1.6.1

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
@@ -1215,6 +1215,14 @@ declare class Communities {
1215
1215
  * @returns Promise with campaign stats
1216
1216
  */
1217
1217
  static newsletterCampaignReports<T>(community_id: string, newsletter_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1218
+ /**
1219
+ * Retrieves daily subscriber trend data for the specified newsletter.
1220
+ *
1221
+ * @param community_id The UUID of the community
1222
+ * @param newsletter_id The UUID of the newsletter
1223
+ * @param params Optional date-range filter (start_date, end_date, etc.)
1224
+ */
1225
+ static newsletterSubscriberTrend<T>(community_id: string, newsletter_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1218
1226
  }
1219
1227
 
1220
1228
  declare class Users {
@@ -2912,6 +2920,21 @@ declare class Titles {
2912
2920
  * @returns AxiosPromise
2913
2921
  */
2914
2922
  static getWishlist<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2923
+ /**
2924
+ * Create a new API token for a title.
2925
+ * Returns { full_token: string, token: TitleToken }.
2926
+ */
2927
+ static createTitleToken<T>(title_id: string, data?: {
2928
+ expires_at?: string;
2929
+ }): AxiosPromise<Response<T>>;
2930
+ /**
2931
+ * List all tokens for a title.
2932
+ */
2933
+ static listTitleTokens<T>(title_id: string): AxiosPromise<Response<T>>;
2934
+ /**
2935
+ * Revoke a specific token by ID.
2936
+ */
2937
+ static revokeTitleToken<T>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
2915
2938
  }
2916
2939
 
2917
2940
  declare class Campaigns {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.5.9",
3
+ "version": "1.6.1",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -830,14 +830,14 @@ class Communities {
830
830
  );
831
831
  }
832
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>(
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
841
  community_id: string,
842
842
  newsletter_id: string,
843
843
  params?: Record<string, any>
package/src/api/Titles.ts CHANGED
@@ -262,6 +262,48 @@ class Titles {
262
262
  return Requests.processRoute(TitlesRoute.routes.getWishlist, {}, { title_id }, params);
263
263
  }
264
264
 
265
+ /**
266
+ * Create a new API token for a title.
267
+ * Returns { full_token: string, token: TitleToken }.
268
+ */
269
+ public static createTitleToken<T>(
270
+ title_id: string,
271
+ data?: { expires_at?: string }
272
+ ): AxiosPromise<Response<T>> {
273
+ return Requests.processRoute(
274
+ TitlesRoute.routes.createToken,
275
+ data,
276
+ { title_id }
277
+ );
278
+ }
279
+
280
+ /**
281
+ * List all tokens for a title.
282
+ */
283
+ public static listTitleTokens<T>(
284
+ title_id: string
285
+ ): AxiosPromise<Response<T>> {
286
+ return Requests.processRoute(
287
+ TitlesRoute.routes.listTokens,
288
+ {},
289
+ { title_id }
290
+ );
291
+ }
292
+
293
+ /**
294
+ * Revoke a specific token by ID.
295
+ */
296
+ public static revokeTitleToken<T>(
297
+ title_id: string,
298
+ token_id: string
299
+ ): AxiosPromise<Response<T>> {
300
+ return Requests.processRoute(
301
+ TitlesRoute.routes.revokeToken,
302
+ {},
303
+ { title_id, token_id }
304
+ );
305
+ }
306
+
265
307
  }
266
308
 
267
309
  export default Titles;
@@ -20,6 +20,9 @@ class TitlesRoute {
20
20
  updateMediaOrder: { url: '/titles/{title_id}/updateMediaOrder', method: HTTP_METHODS.POST },
21
21
  importWishlist: { url: '/titles/{title_id}/wishlist/import', method: HTTP_METHODS.POST },
22
22
  getWishlist: { url: '/titles/{title_id}/wishlist', method: HTTP_METHODS.GET },
23
+ createToken: { url: '/titles/{title_id}/tokens', method: HTTP_METHODS.POST },
24
+ listTokens: { url: '/titles/{title_id}/tokens', method: HTTP_METHODS.GET },
25
+ revokeToken: { url: '/titles/{title_id}/tokens/{token_id}', method: HTTP_METHODS.DELETE },
23
26
  };
24
27
 
25
28
  }