GoodMemGoodMem
ReferenceClient SDKsRust

Client and errors

Rust SDK client construction, configuration, download and stream types, and typed error handling.

Configure a reusable Client with Client::builder. Cloned clients share the connection pool.

Ordinary requests have a total timeout; event streams have an idle timeout between chunks. With a custom HTTP client, disable redirects and avoid a total timeout that would cut off active streams. ClientBuilder::timeout sets the SDK request/idle budget independently of the custom client and defaults to 30 seconds. It does not change the custom client's own timeout settings, which can end a request sooner.

Error::Http preserves the server's HTTP status. Error::kind() classifies HTTP errors and returns None for local validation, transport, decoding, protocol, and timeout errors. Match Error with a fallback arm because it is non-exhaustive.

Types

Struct Client

goodmem::Client

Reusable asynchronous client. Clones share the connection pool.

pub struct Client {
    /* private fields */
}

Implementations

access_policy

pub fn access_policy(&self) -> AccessPolicy<'_>

Access access_policy operations.

admin

pub fn admin(&self) -> Admin<'_>

Access admin operations.

apikeys

pub fn apikeys(&self) -> Apikeys<'_>

Access apikeys operations.

decision_models

pub fn decision_models(&self) -> DecisionModels<'_>

Access decision_models operations.

embedders

pub fn embedders(&self) -> Embedders<'_>

Access embedders operations.

instance

pub fn instance(&self) -> Instance<'_>

Access instance operations.

llms

pub fn llms(&self) -> Llms<'_>

Access llms operations.

memories

pub fn memories(&self) -> Memories<'_>

Access memories operations.

ocr

pub fn ocr(&self) -> Ocr<'_>

Access ocr operations.

ping

pub fn ping(&self) -> Ping<'_>

Access ping operations.

rerankers

pub fn rerankers(&self) -> Rerankers<'_>

Access rerankers operations.

service_identities

pub fn service_identities(&self) -> ServiceIdentities<'_>

Access service_identities operations.

spaces

pub fn spaces(&self) -> Spaces<'_>

Access spaces operations.

system

pub fn system(&self) -> System<'_>

Access system operations.

user_enrollments

pub fn user_enrollments(&self) -> UserEnrollments<'_>

Access user_enrollments operations.

users

pub fn users(&self) -> Users<'_>

Access users operations.

builder

pub fn builder(base_url: impl Into<String>) -> ClientBuilder

Trait implementations

  • Clone (derived)
  • impl fmt::Debug for Client

Struct ClientBuilder

goodmem::ClientBuilder

Configure authentication, timeout, custom headers, and an optional HTTP client.

pub struct ClientBuilder {
    /* private fields */
}

Implementations

api_key

pub fn api_key(mut self, key: impl Into<String>) -> Self

timeout

pub fn timeout(mut self, timeout: Duration) -> Self

Total budget for ordinary requests; per-chunk idle budget for event streams. Defaults to 30 seconds and also applies when using a custom HTTP client. This does not change the custom client's own timeout settings.

headers

pub fn headers(mut self, headers: HeaderMap) -> Self

http_client

pub fn http_client(mut self, client: reqwest::Client) -> Self

Use a custom client. It must disable redirects and avoid total stream timeouts. Configure the independent SDK request/idle budget with timeout().

build

pub fn build(self) -> Result<Client>

Trait implementations

  • impl fmt::Debug for ClientBuilder

Struct Download

goodmem::Download

Download content with metadata needed for resumable downloads.

pub struct Download {
    pub status: u16,
    pub headers: HeaderMap,
    pub bytes: Vec<u8>,
}

Fields

status

pub status: u16

headers

pub headers: HeaderMap

bytes

pub bytes: Vec<u8>

Trait implementations

  • Debug (derived)

Type alias EventStream

goodmem::EventStream

A lazy, cancellable stream. Import futures_util::StreamExt to call next().

pub type EventStream<T> = Pin<Box<dyn Stream<Item = Result<T>> + Send>>;

Referenced types: Result.

Struct UploadFile

goodmem::UploadFile

A named file part in a multipart batch. Each request's fileField selects one part.

pub struct UploadFile {
    pub field_name: String,
    pub filename: String,
    pub content_type: String,
    pub data: Vec<u8>,
}

Fields

field_name

pub field_name: String

Unique multipart field name, matching a request's fileField.

filename

pub filename: String

Filename sent in the multipart content disposition.

content_type

pub content_type: String

MIME type of the uploaded bytes.

data

pub data: Vec<u8>

File content. These bytes are omitted from Debug output.

Trait implementations

  • impl fmt::Debug for UploadFile

Type alias Result

goodmem::Result

SDK operation result.

pub type Result<T> = std::result::Result<T, Error>;

Referenced types: Error.

Enum Error

goodmem::Error

An HTTP, validation, transport, or decoding error.

#[non_exhaustive]
pub enum Error {
    InvalidInput(String),
    Http { status: u16, message: String },
    Transport(reqwest::Error),
    Json(serde_json::Error),
    Protocol(String),
    Timeout,
}

Variants

InvalidInput

InvalidInput(String)

Http

Http { status: u16, message: String }

Transport

Transport(reqwest::Error)

Json

Json(serde_json::Error)

Protocol

Protocol(String)

Timeout

Timeout

Implementations

kind

pub fn kind(&self) -> Option<ErrorKind>

Classify a server error without parsing its message.

Trait implementations

  • Debug (derived)
  • impl fmt::Display for Error
  • impl std::error::Error for Error
  • impl From<reqwest::Error> for Error
  • impl From<serde_json::Error> for Error

Enum ErrorKind

goodmem::ErrorKind

Categories for HTTP failures; the original status remains available on Error::Http.

pub enum ErrorKind {
    InvalidArgument,
    Unauthenticated,
    PermissionDenied,
    NotFound,
    Conflict,
    PreconditionFailed,
    RateLimited,
    Server,
    Other,
}

Variants

InvalidArgument

InvalidArgument

Unauthenticated

Unauthenticated

PermissionDenied

PermissionDenied

NotFound

NotFound

Conflict

Conflict

PreconditionFailed

PreconditionFailed

RateLimited

RateLimited

Server

Server

Other

Other

Trait implementations

  • Debug (derived)
  • Clone (derived)
  • Copy (derived)
  • PartialEq (derived)
  • Eq (derived)

On this page