Skip to content

Commit 65c49a6

Browse files
committed
Fix batch object
1 parent 27eba21 commit 65c49a6

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

src/v1/batch.rs

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,41 @@ pub struct RequestCounts {
2323
}
2424

2525
#[derive(Debug, Serialize, Deserialize)]
26-
pub struct BatchResponse {
27-
pub id: String,
26+
pub struct BatchError {
27+
pub code: String,
28+
pub line: Option<u32>,
29+
pub message: String,
30+
pub param: Option<String>,
31+
}
32+
33+
#[derive(Debug, Serialize, Deserialize)]
34+
pub struct BatchErrors {
2835
pub object: String,
29-
pub endpoint: String,
30-
pub errors: Option<Vec<String>>,
31-
pub input_file_id: String,
36+
pub data: Vec<BatchError>,
37+
}
38+
39+
#[derive(Debug, Serialize, Deserialize)]
40+
pub struct BatchResponse {
41+
pub cancelled_at: Option<u64>,
42+
pub cancelling_at: Option<u64>,
43+
pub completed_at: Option<u64>,
3244
pub completion_window: String,
33-
pub status: String,
34-
pub output_file_id: Option<String>,
35-
pub error_file_id: Option<String>,
3645
pub created_at: u64,
37-
pub in_progress_at: Option<u64>,
46+
pub endpoint: String,
47+
pub error_file_id: Option<String>,
48+
pub errors: Option<BatchErrors>,
49+
pub expired_at: Option<u64>,
3850
pub expires_at: Option<u64>,
39-
pub finalizing_at: Option<u64>,
40-
pub completed_at: Option<u64>,
4151
pub failed_at: Option<u64>,
42-
pub expired_at: Option<u64>,
43-
pub cancelling_at: Option<u64>,
44-
pub cancelled_at: Option<u64>,
45-
pub request_counts: RequestCounts,
52+
pub finalizing_at: Option<u64>,
53+
pub id: String,
54+
pub in_progress_at: Option<u64>,
55+
pub input_file_id: String,
4656
pub metadata: Option<Metadata>,
57+
pub object: String,
58+
pub output_file_id: Option<String>,
59+
pub request_counts: RequestCounts,
60+
pub status: String,
4761
}
4862

4963
#[derive(Debug, Serialize, Deserialize)]

0 commit comments

Comments
 (0)