feat: add chain method to create Request instance

This commit is contained in:
Night Cruising
2023-10-17 15:14:31 +08:00
parent f1f1fa7e86
commit a9be9efdfe
16 changed files with 402 additions and 135 deletions

View File

@ -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,