@gpt-platform/client 0.2.0 → 0.2.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
@@ -3882,7 +3882,7 @@ declare class BrowserApiKeyError extends Error {
3882
3882
  }
3883
3883
 
3884
3884
  /** SDK version — updated automatically by mix update.sdks */
3885
- declare const SDK_VERSION = "0.2.0";
3885
+ declare const SDK_VERSION = "0.2.1";
3886
3886
  /** Default API version sent in every request — updated automatically by mix update.sdks */
3887
3887
  declare const DEFAULT_API_VERSION = "2026-02-25";
3888
3888
 
@@ -4352,6 +4352,123 @@ declare function createVoiceNamespace(rb: RequestBuilder): {
4352
4352
  };
4353
4353
  };
4354
4354
 
4355
+ type OAuthProvider = "google" | "github" | "microsoft";
4356
+ interface OAuthSignInOptions {
4357
+ /** Application ID (app_id) — required to scope the OAuth flow to your ISV application */
4358
+ appId: string;
4359
+ /**
4360
+ * URL to redirect to after OAuth completes. Must be in your application's
4361
+ * allowed callback URLs. If omitted, uses the application's default callback URL.
4362
+ */
4363
+ redirectUrl?: string;
4364
+ }
4365
+ declare function createIdentityNamespace(rb: RequestBuilder, baseUrl?: string): {
4366
+ /** Login with email and password — returns a token object */
4367
+ login: (email: string, password: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4368
+ /** Register a new user account */
4369
+ register: (email: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4370
+ /** Get the currently authenticated user */
4371
+ me: (options?: RequestOptions) => Promise<User>;
4372
+ /** Get the current user profile (alias for me()) */
4373
+ profile: (options?: RequestOptions) => Promise<User>;
4374
+ list: (options?: {
4375
+ page?: number;
4376
+ pageSize?: number;
4377
+ } & RequestOptions) => Promise<User[]>;
4378
+ listAll: (options?: RequestOptions) => Promise<User[]>;
4379
+ get: (id: string, options?: RequestOptions) => Promise<User>;
4380
+ create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<User>;
4381
+ /** Resend confirmation email to an unconfirmed user */
4382
+ resendConfirmation: (options?: RequestOptions) => Promise<User>;
4383
+ /** Confirm an email address using the token from the confirmation email */
4384
+ confirmEmail: (email: string, confirmationToken: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4385
+ /** Request a magic link sign-in email */
4386
+ requestMagicLink: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4387
+ /**
4388
+ * Request a password reset email — always returns success to prevent email enumeration.
4389
+ * The user will receive an email with a reset token if the account exists.
4390
+ */
4391
+ requestPasswordReset: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4392
+ /** Sign in using a token from a magic link email */
4393
+ signInWithMagicLink: (token: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4394
+ /** Reset a password using the token from a password reset email */
4395
+ resetPasswordWithToken: (token: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4396
+ /** Change password for the currently authenticated user */
4397
+ changePassword: (currentPassword: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4398
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
4399
+ tokens: {
4400
+ create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<Token>;
4401
+ };
4402
+ profiles: {
4403
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
4404
+ list: (options?: {
4405
+ page?: number;
4406
+ pageSize?: number;
4407
+ } & RequestOptions) => Promise<UserProfile[]>;
4408
+ listAll: (options?: RequestOptions) => Promise<UserProfile[]>;
4409
+ get: (id: string, options?: RequestOptions) => Promise<UserProfile>;
4410
+ create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4411
+ update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4412
+ };
4413
+ /**
4414
+ * Social OAuth sign-in (Google, GitHub, Microsoft).
4415
+ *
4416
+ * This is a browser-redirect flow — the backend redirects the user's browser
4417
+ * to the provider, then back to your `redirectUrl` with `?token=JWT` appended.
4418
+ *
4419
+ * @example
4420
+ * ```typescript
4421
+ * // Get the URL and redirect manually
4422
+ * const url = client.identity.oauth.getAuthorizationUrl('google', {
4423
+ * appId: 'your-app-id',
4424
+ * redirectUrl: 'https://yourapp.com/auth/callback',
4425
+ * });
4426
+ * window.location.href = url;
4427
+ *
4428
+ * // Or use the convenience helper (browser only)
4429
+ * client.identity.oauth.signIn('google', {
4430
+ * appId: 'your-app-id',
4431
+ * redirectUrl: 'https://yourapp.com/auth/callback',
4432
+ * });
4433
+ *
4434
+ * // On your callback page, extract the token:
4435
+ * const token = new URLSearchParams(window.location.search).get('token');
4436
+ * ```
4437
+ */
4438
+ oauth: {
4439
+ /**
4440
+ * Build the authorization URL for the given OAuth provider.
4441
+ * Navigate the user's browser to this URL to begin the sign-in flow.
4442
+ */
4443
+ getAuthorizationUrl(provider: OAuthProvider, options: OAuthSignInOptions): string;
4444
+ /**
4445
+ * Redirect the browser to the OAuth sign-in page for the given provider.
4446
+ * Only works in browser environments (sets `window.location.href`).
4447
+ *
4448
+ * After the user authenticates, they are redirected back to `redirectUrl`
4449
+ * with a `?token=JWT` query parameter containing their session token.
4450
+ */
4451
+ signIn(provider: OAuthProvider, options: OAuthSignInOptions): void;
4452
+ };
4453
+ apiKeys: {
4454
+ list: (options?: {
4455
+ page?: number;
4456
+ pageSize?: number;
4457
+ } & RequestOptions) => Promise<ApiKey[]>;
4458
+ listAll: (options?: RequestOptions) => Promise<ApiKey[]>;
4459
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
4460
+ update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<ApiKey>;
4461
+ create: (name: string, options?: RequestOptions) => Promise<ApiKey>;
4462
+ get: (id: string, options?: RequestOptions) => Promise<ApiKey>;
4463
+ /** Revoke an API key (permanently disables it) */
4464
+ revoke: (id: string, options?: RequestOptions) => Promise<ApiKey>;
4465
+ /** Rotate an API key (generates a new secret) */
4466
+ rotate: (id: string, options?: RequestOptions) => Promise<ApiKey>;
4467
+ /** Allocate credits to an API key */
4468
+ allocate: (id: string, amount: number, description: string, options?: RequestOptions) => Promise<ApiKey>;
4469
+ };
4470
+ };
4471
+
4355
4472
  /**
4356
4473
  * A single attribute filter predicate for server-side JSONB row filtering.
4357
4474
  * Operators: eq, not_eq, contains, in, lt, gt, not_null
@@ -4765,6 +4882,10 @@ declare class GptClient extends BaseClient {
4765
4882
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4766
4883
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4767
4884
  };
4885
+ oauth: {
4886
+ getAuthorizationUrl(provider: OAuthProvider, options: OAuthSignInOptions): string;
4887
+ signIn(provider: OAuthProvider, options: OAuthSignInOptions): void;
4888
+ };
4768
4889
  apiKeys: {
4769
4890
  list: (options?: {
4770
4891
  page?: number;
@@ -5245,73 +5366,6 @@ declare function createSearchNamespace(rb: RequestBuilder): {
5245
5366
  };
5246
5367
  };
5247
5368
 
5248
- declare function createIdentityNamespace(rb: RequestBuilder): {
5249
- /** Login with email and password — returns a token object */
5250
- login: (email: string, password: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5251
- /** Register a new user account */
5252
- register: (email: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5253
- /** Get the currently authenticated user */
5254
- me: (options?: RequestOptions) => Promise<User>;
5255
- /** Get the current user profile (alias for me()) */
5256
- profile: (options?: RequestOptions) => Promise<User>;
5257
- list: (options?: {
5258
- page?: number;
5259
- pageSize?: number;
5260
- } & RequestOptions) => Promise<User[]>;
5261
- listAll: (options?: RequestOptions) => Promise<User[]>;
5262
- get: (id: string, options?: RequestOptions) => Promise<User>;
5263
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<User>;
5264
- /** Resend confirmation email to an unconfirmed user */
5265
- resendConfirmation: (options?: RequestOptions) => Promise<User>;
5266
- /** Confirm an email address using the token from the confirmation email */
5267
- confirmEmail: (email: string, confirmationToken: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5268
- /** Request a magic link sign-in email */
5269
- requestMagicLink: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5270
- /**
5271
- * Request a password reset email — always returns success to prevent email enumeration.
5272
- * The user will receive an email with a reset token if the account exists.
5273
- */
5274
- requestPasswordReset: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5275
- /** Sign in using a token from a magic link email */
5276
- signInWithMagicLink: (token: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5277
- /** Reset a password using the token from a password reset email */
5278
- resetPasswordWithToken: (token: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5279
- /** Change password for the currently authenticated user */
5280
- changePassword: (currentPassword: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5281
- delete: (id: string, options?: RequestOptions) => Promise<true>;
5282
- tokens: {
5283
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<Token>;
5284
- };
5285
- profiles: {
5286
- delete: (id: string, options?: RequestOptions) => Promise<true>;
5287
- list: (options?: {
5288
- page?: number;
5289
- pageSize?: number;
5290
- } & RequestOptions) => Promise<UserProfile[]>;
5291
- listAll: (options?: RequestOptions) => Promise<UserProfile[]>;
5292
- get: (id: string, options?: RequestOptions) => Promise<UserProfile>;
5293
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
5294
- update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
5295
- };
5296
- apiKeys: {
5297
- list: (options?: {
5298
- page?: number;
5299
- pageSize?: number;
5300
- } & RequestOptions) => Promise<ApiKey[]>;
5301
- listAll: (options?: RequestOptions) => Promise<ApiKey[]>;
5302
- delete: (id: string, options?: RequestOptions) => Promise<true>;
5303
- update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<ApiKey>;
5304
- create: (name: string, options?: RequestOptions) => Promise<ApiKey>;
5305
- get: (id: string, options?: RequestOptions) => Promise<ApiKey>;
5306
- /** Revoke an API key (permanently disables it) */
5307
- revoke: (id: string, options?: RequestOptions) => Promise<ApiKey>;
5308
- /** Rotate an API key (generates a new secret) */
5309
- rotate: (id: string, options?: RequestOptions) => Promise<ApiKey>;
5310
- /** Allocate credits to an API key */
5311
- allocate: (id: string, amount: number, description: string, options?: RequestOptions) => Promise<ApiKey>;
5312
- };
5313
- };
5314
-
5315
5369
  declare function createBillingNamespace(rb: RequestBuilder): {
5316
5370
  wallet: {
5317
5371
  /** Get the current workspace wallet balance and details */
package/dist/index.d.ts CHANGED
@@ -3882,7 +3882,7 @@ declare class BrowserApiKeyError extends Error {
3882
3882
  }
3883
3883
 
3884
3884
  /** SDK version — updated automatically by mix update.sdks */
3885
- declare const SDK_VERSION = "0.2.0";
3885
+ declare const SDK_VERSION = "0.2.1";
3886
3886
  /** Default API version sent in every request — updated automatically by mix update.sdks */
3887
3887
  declare const DEFAULT_API_VERSION = "2026-02-25";
3888
3888
 
@@ -4352,6 +4352,123 @@ declare function createVoiceNamespace(rb: RequestBuilder): {
4352
4352
  };
4353
4353
  };
4354
4354
 
4355
+ type OAuthProvider = "google" | "github" | "microsoft";
4356
+ interface OAuthSignInOptions {
4357
+ /** Application ID (app_id) — required to scope the OAuth flow to your ISV application */
4358
+ appId: string;
4359
+ /**
4360
+ * URL to redirect to after OAuth completes. Must be in your application's
4361
+ * allowed callback URLs. If omitted, uses the application's default callback URL.
4362
+ */
4363
+ redirectUrl?: string;
4364
+ }
4365
+ declare function createIdentityNamespace(rb: RequestBuilder, baseUrl?: string): {
4366
+ /** Login with email and password — returns a token object */
4367
+ login: (email: string, password: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4368
+ /** Register a new user account */
4369
+ register: (email: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4370
+ /** Get the currently authenticated user */
4371
+ me: (options?: RequestOptions) => Promise<User>;
4372
+ /** Get the current user profile (alias for me()) */
4373
+ profile: (options?: RequestOptions) => Promise<User>;
4374
+ list: (options?: {
4375
+ page?: number;
4376
+ pageSize?: number;
4377
+ } & RequestOptions) => Promise<User[]>;
4378
+ listAll: (options?: RequestOptions) => Promise<User[]>;
4379
+ get: (id: string, options?: RequestOptions) => Promise<User>;
4380
+ create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<User>;
4381
+ /** Resend confirmation email to an unconfirmed user */
4382
+ resendConfirmation: (options?: RequestOptions) => Promise<User>;
4383
+ /** Confirm an email address using the token from the confirmation email */
4384
+ confirmEmail: (email: string, confirmationToken: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4385
+ /** Request a magic link sign-in email */
4386
+ requestMagicLink: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4387
+ /**
4388
+ * Request a password reset email — always returns success to prevent email enumeration.
4389
+ * The user will receive an email with a reset token if the account exists.
4390
+ */
4391
+ requestPasswordReset: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4392
+ /** Sign in using a token from a magic link email */
4393
+ signInWithMagicLink: (token: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4394
+ /** Reset a password using the token from a password reset email */
4395
+ resetPasswordWithToken: (token: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4396
+ /** Change password for the currently authenticated user */
4397
+ changePassword: (currentPassword: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
4398
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
4399
+ tokens: {
4400
+ create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<Token>;
4401
+ };
4402
+ profiles: {
4403
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
4404
+ list: (options?: {
4405
+ page?: number;
4406
+ pageSize?: number;
4407
+ } & RequestOptions) => Promise<UserProfile[]>;
4408
+ listAll: (options?: RequestOptions) => Promise<UserProfile[]>;
4409
+ get: (id: string, options?: RequestOptions) => Promise<UserProfile>;
4410
+ create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4411
+ update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4412
+ };
4413
+ /**
4414
+ * Social OAuth sign-in (Google, GitHub, Microsoft).
4415
+ *
4416
+ * This is a browser-redirect flow — the backend redirects the user's browser
4417
+ * to the provider, then back to your `redirectUrl` with `?token=JWT` appended.
4418
+ *
4419
+ * @example
4420
+ * ```typescript
4421
+ * // Get the URL and redirect manually
4422
+ * const url = client.identity.oauth.getAuthorizationUrl('google', {
4423
+ * appId: 'your-app-id',
4424
+ * redirectUrl: 'https://yourapp.com/auth/callback',
4425
+ * });
4426
+ * window.location.href = url;
4427
+ *
4428
+ * // Or use the convenience helper (browser only)
4429
+ * client.identity.oauth.signIn('google', {
4430
+ * appId: 'your-app-id',
4431
+ * redirectUrl: 'https://yourapp.com/auth/callback',
4432
+ * });
4433
+ *
4434
+ * // On your callback page, extract the token:
4435
+ * const token = new URLSearchParams(window.location.search).get('token');
4436
+ * ```
4437
+ */
4438
+ oauth: {
4439
+ /**
4440
+ * Build the authorization URL for the given OAuth provider.
4441
+ * Navigate the user's browser to this URL to begin the sign-in flow.
4442
+ */
4443
+ getAuthorizationUrl(provider: OAuthProvider, options: OAuthSignInOptions): string;
4444
+ /**
4445
+ * Redirect the browser to the OAuth sign-in page for the given provider.
4446
+ * Only works in browser environments (sets `window.location.href`).
4447
+ *
4448
+ * After the user authenticates, they are redirected back to `redirectUrl`
4449
+ * with a `?token=JWT` query parameter containing their session token.
4450
+ */
4451
+ signIn(provider: OAuthProvider, options: OAuthSignInOptions): void;
4452
+ };
4453
+ apiKeys: {
4454
+ list: (options?: {
4455
+ page?: number;
4456
+ pageSize?: number;
4457
+ } & RequestOptions) => Promise<ApiKey[]>;
4458
+ listAll: (options?: RequestOptions) => Promise<ApiKey[]>;
4459
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
4460
+ update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<ApiKey>;
4461
+ create: (name: string, options?: RequestOptions) => Promise<ApiKey>;
4462
+ get: (id: string, options?: RequestOptions) => Promise<ApiKey>;
4463
+ /** Revoke an API key (permanently disables it) */
4464
+ revoke: (id: string, options?: RequestOptions) => Promise<ApiKey>;
4465
+ /** Rotate an API key (generates a new secret) */
4466
+ rotate: (id: string, options?: RequestOptions) => Promise<ApiKey>;
4467
+ /** Allocate credits to an API key */
4468
+ allocate: (id: string, amount: number, description: string, options?: RequestOptions) => Promise<ApiKey>;
4469
+ };
4470
+ };
4471
+
4355
4472
  /**
4356
4473
  * A single attribute filter predicate for server-side JSONB row filtering.
4357
4474
  * Operators: eq, not_eq, contains, in, lt, gt, not_null
@@ -4765,6 +4882,10 @@ declare class GptClient extends BaseClient {
4765
4882
  create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4766
4883
  update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
4767
4884
  };
4885
+ oauth: {
4886
+ getAuthorizationUrl(provider: OAuthProvider, options: OAuthSignInOptions): string;
4887
+ signIn(provider: OAuthProvider, options: OAuthSignInOptions): void;
4888
+ };
4768
4889
  apiKeys: {
4769
4890
  list: (options?: {
4770
4891
  page?: number;
@@ -5245,73 +5366,6 @@ declare function createSearchNamespace(rb: RequestBuilder): {
5245
5366
  };
5246
5367
  };
5247
5368
 
5248
- declare function createIdentityNamespace(rb: RequestBuilder): {
5249
- /** Login with email and password — returns a token object */
5250
- login: (email: string, password: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5251
- /** Register a new user account */
5252
- register: (email: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5253
- /** Get the currently authenticated user */
5254
- me: (options?: RequestOptions) => Promise<User>;
5255
- /** Get the current user profile (alias for me()) */
5256
- profile: (options?: RequestOptions) => Promise<User>;
5257
- list: (options?: {
5258
- page?: number;
5259
- pageSize?: number;
5260
- } & RequestOptions) => Promise<User[]>;
5261
- listAll: (options?: RequestOptions) => Promise<User[]>;
5262
- get: (id: string, options?: RequestOptions) => Promise<User>;
5263
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<User>;
5264
- /** Resend confirmation email to an unconfirmed user */
5265
- resendConfirmation: (options?: RequestOptions) => Promise<User>;
5266
- /** Confirm an email address using the token from the confirmation email */
5267
- confirmEmail: (email: string, confirmationToken: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5268
- /** Request a magic link sign-in email */
5269
- requestMagicLink: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5270
- /**
5271
- * Request a password reset email — always returns success to prevent email enumeration.
5272
- * The user will receive an email with a reset token if the account exists.
5273
- */
5274
- requestPasswordReset: (email: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5275
- /** Sign in using a token from a magic link email */
5276
- signInWithMagicLink: (token: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5277
- /** Reset a password using the token from a password reset email */
5278
- resetPasswordWithToken: (token: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5279
- /** Change password for the currently authenticated user */
5280
- changePassword: (currentPassword: string, password: string, passwordConfirmation: string, options?: RequestOptions) => Promise<Record<string, unknown>>;
5281
- delete: (id: string, options?: RequestOptions) => Promise<true>;
5282
- tokens: {
5283
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<Token>;
5284
- };
5285
- profiles: {
5286
- delete: (id: string, options?: RequestOptions) => Promise<true>;
5287
- list: (options?: {
5288
- page?: number;
5289
- pageSize?: number;
5290
- } & RequestOptions) => Promise<UserProfile[]>;
5291
- listAll: (options?: RequestOptions) => Promise<UserProfile[]>;
5292
- get: (id: string, options?: RequestOptions) => Promise<UserProfile>;
5293
- create: (attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
5294
- update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<UserProfile>;
5295
- };
5296
- apiKeys: {
5297
- list: (options?: {
5298
- page?: number;
5299
- pageSize?: number;
5300
- } & RequestOptions) => Promise<ApiKey[]>;
5301
- listAll: (options?: RequestOptions) => Promise<ApiKey[]>;
5302
- delete: (id: string, options?: RequestOptions) => Promise<true>;
5303
- update: (id: string, attributes: Record<string, unknown>, options?: RequestOptions) => Promise<ApiKey>;
5304
- create: (name: string, options?: RequestOptions) => Promise<ApiKey>;
5305
- get: (id: string, options?: RequestOptions) => Promise<ApiKey>;
5306
- /** Revoke an API key (permanently disables it) */
5307
- revoke: (id: string, options?: RequestOptions) => Promise<ApiKey>;
5308
- /** Rotate an API key (generates a new secret) */
5309
- rotate: (id: string, options?: RequestOptions) => Promise<ApiKey>;
5310
- /** Allocate credits to an API key */
5311
- allocate: (id: string, amount: number, description: string, options?: RequestOptions) => Promise<ApiKey>;
5312
- };
5313
- };
5314
-
5315
5369
  declare function createBillingNamespace(rb: RequestBuilder): {
5316
5370
  wallet: {
5317
5371
  /** Get the current workspace wallet balance and details */
package/dist/index.js CHANGED
@@ -1285,7 +1285,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1285
1285
  }
1286
1286
 
1287
1287
  // src/version.ts
1288
- var SDK_VERSION = "0.2.0";
1288
+ var SDK_VERSION = "0.2.1";
1289
1289
  var DEFAULT_API_VERSION = "2026-02-25";
1290
1290
 
1291
1291
  // src/base-client.ts
@@ -4347,7 +4347,7 @@ var ChangePasswordSchema = import_zod2.z.object({
4347
4347
  message: "Passwords do not match",
4348
4348
  path: ["password_confirmation"]
4349
4349
  });
4350
- function createIdentityNamespace(rb) {
4350
+ function createIdentityNamespace(rb, baseUrl) {
4351
4351
  return {
4352
4352
  /** Login with email and password — returns a token object */
4353
4353
  login: async (email, password, options) => {
@@ -4600,6 +4600,58 @@ function createIdentityNamespace(rb) {
4600
4600
  );
4601
4601
  }
4602
4602
  },
4603
+ /**
4604
+ * Social OAuth sign-in (Google, GitHub, Microsoft).
4605
+ *
4606
+ * This is a browser-redirect flow — the backend redirects the user's browser
4607
+ * to the provider, then back to your `redirectUrl` with `?token=JWT` appended.
4608
+ *
4609
+ * @example
4610
+ * ```typescript
4611
+ * // Get the URL and redirect manually
4612
+ * const url = client.identity.oauth.getAuthorizationUrl('google', {
4613
+ * appId: 'your-app-id',
4614
+ * redirectUrl: 'https://yourapp.com/auth/callback',
4615
+ * });
4616
+ * window.location.href = url;
4617
+ *
4618
+ * // Or use the convenience helper (browser only)
4619
+ * client.identity.oauth.signIn('google', {
4620
+ * appId: 'your-app-id',
4621
+ * redirectUrl: 'https://yourapp.com/auth/callback',
4622
+ * });
4623
+ *
4624
+ * // On your callback page, extract the token:
4625
+ * const token = new URLSearchParams(window.location.search).get('token');
4626
+ * ```
4627
+ */
4628
+ oauth: {
4629
+ /**
4630
+ * Build the authorization URL for the given OAuth provider.
4631
+ * Navigate the user's browser to this URL to begin the sign-in flow.
4632
+ */
4633
+ getAuthorizationUrl(provider, options) {
4634
+ const base = (baseUrl ?? "").replace(/\/$/, "");
4635
+ const params = { app_id: options.appId };
4636
+ if (options.redirectUrl) params["redirect_url"] = options.redirectUrl;
4637
+ return `${base}/oauth/${provider}?${new URLSearchParams(params).toString()}`;
4638
+ },
4639
+ /**
4640
+ * Redirect the browser to the OAuth sign-in page for the given provider.
4641
+ * Only works in browser environments (sets `window.location.href`).
4642
+ *
4643
+ * After the user authenticates, they are redirected back to `redirectUrl`
4644
+ * with a `?token=JWT` query parameter containing their session token.
4645
+ */
4646
+ signIn(provider, options) {
4647
+ if (typeof window === "undefined") {
4648
+ throw new Error(
4649
+ "identity.oauth.signIn() requires a browser environment. Use identity.oauth.getAuthorizationUrl() to get the URL and redirect manually."
4650
+ );
4651
+ }
4652
+ window.location.href = this.getAuthorizationUrl(provider, options);
4653
+ }
4654
+ },
4603
4655
  apiKeys: {
4604
4656
  list: async (options) => {
4605
4657
  return rb.execute(
@@ -6496,7 +6548,7 @@ var GptClient = class extends BaseClient {
6496
6548
  this.billing = createBillingNamespace(rb);
6497
6549
  this.communication = createCommunicationNamespace(rb);
6498
6550
  this.extraction = createExtractionNamespace(rb);
6499
- this.identity = createIdentityNamespace(rb);
6551
+ this.identity = createIdentityNamespace(rb, this.config?.baseUrl);
6500
6552
  this.platform = createPlatformNamespace(rb);
6501
6553
  this.scheduling = createSchedulingNamespace(rb);
6502
6554
  this.search = createSearchNamespace(rb);