UNPKG

@aristech-org/tts-client

Version:

A Node.js client library for the Aristech Text-to-Speech API

1,397 lines 61.4 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.7.7 // protoc v3.21.12 // source: TTSServices.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { makeGenericClientConstructor, } from "@grpc/grpc-js"; import { SpeechLocale, SpeechRequestOption, SsmlDocSection, Voice } from "./TTSTypes.js"; export const protobufPackage = "aristech.tts"; /** Commands that can be used in ServerCommand */ export var CommandType; (function (CommandType) { CommandType[CommandType["START_REQUEST"] = 0] = "START_REQUEST"; CommandType[CommandType["STOP_REQUEST"] = 1] = "STOP_REQUEST"; CommandType[CommandType["STATUS_REQUEST"] = 2] = "STATUS_REQUEST"; CommandType[CommandType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(CommandType || (CommandType = {})); export function commandTypeFromJSON(object) { switch (object) { case 0: case "START_REQUEST": return CommandType.START_REQUEST; case 1: case "STOP_REQUEST": return CommandType.STOP_REQUEST; case 2: case "STATUS_REQUEST": return CommandType.STATUS_REQUEST; case -1: case "UNRECOGNIZED": default: return CommandType.UNRECOGNIZED; } } export function commandTypeToJSON(object) { switch (object) { case CommandType.START_REQUEST: return "START_REQUEST"; case CommandType.STOP_REQUEST: return "STOP_REQUEST"; case CommandType.STATUS_REQUEST: return "STATUS_REQUEST"; case CommandType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export var CommandResponseType; (function (CommandResponseType) { /** STARTRESPONSE - Synthesis startet */ CommandResponseType[CommandResponseType["STARTRESPONSE"] = 0] = "STARTRESPONSE"; /** STOPRESPONSE - Synthesis stopped */ CommandResponseType[CommandResponseType["STOPRESPONSE"] = 1] = "STOPRESPONSE"; /** STATUSRESPONSE - Response contains status information */ CommandResponseType[CommandResponseType["STATUSRESPONSE"] = 2] = "STATUSRESPONSE"; /** SYNTHESISRESPONSE - Response contains SpeechResponses */ CommandResponseType[CommandResponseType["SYNTHESISRESPONSE"] = 3] = "SYNTHESISRESPONSE"; CommandResponseType[CommandResponseType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(CommandResponseType || (CommandResponseType = {})); export function commandResponseTypeFromJSON(object) { switch (object) { case 0: case "STARTRESPONSE": return CommandResponseType.STARTRESPONSE; case 1: case "STOPRESPONSE": return CommandResponseType.STOPRESPONSE; case 2: case "STATUSRESPONSE": return CommandResponseType.STATUSRESPONSE; case 3: case "SYNTHESISRESPONSE": return CommandResponseType.SYNTHESISRESPONSE; case -1: case "UNRECOGNIZED": default: return CommandResponseType.UNRECOGNIZED; } } export function commandResponseTypeToJSON(object) { switch (object) { case CommandResponseType.STARTRESPONSE: return "STARTRESPONSE"; case CommandResponseType.STOPRESPONSE: return "STOPRESPONSE"; case CommandResponseType.STATUSRESPONSE: return "STATUSRESPONSE"; case CommandResponseType.SYNTHESISRESPONSE: return "SYNTHESISRESPONSE"; case CommandResponseType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Status codes for adding a new voice. */ export var VoiceAdditionStatus; (function (VoiceAdditionStatus) { /** SUCCESS - Voice was added successfully. */ VoiceAdditionStatus[VoiceAdditionStatus["SUCCESS"] = 0] = "SUCCESS"; /** INVALID_VOICE_DATA - The provided voice data was invalid. */ VoiceAdditionStatus[VoiceAdditionStatus["INVALID_VOICE_DATA"] = 1] = "INVALID_VOICE_DATA"; /** BASE_VOICE_NOT_FOUND - The requested base voice was not found. */ VoiceAdditionStatus[VoiceAdditionStatus["BASE_VOICE_NOT_FOUND"] = 2] = "BASE_VOICE_NOT_FOUND"; /** INTERNAL_ERROR - The voice could not be added due to an internal server error. */ VoiceAdditionStatus[VoiceAdditionStatus["INTERNAL_ERROR"] = 3] = "INTERNAL_ERROR"; VoiceAdditionStatus[VoiceAdditionStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(VoiceAdditionStatus || (VoiceAdditionStatus = {})); export function voiceAdditionStatusFromJSON(object) { switch (object) { case 0: case "SUCCESS": return VoiceAdditionStatus.SUCCESS; case 1: case "INVALID_VOICE_DATA": return VoiceAdditionStatus.INVALID_VOICE_DATA; case 2: case "BASE_VOICE_NOT_FOUND": return VoiceAdditionStatus.BASE_VOICE_NOT_FOUND; case 3: case "INTERNAL_ERROR": return VoiceAdditionStatus.INTERNAL_ERROR; case -1: case "UNRECOGNIZED": default: return VoiceAdditionStatus.UNRECOGNIZED; } } export function voiceAdditionStatusToJSON(object) { switch (object) { case VoiceAdditionStatus.SUCCESS: return "SUCCESS"; case VoiceAdditionStatus.INVALID_VOICE_DATA: return "INVALID_VOICE_DATA"; case VoiceAdditionStatus.BASE_VOICE_NOT_FOUND: return "BASE_VOICE_NOT_FOUND"; case VoiceAdditionStatus.INTERNAL_ERROR: return "INTERNAL_ERROR"; case VoiceAdditionStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Status codes for clearing the cache. */ export var ClearCacheStatus; (function (ClearCacheStatus) { /** CLEARED_SUCCESSFULLY - Cache was cleared successfully. */ ClearCacheStatus[ClearCacheStatus["CLEARED_SUCCESSFULLY"] = 0] = "CLEARED_SUCCESSFULLY"; /** CACHE_DISABLED - The request was received, but caching is not enabled on the server. */ ClearCacheStatus[ClearCacheStatus["CACHE_DISABLED"] = 1] = "CACHE_DISABLED"; /** VOICE_ID_NOT_FOUND - Voice ID provided does not exist */ ClearCacheStatus[ClearCacheStatus["VOICE_ID_NOT_FOUND"] = 3] = "VOICE_ID_NOT_FOUND"; /** CLEAR_CACHE_ERROR - An error occurred during the operation. */ ClearCacheStatus[ClearCacheStatus["CLEAR_CACHE_ERROR"] = 2] = "CLEAR_CACHE_ERROR"; ClearCacheStatus[ClearCacheStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(ClearCacheStatus || (ClearCacheStatus = {})); export function clearCacheStatusFromJSON(object) { switch (object) { case 0: case "CLEARED_SUCCESSFULLY": return ClearCacheStatus.CLEARED_SUCCESSFULLY; case 1: case "CACHE_DISABLED": return ClearCacheStatus.CACHE_DISABLED; case 3: case "VOICE_ID_NOT_FOUND": return ClearCacheStatus.VOICE_ID_NOT_FOUND; case 2: case "CLEAR_CACHE_ERROR": return ClearCacheStatus.CLEAR_CACHE_ERROR; case -1: case "UNRECOGNIZED": default: return ClearCacheStatus.UNRECOGNIZED; } } export function clearCacheStatusToJSON(object) { switch (object) { case ClearCacheStatus.CLEARED_SUCCESSFULLY: return "CLEARED_SUCCESSFULLY"; case ClearCacheStatus.CACHE_DISABLED: return "CACHE_DISABLED"; case ClearCacheStatus.VOICE_ID_NOT_FOUND: return "VOICE_ID_NOT_FOUND"; case ClearCacheStatus.CLEAR_CACHE_ERROR: return "CLEAR_CACHE_ERROR"; case ClearCacheStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** Status codes for checking the cache backend. */ export var TestCacheConnectionStatus; (function (TestCacheConnectionStatus) { /** TEST_CACHE_CONNECTION_OK - Cache backend is enabled and usable. */ TestCacheConnectionStatus[TestCacheConnectionStatus["TEST_CACHE_CONNECTION_OK"] = 0] = "TEST_CACHE_CONNECTION_OK"; /** TEST_CACHE_CONNECTION_CACHE_DISABLED - Cache backend is not enabled/configured. */ TestCacheConnectionStatus[TestCacheConnectionStatus["TEST_CACHE_CONNECTION_CACHE_DISABLED"] = 1] = "TEST_CACHE_CONNECTION_CACHE_DISABLED"; /** TEST_CACHE_CONNECTION_ERROR - Cache backend is enabled but not usable (e.g. connection failure/timeouts). */ TestCacheConnectionStatus[TestCacheConnectionStatus["TEST_CACHE_CONNECTION_ERROR"] = 2] = "TEST_CACHE_CONNECTION_ERROR"; TestCacheConnectionStatus[TestCacheConnectionStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(TestCacheConnectionStatus || (TestCacheConnectionStatus = {})); export function testCacheConnectionStatusFromJSON(object) { switch (object) { case 0: case "TEST_CACHE_CONNECTION_OK": return TestCacheConnectionStatus.TEST_CACHE_CONNECTION_OK; case 1: case "TEST_CACHE_CONNECTION_CACHE_DISABLED": return TestCacheConnectionStatus.TEST_CACHE_CONNECTION_CACHE_DISABLED; case 2: case "TEST_CACHE_CONNECTION_ERROR": return TestCacheConnectionStatus.TEST_CACHE_CONNECTION_ERROR; case -1: case "UNRECOGNIZED": default: return TestCacheConnectionStatus.UNRECOGNIZED; } } export function testCacheConnectionStatusToJSON(object) { switch (object) { case TestCacheConnectionStatus.TEST_CACHE_CONNECTION_OK: return "TEST_CACHE_CONNECTION_OK"; case TestCacheConnectionStatus.TEST_CACHE_CONNECTION_CACHE_DISABLED: return "TEST_CACHE_CONNECTION_CACHE_DISABLED"; case TestCacheConnectionStatus.TEST_CACHE_CONNECTION_ERROR: return "TEST_CACHE_CONNECTION_ERROR"; case TestCacheConnectionStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBaseSpeechRequest() { return { text: "", options: undefined, parameters: "", inputType: "", outputType: "" }; } export const SpeechRequest = { encode(message, writer = new BinaryWriter()) { if (message.text !== "") { writer.uint32(10).string(message.text); } if (message.options !== undefined) { SpeechRequestOption.encode(message.options, writer.uint32(18).fork()).join(); } if (message.parameters !== "") { writer.uint32(26).string(message.parameters); } if (message.inputType !== "") { writer.uint32(34).string(message.inputType); } if (message.outputType !== "") { writer.uint32(42).string(message.outputType); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSpeechRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.text = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.options = SpeechRequestOption.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.parameters = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.inputType = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.outputType = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { text: isSet(object.text) ? globalThis.String(object.text) : "", options: isSet(object.options) ? SpeechRequestOption.fromJSON(object.options) : undefined, parameters: isSet(object.parameters) ? globalThis.String(object.parameters) : "", inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", }; }, toJSON(message) { const obj = {}; if (message.text !== "") { obj.text = message.text; } if (message.options !== undefined) { obj.options = SpeechRequestOption.toJSON(message.options); } if (message.parameters !== "") { obj.parameters = message.parameters; } if (message.inputType !== "") { obj.inputType = message.inputType; } if (message.outputType !== "") { obj.outputType = message.outputType; } return obj; }, create(base) { return SpeechRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSpeechRequest(); message.text = object.text ?? ""; message.options = (object.options !== undefined && object.options !== null) ? SpeechRequestOption.fromPartial(object.options) : undefined; message.parameters = object.parameters ?? ""; message.inputType = object.inputType ?? ""; message.outputType = object.outputType ?? ""; return message; }, }; function createBasePhonesetRequest() { return { voice: undefined }; } export const PhonesetRequest = { encode(message, writer = new BinaryWriter()) { if (message.voice !== undefined) { Voice.encode(message.voice, writer.uint32(10).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBasePhonesetRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.voice = Voice.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { voice: isSet(object.voice) ? Voice.fromJSON(object.voice) : undefined }; }, toJSON(message) { const obj = {}; if (message.voice !== undefined) { obj.voice = Voice.toJSON(message.voice); } return obj; }, create(base) { return PhonesetRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBasePhonesetRequest(); message.voice = (object.voice !== undefined && object.voice !== null) ? Voice.fromPartial(object.voice) : undefined; return message; }, }; function createBasePhonesetResponse() { return { status: 0, message: "", phoneset: "" }; } export const PhonesetResponse = { encode(message, writer = new BinaryWriter()) { if (message.status !== 0) { writer.uint32(8).int64(message.status); } if (message.message !== "") { writer.uint32(18).string(message.message); } if (message.phoneset !== "") { writer.uint32(26).string(message.phoneset); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBasePhonesetResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.status = longToNumber(reader.int64()); continue; } case 2: { if (tag !== 18) { break; } message.message = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.phoneset = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { status: isSet(object.status) ? globalThis.Number(object.status) : 0, message: isSet(object.message) ? globalThis.String(object.message) : "", phoneset: isSet(object.phoneset) ? globalThis.String(object.phoneset) : "", }; }, toJSON(message) { const obj = {}; if (message.status !== 0) { obj.status = Math.round(message.status); } if (message.message !== "") { obj.message = message.message; } if (message.phoneset !== "") { obj.phoneset = message.phoneset; } return obj; }, create(base) { return PhonesetResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBasePhonesetResponse(); message.status = object.status ?? 0; message.message = object.message ?? ""; message.phoneset = object.phoneset ?? ""; return message; }, }; function createBaseTranscriptionRequest() { return { voice: undefined, word: "" }; } export const TranscriptionRequest = { encode(message, writer = new BinaryWriter()) { if (message.voice !== undefined) { Voice.encode(message.voice, writer.uint32(10).fork()).join(); } if (message.word !== "") { writer.uint32(18).string(message.word); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTranscriptionRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.voice = Voice.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.word = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { voice: isSet(object.voice) ? Voice.fromJSON(object.voice) : undefined, word: isSet(object.word) ? globalThis.String(object.word) : "", }; }, toJSON(message) { const obj = {}; if (message.voice !== undefined) { obj.voice = Voice.toJSON(message.voice); } if (message.word !== "") { obj.word = message.word; } return obj; }, create(base) { return TranscriptionRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseTranscriptionRequest(); message.voice = (object.voice !== undefined && object.voice !== null) ? Voice.fromPartial(object.voice) : undefined; message.word = object.word ?? ""; return message; }, }; function createBaseTranscriptionResponse() { return { status: 0, message: "", transcription: "" }; } export const TranscriptionResponse = { encode(message, writer = new BinaryWriter()) { if (message.status !== 0) { writer.uint32(8).int64(message.status); } if (message.message !== "") { writer.uint32(18).string(message.message); } if (message.transcription !== "") { writer.uint32(26).string(message.transcription); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTranscriptionResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.status = longToNumber(reader.int64()); continue; } case 2: { if (tag !== 18) { break; } message.message = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.transcription = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { status: isSet(object.status) ? globalThis.Number(object.status) : 0, message: isSet(object.message) ? globalThis.String(object.message) : "", transcription: isSet(object.transcription) ? globalThis.String(object.transcription) : "", }; }, toJSON(message) { const obj = {}; if (message.status !== 0) { obj.status = Math.round(message.status); } if (message.message !== "") { obj.message = message.message; } if (message.transcription !== "") { obj.transcription = message.transcription; } return obj; }, create(base) { return TranscriptionResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseTranscriptionResponse(); message.status = object.status ?? 0; message.message = object.message ?? ""; message.transcription = object.transcription ?? ""; return message; }, }; function createBaseServerCommand() { return { commandType: 0, commandData: new Uint8Array(0), speechRequest: undefined }; } export const ServerCommand = { encode(message, writer = new BinaryWriter()) { if (message.commandType !== 0) { writer.uint32(8).int32(message.commandType); } if (message.commandData.length !== 0) { writer.uint32(18).bytes(message.commandData); } if (message.speechRequest !== undefined) { SpeechRequest.encode(message.speechRequest, writer.uint32(26).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServerCommand(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.commandType = reader.int32(); continue; } case 2: { if (tag !== 18) { break; } message.commandData = reader.bytes(); continue; } case 3: { if (tag !== 26) { break; } message.speechRequest = SpeechRequest.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { commandType: isSet(object.commandType) ? commandTypeFromJSON(object.commandType) : 0, commandData: isSet(object.commandData) ? bytesFromBase64(object.commandData) : new Uint8Array(0), speechRequest: isSet(object.speechRequest) ? SpeechRequest.fromJSON(object.speechRequest) : undefined, }; }, toJSON(message) { const obj = {}; if (message.commandType !== 0) { obj.commandType = commandTypeToJSON(message.commandType); } if (message.commandData.length !== 0) { obj.commandData = base64FromBytes(message.commandData); } if (message.speechRequest !== undefined) { obj.speechRequest = SpeechRequest.toJSON(message.speechRequest); } return obj; }, create(base) { return ServerCommand.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseServerCommand(); message.commandType = object.commandType ?? 0; message.commandData = object.commandData ?? new Uint8Array(0); message.speechRequest = (object.speechRequest !== undefined && object.speechRequest !== null) ? SpeechRequest.fromPartial(object.speechRequest) : undefined; return message; }, }; function createBaseServerCommandResponse() { return { responseType: 0, status: 0, message: "", responseData: new Uint8Array(0), speechResponse: [] }; } export const ServerCommandResponse = { encode(message, writer = new BinaryWriter()) { if (message.responseType !== 0) { writer.uint32(8).int32(message.responseType); } if (message.status !== 0) { writer.uint32(16).int64(message.status); } if (message.message !== "") { writer.uint32(26).string(message.message); } if (message.responseData.length !== 0) { writer.uint32(34).bytes(message.responseData); } for (const v of message.speechResponse) { SpeechResponse.encode(v, writer.uint32(42).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseServerCommandResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.responseType = reader.int32(); continue; } case 2: { if (tag !== 16) { break; } message.status = longToNumber(reader.int64()); continue; } case 3: { if (tag !== 26) { break; } message.message = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.responseData = reader.bytes(); continue; } case 5: { if (tag !== 42) { break; } message.speechResponse.push(SpeechResponse.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { responseType: isSet(object.responseType) ? commandResponseTypeFromJSON(object.responseType) : 0, status: isSet(object.status) ? globalThis.Number(object.status) : 0, message: isSet(object.message) ? globalThis.String(object.message) : "", responseData: isSet(object.responseData) ? bytesFromBase64(object.responseData) : new Uint8Array(0), speechResponse: globalThis.Array.isArray(object?.speechResponse) ? object.speechResponse.map((e) => SpeechResponse.fromJSON(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.responseType !== 0) { obj.responseType = commandResponseTypeToJSON(message.responseType); } if (message.status !== 0) { obj.status = Math.round(message.status); } if (message.message !== "") { obj.message = message.message; } if (message.responseData.length !== 0) { obj.responseData = base64FromBytes(message.responseData); } if (message.speechResponse?.length) { obj.speechResponse = message.speechResponse.map((e) => SpeechResponse.toJSON(e)); } return obj; }, create(base) { return ServerCommandResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseServerCommandResponse(); message.responseType = object.responseType ?? 0; message.status = object.status ?? 0; message.message = object.message ?? ""; message.responseData = object.responseData ?? new Uint8Array(0); message.speechResponse = object.speechResponse?.map((e) => SpeechResponse.fromPartial(e)) || []; return message; }, }; function createBaseSpeechResponse() { return { status: 0, data: new Uint8Array(0), inputType: "", outputType: "" }; } export const SpeechResponse = { encode(message, writer = new BinaryWriter()) { if (message.status !== 0) { writer.uint32(8).int64(message.status); } if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } if (message.inputType !== "") { writer.uint32(26).string(message.inputType); } if (message.outputType !== "") { writer.uint32(34).string(message.outputType); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSpeechResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.status = longToNumber(reader.int64()); continue; } case 2: { if (tag !== 18) { break; } message.data = reader.bytes(); continue; } case 3: { if (tag !== 26) { break; } message.inputType = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.outputType = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { status: isSet(object.status) ? globalThis.Number(object.status) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", }; }, toJSON(message) { const obj = {}; if (message.status !== 0) { obj.status = Math.round(message.status); } if (message.data.length !== 0) { obj.data = base64FromBytes(message.data); } if (message.inputType !== "") { obj.inputType = message.inputType; } if (message.outputType !== "") { obj.outputType = message.outputType; } return obj; }, create(base) { return SpeechResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseSpeechResponse(); message.status = object.status ?? 0; message.data = object.data ?? new Uint8Array(0); message.inputType = object.inputType ?? ""; message.outputType = object.outputType ?? ""; return message; }, }; function createBaseVoiceListRequest() { return { locale: undefined }; } export const VoiceListRequest = { encode(message, writer = new BinaryWriter()) { if (message.locale !== undefined) { SpeechLocale.encode(message.locale, writer.uint32(10).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVoiceListRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.locale = SpeechLocale.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { locale: isSet(object.locale) ? SpeechLocale.fromJSON(object.locale) : undefined }; }, toJSON(message) { const obj = {}; if (message.locale !== undefined) { obj.locale = SpeechLocale.toJSON(message.locale); } return obj; }, create(base) { return VoiceListRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseVoiceListRequest(); message.locale = (object.locale !== undefined && object.locale !== null) ? SpeechLocale.fromPartial(object.locale) : undefined; return message; }, }; function createBaseAddVoiceRequest() { return { locale: undefined, data: new Uint8Array(0), voiceName: "", baseVoiceName: "", temporaryVoice: false }; } export const AddVoiceRequest = { encode(message, writer = new BinaryWriter()) { if (message.locale !== undefined) { SpeechLocale.encode(message.locale, writer.uint32(10).fork()).join(); } if (message.data.length !== 0) { writer.uint32(18).bytes(message.data); } if (message.voiceName !== "") { writer.uint32(26).string(message.voiceName); } if (message.baseVoiceName !== "") { writer.uint32(34).string(message.baseVoiceName); } if (message.temporaryVoice !== false) { writer.uint32(40).bool(message.temporaryVoice); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddVoiceRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.locale = SpeechLocale.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.data = reader.bytes(); continue; } case 3: { if (tag !== 26) { break; } message.voiceName = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.baseVoiceName = reader.string(); continue; } case 5: { if (tag !== 40) { break; } message.temporaryVoice = reader.bool(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { locale: isSet(object.locale) ? SpeechLocale.fromJSON(object.locale) : undefined, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), voiceName: isSet(object.voiceName) ? globalThis.String(object.voiceName) : "", baseVoiceName: isSet(object.baseVoiceName) ? globalThis.String(object.baseVoiceName) : "", temporaryVoice: isSet(object.temporaryVoice) ? globalThis.Boolean(object.temporaryVoice) : false, }; }, toJSON(message) { const obj = {}; if (message.locale !== undefined) { obj.locale = SpeechLocale.toJSON(message.locale); } if (message.data.length !== 0) { obj.data = base64FromBytes(message.data); } if (message.voiceName !== "") { obj.voiceName = message.voiceName; } if (message.baseVoiceName !== "") { obj.baseVoiceName = message.baseVoiceName; } if (message.temporaryVoice !== false) { obj.temporaryVoice = message.temporaryVoice; } return obj; }, create(base) { return AddVoiceRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAddVoiceRequest(); message.locale = (object.locale !== undefined && object.locale !== null) ? SpeechLocale.fromPartial(object.locale) : undefined; message.data = object.data ?? new Uint8Array(0); message.voiceName = object.voiceName ?? ""; message.baseVoiceName = object.baseVoiceName ?? ""; message.temporaryVoice = object.temporaryVoice ?? false; return message; }, }; function createBaseAddVoiceResponse() { return { status: 0 }; } export const AddVoiceResponse = { encode(message, writer = new BinaryWriter()) { if (message.status !== 0) { writer.uint32(8).int32(message.status); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAddVoiceResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.status = reader.int32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { status: isSet(object.status) ? voiceAdditionStatusFromJSON(object.status) : 0 }; }, toJSON(message) { const obj = {}; if (message.status !== 0) { obj.status = voiceAdditionStatusToJSON(message.status); } return obj; }, create(base) { return AddVoiceResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseAddVoiceResponse(); message.status = object.status ?? 0; return message; }, }; function createBaseClearCacheRequest() { return { voiceId: "" }; } export const ClearCacheRequest = { encode(message, writer = new BinaryWriter()) { if (message.voiceId !== "") { writer.uint32(10).string(message.voiceId); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClearCacheRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.voiceId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { voiceId: isSet(object.voiceId) ? globalThis.String(object.voiceId) : "" }; }, toJSON(message) { const obj = {}; if (message.voiceId !== "") { obj.voiceId = message.voiceId; } return obj; }, create(base) { return ClearCacheRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseClearCacheRequest(); message.voiceId = object.voiceId ?? ""; return message; }, }; function createBaseClearCacheResponse() { return { status: 0, deletedCount: 0 }; } export const ClearCacheResponse = { encode(message, writer = new BinaryWriter()) { if (message.status !== 0) { writer.uint32(8).int32(message.status); } if (message.deletedCount !== 0) { writer.uint32(24).int32(message.deletedCount); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseClearCacheResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.status = reader.int32(); continue; } case 3: { if (tag !== 24) { break; } message.deletedCount = reader.int32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { status: isSet(object.status) ? clearCacheStatusFromJSON(object.status) : 0, deletedCount: isSet(object.deletedCount) ? globalThis.Number(object.deletedCount) : 0, }; }, toJSON(message) { const obj = {}; if (message.status !== 0) { obj.status = clearCacheStatusToJSON(message.status); } if (message.deletedCount !== 0) { obj.deletedCount = Math.round(message.deletedCount); } return obj; }, create(base) { return ClearCacheResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseClearCacheResponse(); message.status = object.status ?? 0; message.deletedCount = object.deletedCount ?? 0; return message; }, }; function createBaseTestCacheConnectionRequest() { return {}; } export const TestCacheConnectionRequest = { encode(_, writer = new BinaryWriter()) { return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTestCacheConnectionRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_) { return {}; }, toJSON(_) { const obj = {}; return obj; }, create(base) { return TestCacheConnectionRequest.fromPartial(base ?? {}); }, fromPartial(_) { const message = createBaseTestCacheConnectionRequest(); return message; }, }; function createBaseTestCacheConnectionResponse() { return { status: 0, backend: "", message: "" }; } export const TestCacheConnectionResponse = { encode(message, writer = new BinaryWriter()) { if (message.status !== 0) { writer.uint32(8).int32(message.status); } if (message.backend !== "") { writer.uint32(18).string(message.backend); } if (message.message !== "") { writer.uint32(26).string(message.message); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseTestCacheConnectionResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.status = reader.int32(); continue; } case 2: { if (tag !== 18) { break; } message.backend = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.message = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { status: isSet(object.status) ? testCacheConnectionStatusFromJSON(object.status) : 0, backend: isSet(object.backend) ? globalThis.String(object.backend) : "", message: isSet(object.message) ? globalThis.String(object.message) : "", }; }, toJSON(message) { const obj = {}; if (message.status !== 0) { obj.status = testCacheConnectionStatusToJSON(message.status); } if (message.backend !== "") { obj.backend = message.backend; } if (message.message !== "") { obj.message = message.message; } return obj; }, create(base) { return TestCacheConnectionResponse.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseTestCacheConnectionResponse(); message.status = object.status ?? 0; message.backend = object.backend ?? ""; message.message = object.message ?? ""; return message; }, }; function createBaseSsmlDocumentationRequest() { return { voiceId: "", locale: "" }; } export const SsmlDocumentationRequest = { encode(message, writer = new BinaryWriter()) { if (message.voiceId !== "") { writer.uint32(10).string(message.voiceId); } if (message.locale !== "")