pub struct UploadBuilder { /* private fields */ }Expand description
Builder for creating upload sessions.
§Examples
use openai_ergonomic::{Builder, UploadBuilder, UploadPurpose};
let request = UploadBuilder::new(
"dataset.jsonl",
UploadPurpose::Assistants,
2048,
"application/json",
)
.expires_after_seconds(3600)
.build()
.unwrap();
assert_eq!(request.filename, "dataset.jsonl");
assert_eq!(request.purpose, UploadPurpose::Assistants);Implementations§
Source§impl UploadBuilder
impl UploadBuilder
Sourcepub fn new(
filename: impl Into<String>,
purpose: Purpose,
bytes: i32,
mime_type: impl Into<String>,
) -> Self
pub fn new( filename: impl Into<String>, purpose: Purpose, bytes: i32, mime_type: impl Into<String>, ) -> Self
Create a new upload builder.
Sourcepub fn filename(self, filename: impl Into<String>) -> Self
pub fn filename(self, filename: impl Into<String>) -> Self
Override the filename before building the request.
Sourcepub fn expires_after(self, expiration: FileExpirationAfter) -> Self
pub fn expires_after(self, expiration: FileExpirationAfter) -> Self
Set the expiration policy directly.
Sourcepub fn expires_after_seconds(self, seconds: i32) -> Self
pub fn expires_after_seconds(self, seconds: i32) -> Self
Set the expiration in seconds using the default created_at anchor.
Sourcepub fn purpose_ref(&self) -> Purpose
pub fn purpose_ref(&self) -> Purpose
Access the configured purpose.
Sourcepub fn expires_after_ref(&self) -> Option<&FileExpirationAfter>
pub fn expires_after_ref(&self) -> Option<&FileExpirationAfter>
Access the configured expiration policy.
Trait Implementations§
Source§impl Builder<CreateUploadRequest> for UploadBuilder
impl Builder<CreateUploadRequest> for UploadBuilder
Source§fn build(self) -> Result<CreateUploadRequest>
fn build(self) -> Result<CreateUploadRequest>
Build the final request type.
Source§impl Clone for UploadBuilder
impl Clone for UploadBuilder
Source§fn clone(&self) -> UploadBuilder
fn clone(&self) -> UploadBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for UploadBuilder
impl RefUnwindSafe for UploadBuilder
impl Send for UploadBuilder
impl Sync for UploadBuilder
impl Unpin for UploadBuilder
impl UnwindSafe for UploadBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more