async_openai/types/containers/
container.rs1use derive_builder::Builder;
2use serde::{Deserialize, Serialize};
3
4use crate::error::OpenAIError;
5
6use crate::types::InputSource;
7
8#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
9pub struct ContainerResource {
10 pub id: String,
12 pub object: String,
14 pub name: String,
16 pub created_at: u64,
18 pub status: String,
20 #[serde(skip_serializing_if = "Option::is_none")]
23 pub expires_after: Option<ContainerExpiresAfter>,
24 #[serde(skip_serializing_if = "Option::is_none")]
26 pub last_active_at: Option<u64>,
27}
28
29#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
31pub struct ContainerExpiresAfter {
32 pub anchor: ContainerExpiresAfterAnchor,
34 pub minutes: u32,
35}
36
37#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
39#[serde(rename_all = "snake_case")]
40pub enum ContainerExpiresAfterAnchor {
41 LastActiveAt,
42}
43
44#[derive(Debug, Default, Clone, Builder, PartialEq, Serialize)]
47#[builder(name = "CreateContainerRequestArgs")]
48#[builder(pattern = "mutable")]
49#[builder(setter(into, strip_option), default)]
50#[builder(derive(Debug))]
51#[builder(build_fn(error = "OpenAIError"))]
52pub struct CreateContainerRequest {
53 pub name: String,
55 #[serde(skip_serializing_if = "Option::is_none")]
57 pub file_ids: Option<Vec<String>>,
58 #[serde(skip_serializing_if = "Option::is_none")]
60 pub expires_after: Option<ContainerExpiresAfter>,
61}
62
63#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
65pub struct ContainerListResource {
66 pub object: String,
68 pub data: Vec<ContainerResource>,
70 pub first_id: Option<String>,
72 pub last_id: Option<String>,
74 pub has_more: bool,
76}
77
78#[derive(Debug, Deserialize, Clone, PartialEq, Serialize)]
80pub struct DeleteContainerResponse {
81 pub id: String,
82 pub object: String,
83 pub deleted: bool,
84}
85
86#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
90pub struct ContainerFileResource {
91 pub id: String,
93 pub object: String,
95 pub container_id: String,
97 pub created_at: u64,
99 pub bytes: u32,
101 pub path: String,
103 pub source: String,
105}
106
107#[derive(Debug, Default, Clone, PartialEq)]
110pub struct CreateContainerFileRequest {
111 pub file: Option<InputSource>,
113 pub file_id: Option<String>,
115}
116
117#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
119pub struct ContainerFileListResource {
120 pub object: String,
122 pub data: Vec<ContainerFileResource>,
124 pub first_id: Option<String>,
126 pub last_id: Option<String>,
128 pub has_more: bool,
130}
131
132#[derive(Debug, Deserialize, Clone, PartialEq, Serialize)]
134pub struct DeleteContainerFileResponse {
135 pub id: String,
136 pub object: String,
137 pub deleted: bool,
138}