@breeze.blue/sdk 0.9.0 → 0.10.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.10.0
4
+
5
+ - Added typed Voice Metadata codes and camelCase response fields for gender,
6
+ age, tone, and accent. `voices.edit(...)` uses `null` or an empty tone array
7
+ to clear metadata, and `voices.savePreview(...)` accepts metadata when saving
8
+ a preview.
4
9
 
5
10
  ## 0.9.0
6
11
 
package/README.md CHANGED
@@ -450,17 +450,31 @@ const saved = await client.voices.savePreview({
450
450
  generatedVoiceId,
451
451
  voiceName: "Documentary narrator",
452
452
  languageCode: "en",
453
+ gender: "neutral",
454
+ age: "middle_aged",
455
+ tone: ["warm", "articulate"],
456
+ accent: "american",
453
457
  });
454
458
  ```
455
459
 
456
460
  Edit, tune settings, or delete a saved voice:
457
461
 
458
462
  ```ts
459
- await client.voices.edit(saved.voiceId, { name: "Renamed narrator", languageCode: "en" });
463
+ await client.voices.edit(saved.voiceId, {
464
+ name: "Renamed narrator",
465
+ languageCode: "en",
466
+ tone: ["calm", "measured"],
467
+ });
468
+ // null clears nullable metadata; [] clears tone. Omitted fields remain unchanged.
469
+ await client.voices.edit(saved.voiceId, { accent: null, tone: [] });
460
470
  await client.voices.editSettings(saved.voiceId, { guidanceScale: 1.2 });
461
471
  await client.voices.delete(saved.voiceId);
462
472
  ```
463
473
 
474
+ Voice Metadata uses stable code values. `gender`, `age`, and `accent` may be
475
+ `null`; `tone` contains up to three distinct codes. English and Chinese use
476
+ different accent code sets, and other languages require `accent: null`.
477
+
464
478
  ## History, Models, and Account
465
479
 
466
480
  ```ts
package/dist/client.js CHANGED
@@ -1547,6 +1547,10 @@ class VoicesResource {
1547
1547
  visibility: request.visibility,
1548
1548
  playedNotSelectedVoiceIds: request.playedNotSelectedVoiceIds,
1549
1549
  languageCode: request.languageCode,
1550
+ gender: request.gender,
1551
+ age: request.age,
1552
+ tone: request.tone,
1553
+ accent: request.accent,
1550
1554
  }, options);
1551
1555
  }
1552
1556
  }
@@ -1696,11 +1700,28 @@ function voiceEditForm(request) {
1696
1700
  appendOptional(form, "primary_category_code", request.primaryCategoryCode);
1697
1701
  appendOptional(form, "visibility", request.visibility);
1698
1702
  appendOptional(form, "language_code", request.languageCode);
1703
+ appendNullable(form, "gender", request.gender);
1704
+ appendNullable(form, "age", request.age);
1705
+ if (request.tone !== undefined) {
1706
+ if (request.tone.length === 0) {
1707
+ form.append("tone", "");
1708
+ }
1709
+ else {
1710
+ for (const tone of request.tone)
1711
+ form.append("tone", tone);
1712
+ }
1713
+ }
1714
+ appendNullable(form, "accent", request.accent);
1699
1715
  for (const file of normalizeFiles(request.file, request.files, { required: false })) {
1700
1716
  appendFile(form, "files", file);
1701
1717
  }
1702
1718
  return form;
1703
1719
  }
1720
+ function appendNullable(form, key, value) {
1721
+ if (value === undefined)
1722
+ return;
1723
+ form.set(key, value ?? "");
1724
+ }
1704
1725
  function appendOptional(form, key, value) {
1705
1726
  if (value === undefined)
1706
1727
  return;
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequest
3
3
  export { BreezeBlueClient, ManagedRealtimeTextToSpeechConnection, RealtimeTextToSpeechConnection, } from "./client.js";
4
4
  export { SDK_NAME, SDK_VERSION } from "./version.js";
5
5
  export type * from "./types.js";
6
+ export * from "./voice-metadata.js";
package/dist/index.js CHANGED
@@ -2,3 +2,4 @@ export { AudioResponse } from "./audio.js";
2
2
  export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
3
3
  export { BreezeBlueClient, ManagedRealtimeTextToSpeechConnection, RealtimeTextToSpeechConnection, } from "./client.js";
4
4
  export { SDK_NAME, SDK_VERSION } from "./version.js";
5
+ export * from "./voice-metadata.js";
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { VoiceAccent, VoiceAge, VoiceGender, VoiceTone } from "./voice-metadata.js";
1
2
  export type JsonObject = Record<string, unknown>;
2
3
  export type BreezeBlueFetch = typeof fetch;
3
4
  export interface BreezeBlueClientOptions {
@@ -310,6 +311,10 @@ export interface Voice {
310
311
  primaryCategoryCode?: string | null;
311
312
  visibility?: string | null;
312
313
  languageCode: string;
314
+ gender: VoiceGender | null;
315
+ age: VoiceAge | null;
316
+ tone: VoiceTone[];
317
+ accent: VoiceAccent | null;
313
318
  [key: string]: unknown;
314
319
  }
315
320
  export interface SavedVoice {
@@ -322,6 +327,10 @@ export interface SavedVoice {
322
327
  primaryCategoryCode?: string | null;
323
328
  visibility?: string | null;
324
329
  languageCode: string;
330
+ gender: VoiceGender | null;
331
+ age: VoiceAge | null;
332
+ tone: VoiceTone[];
333
+ accent: VoiceAccent | null;
325
334
  }
326
335
  export interface VoiceList {
327
336
  voices: Voice[];
@@ -372,6 +381,10 @@ export interface VoiceEditRequest {
372
381
  primaryCategoryCode?: string;
373
382
  visibility?: "private" | "public" | string;
374
383
  languageCode?: string;
384
+ gender?: VoiceGender | null;
385
+ age?: VoiceAge | null;
386
+ tone?: VoiceTone[];
387
+ accent?: VoiceAccent | null;
375
388
  file?: UploadData | UploadFile;
376
389
  files?: Array<UploadData | UploadFile>;
377
390
  }
@@ -406,6 +419,10 @@ export interface SaveVoiceRequest {
406
419
  visibility?: "private" | "public" | string;
407
420
  playedNotSelectedVoiceIds?: string[];
408
421
  languageCode?: string;
422
+ gender?: VoiceGender | null;
423
+ age?: VoiceAge | null;
424
+ tone?: VoiceTone[];
425
+ accent?: VoiceAccent | null;
409
426
  }
410
427
  export interface HistoryItem {
411
428
  historyItemId: string;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.9.0";
1
+ export declare const SDK_VERSION = "0.10.0";
2
2
  export declare const SDK_NAME = "@breeze.blue/sdk";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const SDK_VERSION = "0.9.0";
1
+ export const SDK_VERSION = "0.10.0";
2
2
  export const SDK_NAME = "@breeze.blue/sdk";
@@ -0,0 +1,11 @@
1
+ export declare const VOICE_GENDER_CODES: readonly ["male", "female", "neutral"];
2
+ export declare const VOICE_AGE_CODES: readonly ["child", "young", "middle_aged", "old"];
3
+ export declare const VOICE_TONE_CODES: readonly ["warm", "calm", "bright", "gentle", "energetic", "authoritative", "sincere", "weary", "precise", "refined", "urgent", "friendly", "articulate", "steady", "playful", "compassionate", "reflective", "measured", "rhythmic", "passionate"];
4
+ export declare const VOICE_ACCENT_CODES_BY_LANGUAGE: {
5
+ readonly en: readonly ["american", "british", "scottish", "irish", "australian", "canadian", "us_southern", "us_new_york", "indian", "south_african", "russian", "japanese", "korean", "chinese"];
6
+ readonly zh: readonly ["mandarin_guangdong", "mandarin_northeastern", "mandarin_shaanxi", "mandarin_shanghai", "mandarin_sichuan", "mandarin_yunnan", "mandarin_henan", "cantonese"];
7
+ };
8
+ export type VoiceGender = (typeof VOICE_GENDER_CODES)[number];
9
+ export type VoiceAge = (typeof VOICE_AGE_CODES)[number];
10
+ export type VoiceTone = (typeof VOICE_TONE_CODES)[number];
11
+ export type VoiceAccent = (typeof VOICE_ACCENT_CODES_BY_LANGUAGE)[keyof typeof VOICE_ACCENT_CODES_BY_LANGUAGE][number];
@@ -0,0 +1,8 @@
1
+ // Generated from contracts/voice-metadata.json. Do not edit manually.
2
+ export const VOICE_GENDER_CODES = ["male", "female", "neutral"];
3
+ export const VOICE_AGE_CODES = ["child", "young", "middle_aged", "old"];
4
+ export const VOICE_TONE_CODES = ["warm", "calm", "bright", "gentle", "energetic", "authoritative", "sincere", "weary", "precise", "refined", "urgent", "friendly", "articulate", "steady", "playful", "compassionate", "reflective", "measured", "rhythmic", "passionate"];
5
+ export const VOICE_ACCENT_CODES_BY_LANGUAGE = {
6
+ en: ["american", "british", "scottish", "irish", "australian", "canadian", "us_southern", "us_new_york", "indian", "south_african", "russian", "japanese", "korean", "chinese"],
7
+ zh: ["mandarin_guangdong", "mandarin_northeastern", "mandarin_shaanxi", "mandarin_shanghai", "mandarin_sichuan", "mandarin_yunnan", "mandarin_henan", "cantonese"],
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeze.blue/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "ESM-first TypeScript SDK for the Breeze Blue Developer API.",
5
5
  "license": "MIT",
6
6
  "author": "Breeze Blue <support@breeze.blue>",