pub struct UnstructuredClient { /* private fields */ }
Implementations§
Source§impl UnstructuredClient
impl UnstructuredClient
Sourcepub fn new(base_url: &str) -> Result<Self>
pub fn new(base_url: &str) -> Result<Self>
Creates a new UnstructuredClient
with a specified base URL.
§Arguments
base_url
: A string slice that holds the base URL for the client.
returns: Result<UnstructuredClient, ClientError>
- On success, returns an instance of UnstructuredClient
.
On failure, returns a ClientError
explaining what went wrong.
§Examples
let client = UnstructuredClient::new("https://example.com");
match client {
Ok(client) => println!("Client created successfully."),
Err(e) => println!("Failed to create client: {:?}", e),
}
Sourcepub fn with_api_key(self, api_key: &str) -> Self
pub fn with_api_key(self, api_key: &str) -> Self
Sourcepub async fn partition_file(
&self,
file_path: &Path,
params: PartitionParameters,
) -> Result<PartitionResponse>
pub async fn partition_file( &self, file_path: &Path, params: PartitionParameters, ) -> Result<PartitionResponse>
Partitions the content of a given file using Unstructured’s API.
This asynchronous function reads the content of a specified file, creates a multipart form along with given parameters, and sends a POST request to the Unstructured API route. The result is a text representation of the file’s content, partitioned by the type of the text element.
§Arguments
file_path
: The path to the file that needs to be partitioned.params
: Parameters for partitioning which are defined by thePartitionParameters
type.
Returns: Result<ElementList, ClientError>
- On success, returns a [ElementList];
otherwise returns a ClientError
.
Trait Implementations§
Source§impl Clone for UnstructuredClient
impl Clone for UnstructuredClient
Source§fn clone(&self) -> UnstructuredClient
fn clone(&self) -> UnstructuredClient
Returns a copy 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 UnstructuredClient
impl !RefUnwindSafe for UnstructuredClient
impl Send for UnstructuredClient
impl Sync for UnstructuredClient
impl Unpin for UnstructuredClient
impl !UnwindSafe for UnstructuredClient
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