export type UpdateApiV1LicenseVoicesVoiceIdReferencesReferenceIdEncodingArgs = {voice_id: number, reference_id: number, model_id: string, license_key?: (string | null) | undefined, 'X-Kugel-License-Key'?: (string | null) | undefined}; export type UpdateApiV1LicenseVoicesVoiceIdReferencesReferenceIdEncodingOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Upload Voice Encoding * * PUT /v1/license/voices/{voice_id}/references/{reference_id}/encoding */ export const updateApiV1LicenseVoicesVoiceIdReferencesReferenceIdEncoding = async (args: UpdateApiV1LicenseVoicesVoiceIdReferencesReferenceIdEncodingArgs, options: UpdateApiV1LicenseVoicesVoiceIdReferencesReferenceIdEncodingOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.model_id != null) query.append("model_id", String(args.model_id)) if (args.license_key != null) query.append("license_key", String(args.license_key)) if (args['X-Kugel-License-Key'] != null) headers.set("X-Kugel-License-Key", String(args['X-Kugel-License-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/license/voices/${encodeURIComponent(String(args.voice_id))}/references/${encodeURIComponent(String(args.reference_id))}/encoding${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };