perspectapi-ts-sdk 6.4.0 → 6.4.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.mts CHANGED
@@ -1967,7 +1967,7 @@ declare class SiteUsersV2Client extends BaseV2Client {
1967
1967
  /** Update the authenticated user's own fields. */
1968
1968
  updateMe(siteName: string, data: V2SiteUserMeUpdateParams): Promise<V2SiteUser>;
1969
1969
  /** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
1970
- getProfile(siteName: string): Promise<V2SiteUserProfile>;
1970
+ getProfile(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile>;
1971
1971
  /**
1972
1972
  * Set a single profile key. The value is persisted verbatim — callers wanting
1973
1973
  * structured data should JSON-stringify their value first.
@@ -2104,7 +2104,7 @@ declare class WebhooksV2Client extends BaseV2Client {
2104
2104
 
2105
2105
  declare class SubscriptionsV2Client extends BaseV2Client {
2106
2106
  /** List all subscriptions for the authenticated user. */
2107
- listMySubscriptions(siteName: string): Promise<V2List<V2SiteUserSubscription>>;
2107
+ listMySubscriptions(siteName: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
2108
2108
  /** Pause a subscription. */
2109
2109
  pauseSubscription(siteName: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
2110
2110
  /** Resume a paused subscription. */
@@ -2114,7 +2114,7 @@ declare class SubscriptionsV2Client extends BaseV2Client {
2114
2114
  /** Change the plan (price) of a subscription. */
2115
2115
  changeSubscriptionPlan(siteName: string, subId: string, params: V2SubscriptionChangePlanParams): Promise<V2SiteUserSubscription>;
2116
2116
  /** List subscriptions for a specific user (admin). */
2117
- listUserSubscriptions(siteName: string, userId: string): Promise<V2List<V2SiteUserSubscription>>;
2117
+ listUserSubscriptions(siteName: string, userId: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
2118
2118
  /** Pause a user's subscription (admin). */
2119
2119
  pauseUserSubscription(siteName: string, userId: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
2120
2120
  /** Resume a user's paused subscription (admin). */
package/dist/index.d.ts CHANGED
@@ -1967,7 +1967,7 @@ declare class SiteUsersV2Client extends BaseV2Client {
1967
1967
  /** Update the authenticated user's own fields. */
1968
1968
  updateMe(siteName: string, data: V2SiteUserMeUpdateParams): Promise<V2SiteUser>;
1969
1969
  /** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
1970
- getProfile(siteName: string): Promise<V2SiteUserProfile>;
1970
+ getProfile(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile>;
1971
1971
  /**
1972
1972
  * Set a single profile key. The value is persisted verbatim — callers wanting
1973
1973
  * structured data should JSON-stringify their value first.
@@ -2104,7 +2104,7 @@ declare class WebhooksV2Client extends BaseV2Client {
2104
2104
 
2105
2105
  declare class SubscriptionsV2Client extends BaseV2Client {
2106
2106
  /** List all subscriptions for the authenticated user. */
2107
- listMySubscriptions(siteName: string): Promise<V2List<V2SiteUserSubscription>>;
2107
+ listMySubscriptions(siteName: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
2108
2108
  /** Pause a subscription. */
2109
2109
  pauseSubscription(siteName: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
2110
2110
  /** Resume a paused subscription. */
@@ -2114,7 +2114,7 @@ declare class SubscriptionsV2Client extends BaseV2Client {
2114
2114
  /** Change the plan (price) of a subscription. */
2115
2115
  changeSubscriptionPlan(siteName: string, subId: string, params: V2SubscriptionChangePlanParams): Promise<V2SiteUserSubscription>;
2116
2116
  /** List subscriptions for a specific user (admin). */
2117
- listUserSubscriptions(siteName: string, userId: string): Promise<V2List<V2SiteUserSubscription>>;
2117
+ listUserSubscriptions(siteName: string, userId: string, cachePolicy?: CachePolicy): Promise<V2List<V2SiteUserSubscription>>;
2118
2118
  /** Pause a user's subscription (admin). */
2119
2119
  pauseUserSubscription(siteName: string, userId: string, subId: string, params?: V2SubscriptionPauseParams): Promise<V2SiteUserSubscription>;
2120
2120
  /** Resume a user's paused subscription (admin). */
package/dist/index.js CHANGED
@@ -1038,9 +1038,11 @@ var SiteUsersV2Client = class extends BaseV2Client {
1038
1038
  );
1039
1039
  }
1040
1040
  /** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
1041
- async getProfile(siteName) {
1041
+ async getProfile(siteName, cachePolicy) {
1042
1042
  return this.getOne(
1043
- this.sitePath(siteName, "users", "me/profile")
1043
+ this.sitePath(siteName, "users", "me/profile"),
1044
+ void 0,
1045
+ cachePolicy
1044
1046
  );
1045
1047
  }
1046
1048
  /**
@@ -1258,9 +1260,11 @@ var WebhooksV2Client = class extends BaseV2Client {
1258
1260
  var SubscriptionsV2Client = class extends BaseV2Client {
1259
1261
  // --- Authenticated "me" endpoints (site-user JWT) ---
1260
1262
  /** List all subscriptions for the authenticated user. */
1261
- async listMySubscriptions(siteName) {
1263
+ async listMySubscriptions(siteName, cachePolicy) {
1262
1264
  return this.getList(
1263
- this.sitePath(siteName, "users", "me/subscriptions")
1265
+ this.sitePath(siteName, "users", "me/subscriptions"),
1266
+ void 0,
1267
+ cachePolicy
1264
1268
  );
1265
1269
  }
1266
1270
  /** Pause a subscription. */
@@ -1292,9 +1296,11 @@ var SubscriptionsV2Client = class extends BaseV2Client {
1292
1296
  }
1293
1297
  // --- Admin endpoints (API key) ---
1294
1298
  /** List subscriptions for a specific user (admin). */
1295
- async listUserSubscriptions(siteName, userId) {
1299
+ async listUserSubscriptions(siteName, userId, cachePolicy) {
1296
1300
  return this.getList(
1297
- this.sitePath(siteName, "users", `${userId}/subscriptions`)
1301
+ this.sitePath(siteName, "users", `${userId}/subscriptions`),
1302
+ void 0,
1303
+ cachePolicy
1298
1304
  );
1299
1305
  }
1300
1306
  /** Pause a user's subscription (admin). */
package/dist/index.mjs CHANGED
@@ -962,9 +962,11 @@ var SiteUsersV2Client = class extends BaseV2Client {
962
962
  );
963
963
  }
964
964
  /** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
965
- async getProfile(siteName) {
965
+ async getProfile(siteName, cachePolicy) {
966
966
  return this.getOne(
967
- this.sitePath(siteName, "users", "me/profile")
967
+ this.sitePath(siteName, "users", "me/profile"),
968
+ void 0,
969
+ cachePolicy
968
970
  );
969
971
  }
970
972
  /**
@@ -1182,9 +1184,11 @@ var WebhooksV2Client = class extends BaseV2Client {
1182
1184
  var SubscriptionsV2Client = class extends BaseV2Client {
1183
1185
  // --- Authenticated "me" endpoints (site-user JWT) ---
1184
1186
  /** List all subscriptions for the authenticated user. */
1185
- async listMySubscriptions(siteName) {
1187
+ async listMySubscriptions(siteName, cachePolicy) {
1186
1188
  return this.getList(
1187
- this.sitePath(siteName, "users", "me/subscriptions")
1189
+ this.sitePath(siteName, "users", "me/subscriptions"),
1190
+ void 0,
1191
+ cachePolicy
1188
1192
  );
1189
1193
  }
1190
1194
  /** Pause a subscription. */
@@ -1216,9 +1220,11 @@ var SubscriptionsV2Client = class extends BaseV2Client {
1216
1220
  }
1217
1221
  // --- Admin endpoints (API key) ---
1218
1222
  /** List subscriptions for a specific user (admin). */
1219
- async listUserSubscriptions(siteName, userId) {
1223
+ async listUserSubscriptions(siteName, userId, cachePolicy) {
1220
1224
  return this.getList(
1221
- this.sitePath(siteName, "users", `${userId}/subscriptions`)
1225
+ this.sitePath(siteName, "users", `${userId}/subscriptions`),
1226
+ void 0,
1227
+ cachePolicy
1222
1228
  );
1223
1229
  }
1224
1230
  /** Pause a user's subscription (admin). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perspectapi-ts-sdk",
3
- "version": "6.4.0",
3
+ "version": "6.4.1",
4
4
  "description": "TypeScript SDK for PerspectAPI - Cloudflare Workers compatible",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import { BaseV2Client } from './base-v2-client';
12
+ import type { CachePolicy } from '../../cache/types';
12
13
  import type {
13
14
  V2SiteUser,
14
15
  V2SiteUserUpdateParams,
@@ -91,9 +92,11 @@ export class SiteUsersV2Client extends BaseV2Client {
91
92
  }
92
93
 
93
94
  /** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
94
- async getProfile(siteName: string): Promise<V2SiteUserProfile> {
95
+ async getProfile(siteName: string, cachePolicy?: CachePolicy): Promise<V2SiteUserProfile> {
95
96
  return this.getOne<V2SiteUserProfile>(
96
97
  this.sitePath(siteName, 'users', 'me/profile'),
98
+ undefined,
99
+ cachePolicy,
97
100
  );
98
101
  }
99
102
 
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import { BaseV2Client } from './base-v2-client';
10
+ import type { CachePolicy } from '../../cache/types';
10
11
  import type {
11
12
  V2SiteUserSubscription,
12
13
  V2SubscriptionPauseParams,
@@ -23,9 +24,12 @@ export class SubscriptionsV2Client extends BaseV2Client {
23
24
  /** List all subscriptions for the authenticated user. */
24
25
  async listMySubscriptions(
25
26
  siteName: string,
27
+ cachePolicy?: CachePolicy,
26
28
  ): Promise<V2List<V2SiteUserSubscription>> {
27
29
  return this.getList<V2SiteUserSubscription>(
28
30
  this.sitePath(siteName, 'users', 'me/subscriptions'),
31
+ undefined,
32
+ cachePolicy,
29
33
  );
30
34
  }
31
35
 
@@ -81,9 +85,12 @@ export class SubscriptionsV2Client extends BaseV2Client {
81
85
  async listUserSubscriptions(
82
86
  siteName: string,
83
87
  userId: string,
88
+ cachePolicy?: CachePolicy,
84
89
  ): Promise<V2List<V2SiteUserSubscription>> {
85
90
  return this.getList<V2SiteUserSubscription>(
86
91
  this.sitePath(siteName, 'users', `${userId}/subscriptions`),
92
+ undefined,
93
+ cachePolicy,
87
94
  );
88
95
  }
89
96