diffio 0.1.4 → 0.1.7

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/README.md CHANGED
@@ -58,7 +58,7 @@ const project = await client.createProject({
58
58
 
59
59
  const generation = await client.createGeneration({
60
60
  apiProjectId: project.apiProjectId,
61
- model: "diffio-2",
61
+ model: "diffio-3.5",
62
62
  sampling: { steps: 12, guidance: 1.5 }
63
63
  });
64
64
 
@@ -73,7 +73,7 @@ import { DiffioClient } from "diffio";
73
73
  const client = new DiffioClient({ apiKey: "diffio_live_..." });
74
74
  const result = await client.audioIsolation.isolate({
75
75
  filePath: "sample.wav",
76
- model: "diffio-2",
76
+ model: "diffio-3.5",
77
77
  sampling: { steps: 12, guidance: 1.5 }
78
78
  });
79
79
 
@@ -91,7 +91,7 @@ import { DiffioClient } from "diffio";
91
91
  const client = new DiffioClient({ apiKey: "diffio_live_..." });
92
92
  const [audioBytes, info] = await client.restoreAudio({
93
93
  filePath: "sample.wav",
94
- model: "diffio-2",
94
+ model: "diffio-3.5",
95
95
  sampling: { steps: 12, guidance: 1.5 },
96
96
  onProgress: (progress) => console.log(progress.status)
97
97
  });
@@ -134,6 +134,35 @@ const download = await client.generations.getDownload({
134
134
  console.log(download.downloadUrl);
135
135
  ```
136
136
 
137
+ Set `downloadType` to `"transcript"` to fetch the transcript JSON artifact when the generation has one.
138
+
139
+ ```ts
140
+ const transcript = await client.generations.getDownload({
141
+ generationId: "gen_123",
142
+ apiProjectId: "proj_123",
143
+ downloadType: "transcript"
144
+ });
145
+ ```
146
+
147
+ ## Account, keys, usage, and webhook configuration
148
+
149
+ Agent keys can manage account settings, scoped keys, usage, and webhook endpoints.
150
+
151
+ ```ts
152
+ const settings = await client.account.getSettings();
153
+ const key = await client.apiKeys.create({
154
+ label: "Backend worker",
155
+ scopes: ["projects:read", "projects:write", "generations:read", "generations:write", "artifacts:read"]
156
+ });
157
+ const usage = await client.usage.summary({ apiKeyId: key.keyId });
158
+ const webhook = await client.webhooks.configure({
159
+ mode: "live",
160
+ url: "https://example.com/webhooks/diffio",
161
+ eventTypes: ["generation.completed", "generation.failed"],
162
+ apiKeyId: key.keyId
163
+ });
164
+ ```
165
+
137
166
  ## List projects
138
167
 
139
168
  ```ts
package/dist/Client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions, NormalizedClientOptions } from "./BaseClient";
2
- import type { AudioIsolationResult, CreateGenerationResponse, CreateProjectResponse, GenerationDownloadResponse, GenerationProgressResponse, ListProjectGenerationsResponse, ListProjectsResponse, RestoreMetadata, WebhookTestEventResponse } from "./api/types";
3
- import { AudioIsolationClient, GenerationsClient, ProjectsClient, WebhooksClient } from "./api/resources";
2
+ import type { AccountSettingsResponse, ApiKeyResponse, ApiKeysListResponse, AudioIsolationResult, CreateGenerationResponse, CreateProjectResponse, GenerationDownloadResponse, GenerationProgressResponse, ListProjectGenerationsResponse, ListProjectsResponse, RestoreMetadata, UsageSummaryResponse, WebhookConfigureResponse, WebhookTestEventResponse } from "./api/types";
3
+ import { AccountClient, ApiKeysClient, AudioIsolationClient, GenerationsClient, ProjectsClient, UsageClient, WebhooksClient } from "./api/resources";
4
4
  export declare namespace DiffioClient {
5
5
  type Options = BaseClientOptions;
6
6
  interface RequestOptions extends BaseRequestOptions {
@@ -11,6 +11,9 @@ export declare class DiffioClient {
11
11
  readonly audioIsolation: AudioIsolationClient;
12
12
  readonly generations: GenerationsClient;
13
13
  readonly projects: ProjectsClient;
14
+ readonly account: AccountClient;
15
+ readonly apiKeys: ApiKeysClient;
16
+ readonly usage: UsageClient;
14
17
  readonly webhooks: WebhooksClient;
15
18
  constructor(options?: DiffioClient.Options);
16
19
  close(): void;
@@ -58,6 +61,41 @@ export declare class DiffioClient {
58
61
  downloadType?: string;
59
62
  requestOptions?: DiffioClient.RequestOptions;
60
63
  }): Promise<GenerationDownloadResponse>;
64
+ getAccountSettings(options?: {
65
+ requestOptions?: DiffioClient.RequestOptions;
66
+ }): Promise<AccountSettingsResponse>;
67
+ updateAccountSettings(options: {
68
+ billingPolicy: Record<string, unknown>;
69
+ requestOptions?: DiffioClient.RequestOptions;
70
+ }): Promise<AccountSettingsResponse>;
71
+ createApiKey(options: {
72
+ label: string;
73
+ scopes: string[];
74
+ resourceBounds?: Record<string, unknown>;
75
+ requestOptions?: DiffioClient.RequestOptions;
76
+ }): Promise<ApiKeyResponse>;
77
+ listApiKeys(options?: {
78
+ requestOptions?: DiffioClient.RequestOptions;
79
+ }): Promise<ApiKeysListResponse>;
80
+ rotateApiKey(options: {
81
+ keyId: string;
82
+ requestOptions?: DiffioClient.RequestOptions;
83
+ }): Promise<ApiKeyResponse>;
84
+ revokeApiKey(options: {
85
+ keyId: string;
86
+ requestOptions?: DiffioClient.RequestOptions;
87
+ }): Promise<ApiKeyResponse>;
88
+ getUsageSummary(options?: {
89
+ apiKeyId?: string;
90
+ requestOptions?: DiffioClient.RequestOptions;
91
+ }): Promise<UsageSummaryResponse>;
92
+ configureWebhook(options: {
93
+ mode: string;
94
+ url: string;
95
+ eventTypes: string[];
96
+ apiKeyId?: string;
97
+ requestOptions?: DiffioClient.RequestOptions;
98
+ }): Promise<WebhookConfigureResponse>;
61
99
  sendWebhookTestEvent(options: {
62
100
  eventType: string;
63
101
  mode: string;
package/dist/Client.js CHANGED
@@ -48,7 +48,9 @@ const API_PREFIX = "v1";
48
48
  const MODEL_ENDPOINTS = {
49
49
  "diffio-2": "diffio-2.0-generation",
50
50
  "diffio-2-flash": "diffio-2.0-flash-generation",
51
- "diffio-3": "diffio-3.0-generation"
51
+ "diffio-3": "diffio-3.0-generation",
52
+ "diffio-3.4": "diffio-3.4-generation",
53
+ "diffio-3.5": "diffio-3.5-generation"
52
54
  };
53
55
  const DEFAULT_RETRY_STATUS_CODES = [408, 429, 500, 502, 503, 504];
54
56
  const DEFAULT_RETRY_BACKOFF = 0.5;
@@ -71,6 +73,9 @@ class DiffioClient {
71
73
  this.audioIsolation = new resources_1.AudioIsolationClient(this);
72
74
  this.generations = new resources_1.GenerationsClient(this);
73
75
  this.projects = new resources_1.ProjectsClient(this);
76
+ this.account = new resources_1.AccountClient(this);
77
+ this.apiKeys = new resources_1.ApiKeysClient(this);
78
+ this.usage = new resources_1.UsageClient(this);
74
79
  this.webhooks = new resources_1.WebhooksClient(this);
75
80
  }
76
81
  close() {
@@ -199,14 +204,83 @@ class DiffioClient {
199
204
  const { generationId, apiProjectId, downloadType, requestOptions } = options;
200
205
  const payload = { generationId, apiProjectId };
201
206
  if (downloadType != null) {
202
- if (downloadType !== "audio" && downloadType !== "video") {
203
- throw new errors_1.DiffioApiError("downloadType must be audio or video");
207
+ if (downloadType !== "audio" && downloadType !== "video" && downloadType !== "transcript") {
208
+ throw new errors_1.DiffioApiError("downloadType must be audio, video, or transcript");
204
209
  }
205
210
  payload.downloadType = downloadType;
206
211
  }
207
212
  const response = await this._requestJson("POST", "get_generation_download", payload, requestOptions);
208
213
  return (0, serialization_1.parseGenerationDownloadResponse)(response);
209
214
  }
215
+ async getAccountSettings(options = {}) {
216
+ const response = await this._requestJson("POST", "account/settings/get", {}, options.requestOptions);
217
+ return (0, serialization_1.parseAccountSettingsResponse)(response);
218
+ }
219
+ async updateAccountSettings(options) {
220
+ const { billingPolicy, requestOptions } = options;
221
+ if (!billingPolicy || typeof billingPolicy !== "object" || Array.isArray(billingPolicy)) {
222
+ throw new errors_1.DiffioApiError("billingPolicy must be an object");
223
+ }
224
+ const response = await this._requestJson("POST", "account/settings/update", { billingPolicy }, requestOptions);
225
+ return (0, serialization_1.parseAccountSettingsResponse)(response);
226
+ }
227
+ async createApiKey(options) {
228
+ const { label, scopes, resourceBounds, requestOptions } = options;
229
+ if (!label) {
230
+ throw new errors_1.DiffioApiError("label is required");
231
+ }
232
+ if (!Array.isArray(scopes)) {
233
+ throw new errors_1.DiffioApiError("scopes must be an array");
234
+ }
235
+ const response = await this._requestJson("POST", "api_keys/create", { label, scopes, resourceBounds: resourceBounds ?? {} }, requestOptions);
236
+ return (0, serialization_1.parseApiKeyResponse)(response);
237
+ }
238
+ async listApiKeys(options = {}) {
239
+ const response = await this._requestJson("POST", "api_keys/list", {}, options.requestOptions);
240
+ return (0, serialization_1.parseApiKeysListResponse)(response);
241
+ }
242
+ async rotateApiKey(options) {
243
+ const { keyId, requestOptions } = options;
244
+ if (!keyId) {
245
+ throw new errors_1.DiffioApiError("keyId is required");
246
+ }
247
+ const response = await this._requestJson("POST", "api_keys/rotate", { keyId }, requestOptions);
248
+ return (0, serialization_1.parseApiKeyResponse)(response);
249
+ }
250
+ async revokeApiKey(options) {
251
+ const { keyId, requestOptions } = options;
252
+ if (!keyId) {
253
+ throw new errors_1.DiffioApiError("keyId is required");
254
+ }
255
+ const response = await this._requestJson("POST", "api_keys/revoke", { keyId }, requestOptions);
256
+ return (0, serialization_1.parseApiKeyResponse)(response);
257
+ }
258
+ async getUsageSummary(options = {}) {
259
+ const payload = {};
260
+ if (options.apiKeyId != null) {
261
+ payload.apiKeyId = options.apiKeyId;
262
+ }
263
+ const response = await this._requestJson("POST", "usage/summary", payload, options.requestOptions);
264
+ return (0, serialization_1.parseUsageSummaryResponse)(response);
265
+ }
266
+ async configureWebhook(options) {
267
+ const { mode, url, eventTypes, apiKeyId, requestOptions } = options;
268
+ if (!WEBHOOK_MODES.includes(mode)) {
269
+ throw new errors_1.DiffioApiError("mode must be test or live");
270
+ }
271
+ if (!url) {
272
+ throw new errors_1.DiffioApiError("url is required");
273
+ }
274
+ if (!Array.isArray(eventTypes) || eventTypes.length === 0) {
275
+ throw new errors_1.DiffioApiError("eventTypes must be a non-empty array");
276
+ }
277
+ const payload = { mode, url, eventTypes };
278
+ if (apiKeyId != null) {
279
+ payload.apiKeyId = apiKeyId;
280
+ }
281
+ const response = await this._requestJson("POST", "webhooks/configure", payload, requestOptions);
282
+ return (0, serialization_1.parseWebhookConfigureResponse)(response);
283
+ }
210
284
  async sendWebhookTestEvent(options) {
211
285
  const { eventType, mode, apiKeyId, samplePayload, requestOptions } = options;
212
286
  if (!WEBHOOK_EVENT_TYPES.includes(eventType)) {
@@ -599,7 +673,12 @@ function isNodeReadable(value) {
599
673
  }
600
674
  async function createFileReadStream(filePath) {
601
675
  const fs = await Promise.resolve().then(() => __importStar(require("node:fs")));
602
- return fs.createReadStream(filePath);
676
+ const stream = fs.createReadStream(filePath);
677
+ await new Promise((resolve, reject) => {
678
+ stream.once("open", () => resolve());
679
+ stream.once("error", reject);
680
+ });
681
+ return stream;
603
682
  }
604
683
  function getFileSize(filePath) {
605
684
  const fs = require("node:fs");
@@ -0,0 +1,15 @@
1
+ import type { DiffioClient } from "../../../../Client";
2
+ import type { AccountSettingsResponse } from "../../../types";
3
+ export interface AccountGetSettingsOptions {
4
+ requestOptions?: DiffioClient.RequestOptions;
5
+ }
6
+ export interface AccountUpdateSettingsOptions {
7
+ billingPolicy: Record<string, unknown>;
8
+ requestOptions?: DiffioClient.RequestOptions;
9
+ }
10
+ export declare class AccountClient {
11
+ private _parent;
12
+ constructor(parent: DiffioClient);
13
+ getSettings(options?: AccountGetSettingsOptions): Promise<AccountSettingsResponse>;
14
+ updateSettings(options: AccountUpdateSettingsOptions): Promise<AccountSettingsResponse>;
15
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountClient = void 0;
4
+ class AccountClient {
5
+ constructor(parent) {
6
+ this._parent = parent;
7
+ }
8
+ async getSettings(options = {}) {
9
+ return this._parent.getAccountSettings(options);
10
+ }
11
+ async updateSettings(options) {
12
+ return this._parent.updateAccountSettings(options);
13
+ }
14
+ }
15
+ exports.AccountClient = AccountClient;
@@ -0,0 +1,27 @@
1
+ import type { DiffioClient } from "../../../../Client";
2
+ import type { ApiKeyResponse, ApiKeysListResponse } from "../../../types";
3
+ export interface ApiKeysCreateOptions {
4
+ label: string;
5
+ scopes: string[];
6
+ resourceBounds?: Record<string, unknown>;
7
+ requestOptions?: DiffioClient.RequestOptions;
8
+ }
9
+ export interface ApiKeysListOptions {
10
+ requestOptions?: DiffioClient.RequestOptions;
11
+ }
12
+ export interface ApiKeysRotateOptions {
13
+ keyId: string;
14
+ requestOptions?: DiffioClient.RequestOptions;
15
+ }
16
+ export interface ApiKeysRevokeOptions {
17
+ keyId: string;
18
+ requestOptions?: DiffioClient.RequestOptions;
19
+ }
20
+ export declare class ApiKeysClient {
21
+ private _parent;
22
+ constructor(parent: DiffioClient);
23
+ create(options: ApiKeysCreateOptions): Promise<ApiKeyResponse>;
24
+ list(options?: ApiKeysListOptions): Promise<ApiKeysListResponse>;
25
+ rotate(options: ApiKeysRotateOptions): Promise<ApiKeyResponse>;
26
+ revoke(options: ApiKeysRevokeOptions): Promise<ApiKeyResponse>;
27
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiKeysClient = void 0;
4
+ class ApiKeysClient {
5
+ constructor(parent) {
6
+ this._parent = parent;
7
+ }
8
+ async create(options) {
9
+ return this._parent.createApiKey(options);
10
+ }
11
+ async list(options = {}) {
12
+ return this._parent.listApiKeys(options);
13
+ }
14
+ async rotate(options) {
15
+ return this._parent.rotateApiKey(options);
16
+ }
17
+ async revoke(options) {
18
+ return this._parent.revokeApiKey(options);
19
+ }
20
+ }
21
+ exports.ApiKeysClient = ApiKeysClient;
@@ -1,4 +1,7 @@
1
+ export { AccountClient } from "./account/client/Client";
2
+ export { ApiKeysClient } from "./apiKeys/client/Client";
1
3
  export { AudioIsolationClient } from "./audioIsolation/client/Client";
2
4
  export { GenerationsClient } from "./generations/client/Client";
3
5
  export { ProjectsClient } from "./projects/client/Client";
6
+ export { UsageClient } from "./usage/client/Client";
4
7
  export { WebhooksClient } from "./webhooks/client/Client";
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebhooksClient = exports.ProjectsClient = exports.GenerationsClient = exports.AudioIsolationClient = void 0;
4
- var Client_1 = require("./audioIsolation/client/Client");
5
- Object.defineProperty(exports, "AudioIsolationClient", { enumerable: true, get: function () { return Client_1.AudioIsolationClient; } });
6
- var Client_2 = require("./generations/client/Client");
7
- Object.defineProperty(exports, "GenerationsClient", { enumerable: true, get: function () { return Client_2.GenerationsClient; } });
8
- var Client_3 = require("./projects/client/Client");
9
- Object.defineProperty(exports, "ProjectsClient", { enumerable: true, get: function () { return Client_3.ProjectsClient; } });
10
- var Client_4 = require("./webhooks/client/Client");
11
- Object.defineProperty(exports, "WebhooksClient", { enumerable: true, get: function () { return Client_4.WebhooksClient; } });
3
+ exports.WebhooksClient = exports.UsageClient = exports.ProjectsClient = exports.GenerationsClient = exports.AudioIsolationClient = exports.ApiKeysClient = exports.AccountClient = void 0;
4
+ var Client_1 = require("./account/client/Client");
5
+ Object.defineProperty(exports, "AccountClient", { enumerable: true, get: function () { return Client_1.AccountClient; } });
6
+ var Client_2 = require("./apiKeys/client/Client");
7
+ Object.defineProperty(exports, "ApiKeysClient", { enumerable: true, get: function () { return Client_2.ApiKeysClient; } });
8
+ var Client_3 = require("./audioIsolation/client/Client");
9
+ Object.defineProperty(exports, "AudioIsolationClient", { enumerable: true, get: function () { return Client_3.AudioIsolationClient; } });
10
+ var Client_4 = require("./generations/client/Client");
11
+ Object.defineProperty(exports, "GenerationsClient", { enumerable: true, get: function () { return Client_4.GenerationsClient; } });
12
+ var Client_5 = require("./projects/client/Client");
13
+ Object.defineProperty(exports, "ProjectsClient", { enumerable: true, get: function () { return Client_5.ProjectsClient; } });
14
+ var Client_6 = require("./usage/client/Client");
15
+ Object.defineProperty(exports, "UsageClient", { enumerable: true, get: function () { return Client_6.UsageClient; } });
16
+ var Client_7 = require("./webhooks/client/Client");
17
+ Object.defineProperty(exports, "WebhooksClient", { enumerable: true, get: function () { return Client_7.WebhooksClient; } });
@@ -0,0 +1,11 @@
1
+ import type { DiffioClient } from "../../../../Client";
2
+ import type { UsageSummaryResponse } from "../../../types";
3
+ export interface UsageSummaryOptions {
4
+ apiKeyId?: string;
5
+ requestOptions?: DiffioClient.RequestOptions;
6
+ }
7
+ export declare class UsageClient {
8
+ private _parent;
9
+ constructor(parent: DiffioClient);
10
+ summary(options?: UsageSummaryOptions): Promise<UsageSummaryResponse>;
11
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsageClient = void 0;
4
+ class UsageClient {
5
+ constructor(parent) {
6
+ this._parent = parent;
7
+ }
8
+ async summary(options = {}) {
9
+ return this._parent.getUsageSummary(options);
10
+ }
11
+ }
12
+ exports.UsageClient = UsageClient;
@@ -1,5 +1,5 @@
1
1
  import type { DiffioClient } from "../../../../Client";
2
- import type { GenerationWebhookEvent, WebhookTestEventResponse } from "../../../types";
2
+ import type { GenerationWebhookEvent, WebhookConfigureResponse, WebhookTestEventResponse } from "../../../types";
3
3
  export interface WebhookTestEventOptions {
4
4
  eventType: string;
5
5
  mode: string;
@@ -7,6 +7,13 @@ export interface WebhookTestEventOptions {
7
7
  samplePayload?: Record<string, unknown>;
8
8
  requestOptions?: DiffioClient.RequestOptions;
9
9
  }
10
+ export interface WebhookConfigureOptions {
11
+ mode: string;
12
+ url: string;
13
+ eventTypes: string[];
14
+ apiKeyId?: string;
15
+ requestOptions?: DiffioClient.RequestOptions;
16
+ }
10
17
  export type WebhookHeaders = Record<string, string | string[] | undefined> | Headers;
11
18
  export interface WebhookVerifyOptions {
12
19
  payload: string | Uint8Array;
@@ -17,5 +24,6 @@ export declare class WebhooksClient {
17
24
  private _parent;
18
25
  constructor(parent: DiffioClient);
19
26
  sendTestEvent(options: WebhookTestEventOptions): Promise<WebhookTestEventResponse>;
27
+ configure(options: WebhookConfigureOptions): Promise<WebhookConfigureResponse>;
20
28
  verifySignature(options: WebhookVerifyOptions): GenerationWebhookEvent;
21
29
  }
@@ -11,6 +11,9 @@ class WebhooksClient {
11
11
  async sendTestEvent(options) {
12
12
  return this._parent.sendWebhookTestEvent(options);
13
13
  }
14
+ async configure(options) {
15
+ return this._parent.configureWebhook(options);
16
+ }
14
17
  verifySignature(options) {
15
18
  const { payload, headers, secret } = options;
16
19
  if (!secret) {
@@ -1,4 +1,4 @@
1
- import type { AudioIsolationResult, CreateGenerationResponse, CreateProjectResponse, GenerationWebhookEvent, GenerationDownloadResponse, GenerationProgressResponse, GenerationProgressStage, ListProjectGenerationsResponse, ListProjectsResponse, ProjectGenerationSummary, ProjectSummary, WebhookTestEventResponse } from "./types";
1
+ import type { AccountSettingsResponse, ApiKeyResponse, ApiKeysListResponse, AudioIsolationResult, CreateGenerationResponse, CreateProjectResponse, GenerationWebhookEvent, GenerationDownloadResponse, GenerationProgressResponse, GenerationProgressStage, ListProjectGenerationsResponse, ListProjectsResponse, ProjectGenerationSummary, ProjectSummary, UsageSummaryResponse, WebhookConfigureResponse, WebhookTestEventResponse } from "./types";
2
2
  export declare function parseCreateProjectResponse(data: any): CreateProjectResponse;
3
3
  export declare function parseProjectSummary(data: any): ProjectSummary;
4
4
  export declare function parseListProjectsResponse(data: any): ListProjectsResponse;
@@ -9,5 +9,10 @@ export declare function parseGenerationProgressStage(data: any): GenerationProgr
9
9
  export declare function parseGenerationProgressResponse(data: any): GenerationProgressResponse;
10
10
  export declare function parseGenerationDownloadResponse(data: any): GenerationDownloadResponse;
11
11
  export declare function parseWebhookTestEventResponse(data: any): WebhookTestEventResponse;
12
+ export declare function parseAccountSettingsResponse(data: any): AccountSettingsResponse;
13
+ export declare function parseApiKeyResponse(data: any): ApiKeyResponse;
14
+ export declare function parseApiKeysListResponse(data: any): ApiKeysListResponse;
15
+ export declare function parseUsageSummaryResponse(data: any): UsageSummaryResponse;
16
+ export declare function parseWebhookConfigureResponse(data: any): WebhookConfigureResponse;
12
17
  export declare function parseGenerationWebhookEvent(data: any): GenerationWebhookEvent;
13
18
  export declare function createAudioIsolationResult(project: CreateProjectResponse, generation: CreateGenerationResponse): AudioIsolationResult;
@@ -10,6 +10,11 @@ exports.parseGenerationProgressStage = parseGenerationProgressStage;
10
10
  exports.parseGenerationProgressResponse = parseGenerationProgressResponse;
11
11
  exports.parseGenerationDownloadResponse = parseGenerationDownloadResponse;
12
12
  exports.parseWebhookTestEventResponse = parseWebhookTestEventResponse;
13
+ exports.parseAccountSettingsResponse = parseAccountSettingsResponse;
14
+ exports.parseApiKeyResponse = parseApiKeyResponse;
15
+ exports.parseApiKeysListResponse = parseApiKeysListResponse;
16
+ exports.parseUsageSummaryResponse = parseUsageSummaryResponse;
17
+ exports.parseWebhookConfigureResponse = parseWebhookConfigureResponse;
13
18
  exports.parseGenerationWebhookEvent = parseGenerationWebhookEvent;
14
19
  exports.createAudioIsolationResult = createAudioIsolationResult;
15
20
  function parseCreateProjectResponse(data) {
@@ -110,6 +115,44 @@ function parseWebhookTestEventResponse(data) {
110
115
  apiKeyId: data.apiKeyId ?? null
111
116
  };
112
117
  }
118
+ function parseAccountSettingsResponse(data) {
119
+ return {
120
+ apiKeyId: data?.apiKeyId ?? null,
121
+ account: data?.account && typeof data.account === "object" ? data.account : {}
122
+ };
123
+ }
124
+ function parseApiKeyResponse(data) {
125
+ return {
126
+ key: data?.key,
127
+ keyId: data?.keyId,
128
+ label: data?.label ?? "",
129
+ status: data?.status ?? "active",
130
+ keyPrefix: data?.keyPrefix ?? "",
131
+ role: data?.role ?? "scoped",
132
+ scopes: Array.isArray(data?.scopes) ? data.scopes.map(String) : [],
133
+ resourceBounds: data?.resourceBounds && typeof data.resourceBounds === "object" ? data.resourceBounds : {},
134
+ parentKeyId: data?.parentKeyId ?? null,
135
+ createdAt: data?.createdAt ?? null,
136
+ rotatedAt: data?.rotatedAt ?? null,
137
+ revokedAt: data?.revokedAt ?? null,
138
+ permissions: data?.permissions && typeof data.permissions === "object" ? data.permissions : undefined
139
+ };
140
+ }
141
+ function parseApiKeysListResponse(data) {
142
+ const items = Array.isArray(data?.keys) ? data.keys : [];
143
+ return { keys: items.filter(Boolean).map(parseApiKeyResponse) };
144
+ }
145
+ function parseUsageSummaryResponse(data) {
146
+ return {
147
+ usage: data?.usage && typeof data.usage === "object" ? data.usage : {},
148
+ billing: data?.billing && typeof data.billing === "object" ? data.billing : {}
149
+ };
150
+ }
151
+ function parseWebhookConfigureResponse(data) {
152
+ return {
153
+ webhook: data?.webhook && typeof data.webhook === "object" ? data.webhook : {}
154
+ };
155
+ }
113
156
  function parseGenerationWebhookEvent(data) {
114
157
  return {
115
158
  eventType: data.eventType,
@@ -1,5 +1,5 @@
1
- export type ModelKey = "diffio-2" | "diffio-2-flash" | "diffio-3";
2
- export type DownloadType = "audio" | "video";
1
+ export type ModelKey = "diffio-2" | "diffio-2-flash" | "diffio-3" | "diffio-3.4" | "diffio-3.5";
2
+ export type DownloadType = "audio" | "video" | "transcript";
3
3
  export type WebhookMode = "test" | "live";
4
4
  export type WebhookEventType = "generation.queued" | "generation.processing" | "generation.failed" | "generation.completed";
5
5
  export type GenerationWebhookStatus = "queued" | "processing" | "error" | "complete";
@@ -83,6 +83,35 @@ export interface WebhookTestEventResponse {
83
83
  mode?: WebhookMode | string | null;
84
84
  apiKeyId?: string | null;
85
85
  }
86
+ export interface AccountSettingsResponse {
87
+ apiKeyId?: string | null;
88
+ account: Record<string, unknown>;
89
+ }
90
+ export interface ApiKeyResponse {
91
+ key?: string;
92
+ keyId: string;
93
+ label: string;
94
+ status: string;
95
+ keyPrefix: string;
96
+ role: string;
97
+ scopes: string[];
98
+ resourceBounds: Record<string, unknown>;
99
+ parentKeyId?: string | null;
100
+ createdAt?: string | null;
101
+ rotatedAt?: string | null;
102
+ revokedAt?: string | null;
103
+ permissions?: Record<string, unknown>;
104
+ }
105
+ export interface ApiKeysListResponse {
106
+ keys: ApiKeyResponse[];
107
+ }
108
+ export interface UsageSummaryResponse {
109
+ usage: Record<string, unknown>;
110
+ billing: Record<string, unknown>;
111
+ }
112
+ export interface WebhookConfigureResponse {
113
+ webhook: Record<string, unknown>;
114
+ }
86
115
  export interface GenerationWebhookEvent {
87
116
  eventType: WebhookEventType | string;
88
117
  eventId: string;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const DIFFIO_SDK_VERSION = "0.1.4";
1
+ export declare const DIFFIO_SDK_VERSION = "0.1.7";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DIFFIO_SDK_VERSION = void 0;
4
- exports.DIFFIO_SDK_VERSION = "0.1.4";
4
+ exports.DIFFIO_SDK_VERSION = "0.1.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffio",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "Diffio API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",