mirror of
https://github.com/mii443/rust.git
synced 2025-08-22 16:25:37 +00:00
add speakers list
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use crate::types::audio_query::AudioQueryType;
|
||||
use crate::types::{audio_query::AudioQueryType, speaker::Speaker};
|
||||
use bytes::Bytes;
|
||||
use reqwest::{header::HeaderMap, Client, RequestBuilder, Result};
|
||||
|
||||
@ -62,4 +62,14 @@ impl RestAPI {
|
||||
.await?;
|
||||
Ok(data)
|
||||
}
|
||||
|
||||
pub async fn speakers(&self) -> Result<Vec<Speaker>> {
|
||||
let speakers = self
|
||||
.request("GET", "/speakers")
|
||||
.send()
|
||||
.await?
|
||||
.json()
|
||||
.await?;
|
||||
Ok(speakers)
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
pub mod audio_query;
|
||||
pub mod speaker;
|
||||
|
21
src/types/speaker.rs
Normal file
21
src/types/speaker.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct Speaker {
|
||||
pub supported_features: SupportedFeatures,
|
||||
pub name: String,
|
||||
pub speaker_uuid: String,
|
||||
pub styles: Vec<Style>,
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct SupportedFeatures {
|
||||
pub permitted_synthesis_morphing: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct Style {
|
||||
pub name: String,
|
||||
pub id: i64,
|
||||
}
|
Reference in New Issue
Block a user