glopenai/container
Types
Expiration policy for a container.
pub type ContainerExpiresAfter {
ContainerExpiresAfter(
anchor: ContainerExpiresAfterAnchor,
minutes: Int,
)
}
Constructors
-
ContainerExpiresAfter( anchor: ContainerExpiresAfterAnchor, minutes: Int, )
Anchor for container expiration. The API currently only defines
last_active_at; modelled as an enum so any future values slot in without
breaking callers.
pub type ContainerExpiresAfterAnchor {
LastActiveAt
}
Constructors
-
LastActiveAt
pub type ContainerFileListResource {
ContainerFileListResource(
object: String,
data: List(ContainerFileResource),
first_id: option.Option(String),
last_id: option.Option(String),
has_more: Bool,
)
}
Constructors
-
ContainerFileListResource( object: String, data: List(ContainerFileResource), first_id: option.Option(String), last_id: option.Option(String), has_more: Bool, )
pub type ContainerFileResource {
ContainerFileResource(
id: String,
object: String,
container_id: String,
created_at: Int,
bytes: Int,
path: String,
source: String,
)
}
Constructors
-
ContainerFileResource( id: String, object: String, container_id: String, created_at: Int, bytes: Int, path: String, source: String, )
Two mutually exclusive ways to add a file to a container:
UploadBytes— upload a new file inline. The caller provides the raw bytes, the filename that should appear in the container, and the content type for the multipart part.UploadByFileId— reference an already-uploaded file by id. No bytes are sent, only thefile_idform field.
Modelled as a sum type so the two shapes cannot collide.
pub type ContainerFileUpload {
UploadBytes(
filename: String,
content_type: String,
data: BitArray,
)
UploadByFileId(file_id: String)
}
Constructors
-
UploadBytes( filename: String, content_type: String, data: BitArray, ) -
UploadByFileId(file_id: String)
Paginated list of containers.
pub type ContainerListResource {
ContainerListResource(
object: String,
data: List(ContainerResource),
first_id: option.Option(String),
last_id: option.Option(String),
has_more: Bool,
)
}
Constructors
-
ContainerListResource( object: String, data: List(ContainerResource), first_id: option.Option(String), last_id: option.Option(String), has_more: Bool, )
A container. status is a free-form string today (e.g. "active",
"deleted"); leaving it as a string avoids breaking callers when OpenAI
adds new lifecycle states.
pub type ContainerResource {
ContainerResource(
id: String,
object: String,
name: String,
created_at: Int,
status: String,
expires_after: option.Option(ContainerExpiresAfter),
last_active_at: option.Option(Int),
memory_limit: MemoryLimit,
)
}
Constructors
-
ContainerResource( id: String, object: String, name: String, created_at: Int, status: String, expires_after: option.Option(ContainerExpiresAfter), last_active_at: option.Option(Int), memory_limit: MemoryLimit, )
pub type CreateContainerRequest {
CreateContainerRequest(
name: String,
file_ids: option.Option(List(String)),
expires_after: option.Option(ContainerExpiresAfter),
memory_limit: option.Option(MemoryLimit),
)
}
Constructors
-
CreateContainerRequest( name: String, file_ids: option.Option(List(String)), expires_after: option.Option(ContainerExpiresAfter), memory_limit: option.Option(MemoryLimit), )
pub type DeleteContainerFileResponse {
DeleteContainerFileResponse(
id: String,
object: String,
deleted: Bool,
)
}
Constructors
-
DeleteContainerFileResponse( id: String, object: String, deleted: Bool, )
pub type DeleteContainerResponse {
DeleteContainerResponse(
id: String,
object: String,
deleted: Bool,
)
}
Constructors
-
DeleteContainerResponse( id: String, object: String, deleted: Bool, )
pub type ListContainerFilesQuery {
ListContainerFilesQuery(
limit: option.Option(Int),
order: option.Option(ListOrder),
after: option.Option(String),
)
}
Constructors
-
ListContainerFilesQuery( limit: option.Option(Int), order: option.Option(ListOrder), after: option.Option(String), )
pub type ListContainersQuery {
ListContainersQuery(
limit: option.Option(Int),
order: option.Option(ListOrder),
after: option.Option(String),
)
}
Constructors
-
ListContainersQuery( limit: option.Option(Int), order: option.Option(ListOrder), after: option.Option(String), )
Memory limit for a container. The wire values are 1g, 4g, 16g, 64g
(the API’s own naming; they are not human-friendly Gleam identifiers, so
the variants carry the size as a word).
pub type MemoryLimit {
OneGigabyte
FourGigabytes
SixteenGigabytes
SixtyFourGigabytes
}
Constructors
-
OneGigabyte -
FourGigabytes -
SixteenGigabytes -
SixtyFourGigabytes
Values
pub fn container_expires_after_anchor_decoder() -> decode.Decoder(
ContainerExpiresAfterAnchor,
)
pub fn container_expires_after_anchor_to_json(
anchor: ContainerExpiresAfterAnchor,
) -> json.Json
pub fn container_expires_after_decoder() -> decode.Decoder(
ContainerExpiresAfter,
)
pub fn container_expires_after_to_json(
expires: ContainerExpiresAfter,
) -> json.Json
pub fn container_file_resource_decoder() -> decode.Decoder(
ContainerFileResource,
)
pub fn container_resource_decoder() -> decode.Decoder(
ContainerResource,
)
pub fn create_container_request_to_json(
request: CreateContainerRequest,
) -> json.Json
pub fn create_request(
config: config.Config,
request: CreateContainerRequest,
) -> request.Request(String)
pub fn create_response(
response: response.Response(String),
) -> Result(ContainerResource, error.GlopenaiError)
pub fn delete_request(
config: config.Config,
container_id: String,
) -> request.Request(String)
pub fn delete_response(
response: response.Response(String),
) -> Result(DeleteContainerResponse, error.GlopenaiError)
pub fn empty_list_container_files_query() -> ListContainerFilesQuery
pub fn empty_list_containers_query() -> ListContainersQuery
pub fn file_content_request(
config: config.Config,
container_id: String,
file_id: String,
) -> request.Request(String)
Build a request for the raw file content. The body is returned as bytes
(typed as String to keep the sans-IO signature uniform; clients that
need strict binary handling should use httpc.send_bits and decode).
pub fn file_content_response(
response: response.Response(String),
) -> Result(String, error.GlopenaiError)
Parse a file-content response. On 2xx returns the raw body string.
On non-2xx attempts to decode an API error, falling back to
UnexpectedResponse.
pub fn file_create_request(
config: config.Config,
container_id: String,
upload: ContainerFileUpload,
boundary: String,
) -> request.Request(BitArray)
Build a multipart POST /containers/{container_id}/files request.
When uploading raw bytes, the caller supplies boundary explicitly — it
must not appear inside data. The file_id variant still goes through
multipart (matching the Rust client) but carries only a single text field.
pub fn file_create_response(
response: response.Response(String),
) -> Result(ContainerFileResource, error.GlopenaiError)
pub fn file_delete_request(
config: config.Config,
container_id: String,
file_id: String,
) -> request.Request(String)
pub fn file_delete_response(
response: response.Response(String),
) -> Result(DeleteContainerFileResponse, error.GlopenaiError)
pub fn file_list_request(
config: config.Config,
container_id: String,
) -> request.Request(String)
pub fn file_list_request_with_query(
config: config.Config,
container_id: String,
query: ListContainerFilesQuery,
) -> request.Request(String)
pub fn file_list_response(
response: response.Response(String),
) -> Result(ContainerFileListResource, error.GlopenaiError)
pub fn file_retrieve_request(
config: config.Config,
container_id: String,
file_id: String,
) -> request.Request(String)
pub fn file_retrieve_response(
response: response.Response(String),
) -> Result(ContainerFileResource, error.GlopenaiError)
pub fn list_request(
config: config.Config,
) -> request.Request(String)
pub fn list_request_with_query(
config: config.Config,
query: ListContainersQuery,
) -> request.Request(String)
pub fn list_response(
response: response.Response(String),
) -> Result(ContainerListResource, error.GlopenaiError)
pub fn memory_limit_decoder() -> decode.Decoder(MemoryLimit)
pub fn memory_limit_to_json(limit: MemoryLimit) -> json.Json
pub fn new_create_request(name: String) -> CreateContainerRequest
pub fn retrieve_request(
config: config.Config,
container_id: String,
) -> request.Request(String)
pub fn retrieve_response(
response: response.Response(String),
) -> Result(ContainerResource, error.GlopenaiError)
pub fn with_expires_after(
request: CreateContainerRequest,
expires_after: ContainerExpiresAfter,
) -> CreateContainerRequest
pub fn with_file_ids(
request: CreateContainerRequest,
file_ids: List(String),
) -> CreateContainerRequest
pub fn with_memory_limit(
request: CreateContainerRequest,
memory_limit: MemoryLimit,
) -> CreateContainerRequest