refactor: rename ListModels* to ModelList*
This commit is contained in:
@@ -6,7 +6,7 @@ use crate::v1::{
|
|||||||
ChatCompletionMessage, ChatCompletionParams, ChatCompletionRequest, ChatCompletionResponse,
|
ChatCompletionMessage, ChatCompletionParams, ChatCompletionRequest, ChatCompletionResponse,
|
||||||
},
|
},
|
||||||
constants::API_URL_BASE,
|
constants::API_URL_BASE,
|
||||||
list_models::ListModelsResponse,
|
model_list::ModelListResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
@@ -145,9 +145,9 @@ impl Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn list_models(&self) -> Result<ListModelsResponse, APIError> {
|
pub fn list_models(&self) -> Result<ModelListResponse, APIError> {
|
||||||
let response = self.get("/models")?;
|
let response = self.get("/models")?;
|
||||||
let result = response.json::<ListModelsResponse>();
|
let result = response.json::<ModelListResponse>();
|
||||||
match result {
|
match result {
|
||||||
Ok(response) => Ok(response),
|
Ok(response) => Ok(response),
|
||||||
Err(error) => Err(self.new_error(error)),
|
Err(error) => Err(self.new_error(error)),
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ pub mod client;
|
|||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod constants;
|
pub mod constants;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod list_models;
|
pub mod model_list;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct ListModelsResponse {
|
pub struct ModelListResponse {
|
||||||
pub object: String,
|
pub object: String,
|
||||||
pub data: Vec<ListModelsModel>,
|
pub data: Vec<ModelListData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct ListModelsModel {
|
pub struct ModelListData {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub object: String,
|
pub object: String,
|
||||||
/// Unix timestamp (in seconds).
|
/// Unix timestamp (in seconds).
|
||||||
pub created: u32,
|
pub created: u32,
|
||||||
pub owned_by: String,
|
pub owned_by: String,
|
||||||
pub permission: Vec<ListModelsModelPermission>,
|
pub permission: Vec<ModelListDataPermission>,
|
||||||
// TODO Check this prop (seen in API responses but undocumented).
|
// TODO Check this prop (seen in API responses but undocumented).
|
||||||
// pub root: ???,
|
// pub root: ???,
|
||||||
// TODO Check this prop (seen in API responses but undocumented).
|
// TODO Check this prop (seen in API responses but undocumented).
|
||||||
@@ -21,7 +21,7 @@ pub struct ListModelsModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct ListModelsModelPermission {
|
pub struct ModelListDataPermission {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub object: String,
|
pub object: String,
|
||||||
/// Unix timestamp (in seconds).
|
/// Unix timestamp (in seconds).
|
||||||
Reference in New Issue
Block a user