/*
* VOICEVOX Engine
*
* VOICEVOXの音声合成エンジンです。
*
* The version of the OpenAPI document: 0.14.4
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use super::{configuration, Error};
use crate::apis::ResponseContent;
/// struct for typed errors of method [`accent_phrases_accent_phrases_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AccentPhrasesAccentPhrasesPostError {
Status400(crate::models::ParseKanaBadRequest),
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`add_preset_add_preset_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddPresetAddPresetPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`add_user_dict_word_user_dict_word_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddUserDictWordUserDictWordPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`audio_query_audio_query_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AudioQueryAudioQueryPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`audio_query_from_preset_audio_query_from_preset_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AudioQueryFromPresetAudioQueryFromPresetPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`cancellable_synthesis_cancellable_synthesis_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CancellableSynthesisCancellableSynthesisPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`connect_waves_connect_waves_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ConnectWavesConnectWavesPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`core_versions_core_versions_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CoreVersionsCoreVersionsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_preset_delete_preset_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeletePresetDeletePresetPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_user_dict_word_user_dict_word_word_uuid_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteUserDictWordUserDictWordWordUuidDeleteError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`downloadable_libraries_downloadable_libraries_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DownloadableLibrariesDownloadableLibrariesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`engine_manifest_engine_manifest_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum EngineManifestEngineManifestGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_presets_presets_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetPresetsPresetsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_user_dict_words_user_dict_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserDictWordsUserDictGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`import_user_dict_words_import_user_dict_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ImportUserDictWordsImportUserDictPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`initialize_speaker_initialize_speaker_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSpeakerInitializeSpeakerPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`is_initialized_speaker_is_initialized_speaker_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IsInitializedSpeakerIsInitializedSpeakerGetError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`mora_data_mora_data_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MoraDataMoraDataPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`mora_length_mora_length_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MoraLengthMoraLengthPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`mora_pitch_mora_pitch_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MoraPitchMoraPitchPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`morphable_targets_morphable_targets_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MorphableTargetsMorphableTargetsPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`multi_synthesis_multi_synthesis_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MultiSynthesisMultiSynthesisPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`rewrite_user_dict_word_user_dict_word_word_uuid_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RewriteUserDictWordUserDictWordWordUuidPutError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`setting_get_setting_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SettingGetSettingGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`setting_post_setting_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SettingPostSettingPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`speaker_info_speaker_info_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SpeakerInfoSpeakerInfoGetError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`speakers_speakers_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SpeakersSpeakersGetError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`supported_devices_supported_devices_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SupportedDevicesSupportedDevicesGetError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`synthesis_morphing_synthesis_morphing_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SynthesisMorphingSynthesisMorphingPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`synthesis_synthesis_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SynthesisSynthesisPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_preset_update_preset_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdatePresetUpdatePresetPostError {
Status422(crate::models::HttpValidationError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`version_version_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum VersionVersionGetError {
UnknownValue(serde_json::Value),
}
/// テキストからアクセント句を得ます。 is_kanaが`true`のとき、テキストは次のようなAquesTalkライクな記法に従う読み仮名として処理されます。デフォルトは`false`です。 * 全てのカナはカタカナで記述される * アクセント句は`/`または`、`で区切る。`、`で区切った場合に限り無音区間が挿入される。 * カナの手前に`_`を入れるとそのカナは無声化される * アクセント位置を`'`で指定する。全てのアクセント句にはアクセント位置を1つ指定する必要がある。 * アクセント句末に`?`(全角)を入れることにより疑問文の発音ができる。
pub async fn accent_phrases_accent_phrases_post(
configuration: &configuration::Configuration,
text: &str,
speaker: i32,
is_kana: Option<bool>,
core_version: Option<&str>,
) -> Result<Vec<crate::models::AccentPhrase>, Error<AccentPhrasesAccentPhrasesPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/accent_phrases", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = is_kana {
local_var_req_builder =
local_var_req_builder.query(&[("is_kana", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AccentPhrasesAccentPhrasesPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 新しいプリセットを追加します Parameters ------- preset: Preset 新しいプリセット。 プリセットIDが既存のものと重複している場合は、新規のプリセットIDが採番されます。 Returns ------- id: int 追加したプリセットのプリセットID
pub async fn add_preset_add_preset_post(
configuration: &configuration::Configuration,
preset: crate::models::Preset,
) -> Result<i32, Error<AddPresetAddPresetPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/add_preset", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&preset);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddPresetAddPresetPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// ユーザー辞書に言葉を追加します。 Parameters ---------- surface : str 言葉の表層形 pronunciation: str 言葉の発音(カタカナ) accent_type: int アクセント型(音が下がる場所を指す) word_type: WordTypes, optional PROPER_NOUN(固有名詞)、COMMON_NOUN(普通名詞)、VERB(動詞)、ADJECTIVE(形容詞)、SUFFIX(語尾)のいずれか priority: int, optional 単語の優先度(0から10までの整数) 数字が大きいほど優先度が高くなる 1から9までの値を指定することを推奨
pub async fn add_user_dict_word_user_dict_word_post(
configuration: &configuration::Configuration,
surface: &str,
pronunciation: &str,
accent_type: i32,
word_type: Option<crate::models::WordTypes>,
priority: Option<i32>,
) -> Result<String, Error<AddUserDictWordUserDictWordPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/user_dict_word", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("surface", &surface.to_string())]);
local_var_req_builder =
local_var_req_builder.query(&[("pronunciation", &pronunciation.to_string())]);
local_var_req_builder =
local_var_req_builder.query(&[("accent_type", &accent_type.to_string())]);
if let Some(ref local_var_str) = word_type {
local_var_req_builder =
local_var_req_builder.query(&[("word_type", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = priority {
local_var_req_builder =
local_var_req_builder.query(&[("priority", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AddUserDictWordUserDictWordPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// クエリの初期値を得ます。ここで得られたクエリはそのまま音声合成に利用できます。各値の意味は`Schemas`を参照してください。
pub async fn audio_query_audio_query_post(
configuration: &configuration::Configuration,
text: &str,
speaker: i32,
core_version: Option<&str>,
) -> Result<crate::models::AudioQuery, Error<AudioQueryAudioQueryPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/audio_query", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AudioQueryAudioQueryPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// クエリの初期値を得ます。ここで得られたクエリはそのまま音声合成に利用できます。各値の意味は`Schemas`を参照してください。
pub async fn audio_query_from_preset_audio_query_from_preset_post(
configuration: &configuration::Configuration,
text: &str,
preset_id: i32,
core_version: Option<&str>,
) -> Result<crate::models::AudioQuery, Error<AudioQueryFromPresetAudioQueryFromPresetPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/audio_query_from_preset",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("text", &text.to_string())]);
local_var_req_builder = local_var_req_builder.query(&[("preset_id", &preset_id.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<AudioQueryFromPresetAudioQueryFromPresetPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn cancellable_synthesis_cancellable_synthesis_post(
configuration: &configuration::Configuration,
speaker: i32,
audio_query: crate::models::AudioQuery,
core_version: Option<&str>,
) -> Result<std::path::PathBuf, Error<CancellableSynthesisCancellableSynthesisPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/cancellable_synthesis",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&audio_query);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CancellableSynthesisCancellableSynthesisPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// base64エンコードされたwavデータを一纏めにし、wavファイルで返します。
pub async fn connect_waves_connect_waves_post(
configuration: &configuration::Configuration,
request_body: Vec<String>,
) -> Result<std::path::PathBuf, Error<ConnectWavesConnectWavesPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/connect_waves", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&request_body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ConnectWavesConnectWavesPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn core_versions_core_versions_get(
configuration: &configuration::Configuration,
) -> Result<Vec<String>, Error<CoreVersionsCoreVersionsGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/core_versions", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CoreVersionsCoreVersionsGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 既存のプリセットを削除します Parameters ------- id: int 削除するプリセットのプリセットID
pub async fn delete_preset_delete_preset_post(
configuration: &configuration::Configuration,
id: i32,
) -> Result<(), Error<DeletePresetDeletePresetPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/delete_preset", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<DeletePresetDeletePresetPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// ユーザー辞書に登録されている言葉を削除します。 Parameters ---------- word_uuid: str 削除する言葉のUUID
pub async fn delete_user_dict_word_user_dict_word_word_uuid_delete(
configuration: &configuration::Configuration,
word_uuid: &str,
) -> Result<(), Error<DeleteUserDictWordUserDictWordWordUuidDeleteError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/user_dict_word/{word_uuid}",
local_var_configuration.base_path,
word_uuid = crate::apis::urlencode(word_uuid)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<DeleteUserDictWordUserDictWordWordUuidDeleteError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// ダウンロード可能なモデル情報を返します。 Returns ------- ret_data: List[DownloadableLibrary]
pub async fn downloadable_libraries_downloadable_libraries_get(
configuration: &configuration::Configuration,
) -> Result<
Vec<crate::models::DownloadableLibrary>,
Error<DownloadableLibrariesDownloadableLibrariesGetError>,
> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/downloadable_libraries",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DownloadableLibrariesDownloadableLibrariesGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn engine_manifest_engine_manifest_get(
configuration: &configuration::Configuration,
) -> Result<crate::models::EngineManifest, Error<EngineManifestEngineManifestGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/engine_manifest", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<EngineManifestEngineManifestGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// エンジンが保持しているプリセットの設定を返します Returns ------- presets: List[Preset] プリセットのリスト
pub async fn get_presets_presets_get(
configuration: &configuration::Configuration,
) -> Result<Vec<crate::models::Preset>, Error<GetPresetsPresetsGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/presets", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetPresetsPresetsGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// ユーザー辞書に登録されている単語の一覧を返します。 単語の表層形(surface)は正規化済みの物を返します。 Returns ------- Dict[str, UserDictWord] 単語のUUIDとその詳細
pub async fn get_user_dict_words_user_dict_get(
configuration: &configuration::Configuration,
) -> Result<
::std::collections::HashMap<String, crate::models::UserDictWord>,
Error<GetUserDictWordsUserDictGetError>,
> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/user_dict", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetUserDictWordsUserDictGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 他のユーザー辞書をインポートします。 Parameters ---------- import_dict_data: Dict[str, UserDictWord] インポートするユーザー辞書のデータ override: bool 重複したエントリがあった場合、上書きするかどうか
pub async fn import_user_dict_words_import_user_dict_post(
configuration: &configuration::Configuration,
r#override: bool,
request_body: ::std::collections::HashMap<String, crate::models::UserDictWord>,
) -> Result<(), Error<ImportUserDictWordsImportUserDictPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/import_user_dict", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("override", &r#override.to_string())]);
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&request_body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ImportUserDictWordsImportUserDictPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 指定されたspeaker_idの話者を初期化します。 実行しなくても他のAPIは使用できますが、初回実行時に時間がかかることがあります。
pub async fn initialize_speaker_initialize_speaker_post(
configuration: &configuration::Configuration,
speaker: i32,
skip_reinit: Option<bool>,
core_version: Option<&str>,
) -> Result<(), Error<InitializeSpeakerInitializeSpeakerPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/initialize_speaker", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = skip_reinit {
local_var_req_builder =
local_var_req_builder.query(&[("skip_reinit", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSpeakerInitializeSpeakerPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 指定されたspeaker_idの話者が初期化されているかどうかを返します。
pub async fn is_initialized_speaker_is_initialized_speaker_get(
configuration: &configuration::Configuration,
speaker: i32,
core_version: Option<&str>,
) -> Result<bool, Error<IsInitializedSpeakerIsInitializedSpeakerGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/is_initialized_speaker",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<IsInitializedSpeakerIsInitializedSpeakerGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn mora_data_mora_data_post(
configuration: &configuration::Configuration,
speaker: i32,
accent_phrase: Vec<crate::models::AccentPhrase>,
core_version: Option<&str>,
) -> Result<Vec<crate::models::AccentPhrase>, Error<MoraDataMoraDataPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/mora_data", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&accent_phrase);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MoraDataMoraDataPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn mora_length_mora_length_post(
configuration: &configuration::Configuration,
speaker: i32,
accent_phrase: Vec<crate::models::AccentPhrase>,
core_version: Option<&str>,
) -> Result<Vec<crate::models::AccentPhrase>, Error<MoraLengthMoraLengthPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/mora_length", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&accent_phrase);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MoraLengthMoraLengthPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn mora_pitch_mora_pitch_post(
configuration: &configuration::Configuration,
speaker: i32,
accent_phrase: Vec<crate::models::AccentPhrase>,
core_version: Option<&str>,
) -> Result<Vec<crate::models::AccentPhrase>, Error<MoraPitchMoraPitchPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/mora_pitch", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&accent_phrase);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MoraPitchMoraPitchPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 指定されたベース話者に対してエンジン内の各話者がモーフィング機能を利用可能か返します。 モーフィングの許可/禁止は`/speakers`の`speaker.supported_features.synthesis_morphing`に記載されています。 プロパティが存在しない場合は、モーフィングが許可されているとみなします。 返り値の話者はstring型なので注意。
pub async fn morphable_targets_morphable_targets_post(
configuration: &configuration::Configuration,
request_body: Vec<i32>,
core_version: Option<&str>,
) -> Result<
Vec<::std::collections::HashMap<String, crate::models::MorphableTargetInfo>>,
Error<MorphableTargetsMorphableTargetsPostError>,
> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/morphable_targets", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&request_body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MorphableTargetsMorphableTargetsPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn multi_synthesis_multi_synthesis_post(
configuration: &configuration::Configuration,
speaker: i32,
audio_query: Vec<crate::models::AudioQuery>,
core_version: Option<&str>,
) -> Result<std::path::PathBuf, Error<MultiSynthesisMultiSynthesisPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/multi_synthesis", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&audio_query);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<MultiSynthesisMultiSynthesisPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// ユーザー辞書に登録されている言葉を更新します。 Parameters ---------- surface : str 言葉の表層形 pronunciation: str 言葉の発音(カタカナ) accent_type: int アクセント型(音が下がる場所を指す) word_uuid: str 更新する言葉のUUID word_type: WordTypes, optional PROPER_NOUN(固有名詞)、COMMON_NOUN(普通名詞)、VERB(動詞)、ADJECTIVE(形容詞)、SUFFIX(語尾)のいずれか priority: int, optional 単語の優先度(0から10までの整数) 数字が大きいほど優先度が高くなる 1から9までの値を指定することを推奨
pub async fn rewrite_user_dict_word_user_dict_word_word_uuid_put(
configuration: &configuration::Configuration,
word_uuid: &str,
surface: &str,
pronunciation: &str,
accent_type: i32,
word_type: Option<crate::models::WordTypes>,
priority: Option<i32>,
) -> Result<(), Error<RewriteUserDictWordUserDictWordWordUuidPutError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/user_dict_word/{word_uuid}",
local_var_configuration.base_path,
word_uuid = crate::apis::urlencode(word_uuid)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("surface", &surface.to_string())]);
local_var_req_builder =
local_var_req_builder.query(&[("pronunciation", &pronunciation.to_string())]);
local_var_req_builder =
local_var_req_builder.query(&[("accent_type", &accent_type.to_string())]);
if let Some(ref local_var_str) = word_type {
local_var_req_builder =
local_var_req_builder.query(&[("word_type", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = priority {
local_var_req_builder =
local_var_req_builder.query(&[("priority", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<RewriteUserDictWordUserDictWordWordUuidPutError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn setting_get_setting_get(
configuration: &configuration::Configuration,
) -> Result<String, Error<SettingGetSettingGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/setting", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SettingGetSettingGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn setting_post_setting_post(
configuration: &configuration::Configuration,
cors_policy_mode: Option<&str>,
allow_origin: Option<&str>,
) -> Result<String, Error<SettingPostSettingPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/setting", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let mut local_var_form_params = std::collections::HashMap::new();
if let Some(local_var_param_value) = cors_policy_mode {
local_var_form_params.insert("cors_policy_mode", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = allow_origin {
local_var_form_params.insert("allow_origin", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SettingPostSettingPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 指定されたspeaker_uuidに関する情報をjson形式で返します。 画像や音声はbase64エンコードされたものが返されます。 Returns ------- ret_data: SpeakerInfo
pub async fn speaker_info_speaker_info_get(
configuration: &configuration::Configuration,
speaker_uuid: &str,
core_version: Option<&str>,
) -> Result<crate::models::SpeakerInfo, Error<SpeakerInfoSpeakerInfoGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/speaker_info", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder =
local_var_req_builder.query(&[("speaker_uuid", &speaker_uuid.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SpeakerInfoSpeakerInfoGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn speakers_speakers_get(
configuration: &configuration::Configuration,
core_version: Option<&str>,
) -> Result<Vec<crate::models::Speaker>, Error<SpeakersSpeakersGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/speakers", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SpeakersSpeakersGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn supported_devices_supported_devices_get(
configuration: &configuration::Configuration,
core_version: Option<&str>,
) -> Result<crate::models::SupportedDevicesInfo, Error<SupportedDevicesSupportedDevicesGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/supported_devices", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SupportedDevicesSupportedDevicesGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 指定された2人の話者で音声を合成、指定した割合でモーフィングした音声を得ます。 モーフィングの割合は`morph_rate`で指定でき、0.0でベースの話者、1.0でターゲットの話者に近づきます。
pub async fn synthesis_morphing_synthesis_morphing_post(
configuration: &configuration::Configuration,
base_speaker: i32,
target_speaker: i32,
morph_rate: f32,
audio_query: crate::models::AudioQuery,
core_version: Option<&str>,
) -> Result<std::path::PathBuf, Error<SynthesisMorphingSynthesisMorphingPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/synthesis_morphing", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder =
local_var_req_builder.query(&[("base_speaker", &base_speaker.to_string())]);
local_var_req_builder =
local_var_req_builder.query(&[("target_speaker", &target_speaker.to_string())]);
local_var_req_builder = local_var_req_builder.query(&[("morph_rate", &morph_rate.to_string())]);
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&audio_query);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SynthesisMorphingSynthesisMorphingPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn synthesis_synthesis_post(
configuration: &configuration::Configuration,
speaker: i32,
audio_query: crate::models::AudioQuery,
enable_interrogative_upspeak: Option<bool>,
core_version: Option<&str>,
) -> Result<std::path::PathBuf, Error<SynthesisSynthesisPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/synthesis", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("speaker", &speaker.to_string())]);
if let Some(ref local_var_str) = enable_interrogative_upspeak {
local_var_req_builder = local_var_req_builder
.query(&[("enable_interrogative_upspeak", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = core_version {
local_var_req_builder =
local_var_req_builder.query(&[("core_version", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&audio_query);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SynthesisSynthesisPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// 既存のプリセットを更新します Parameters ------- preset: Preset 更新するプリセット。 プリセットIDが更新対象と一致している必要があります。 Returns ------- id: int 更新したプリセットのプリセットID
pub async fn update_preset_update_preset_post(
configuration: &configuration::Configuration,
preset: crate::models::Preset,
) -> Result<i32, Error<UpdatePresetUpdatePresetPostError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/update_preset", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&preset);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdatePresetUpdatePresetPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn version_version_get(
configuration: &configuration::Configuration,
) -> Result<serde_json::Value, Error<VersionVersionGetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/version", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<VersionVersionGetError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}