mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-23 15:48:07 +00:00
feat: add chain method to create Request instance
This commit is contained in:
@ -22,6 +22,12 @@ pub struct FileUploadRequest {
|
||||
pub purpose: String,
|
||||
}
|
||||
|
||||
impl FileUploadRequest {
|
||||
pub fn new(file: String, purpose: String) -> Self {
|
||||
Self { file, purpose }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct FileUploadResponse {
|
||||
pub id: String,
|
||||
@ -37,6 +43,12 @@ pub struct FileDeleteRequest {
|
||||
pub file_id: String,
|
||||
}
|
||||
|
||||
impl FileDeleteRequest {
|
||||
pub fn new(file_id: String) -> Self {
|
||||
Self { file_id }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct FileDeleteResponse {
|
||||
pub id: String,
|
||||
@ -49,6 +61,12 @@ pub struct FileRetrieveRequest {
|
||||
pub file_id: String,
|
||||
}
|
||||
|
||||
impl FileRetrieveRequest {
|
||||
pub fn new(file_id: String) -> Self {
|
||||
Self { file_id }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct FileRetrieveResponse {
|
||||
pub id: String,
|
||||
@ -64,6 +82,12 @@ pub struct FileRetrieveContentRequest {
|
||||
pub file_id: String,
|
||||
}
|
||||
|
||||
impl FileRetrieveContentRequest {
|
||||
pub fn new(file_id: String) -> Self {
|
||||
Self { file_id }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct FileRetrieveContentResponse {
|
||||
pub id: String,
|
||||
|
Reference in New Issue
Block a user