Skip to main content

HttpClient

Struct HttpClient 

Source
pub struct HttpClient<T> { /* private fields */ }
Expand description

A typed /agdx/* client over an injected Transport.

Binary KV keys are base64url-encoded into the path by the client, so raw user bytes never enter a path segment. A namespace, fork id, or projection id argument, by contrast, is placed in the path verbatim, so the caller must pass a path-safe identifier (no /, ?, or #). Fork ids are already constrained by validate_fork_id.

Implementations§

Source§

impl<T: Transport> HttpClient<T>

Source

pub fn new(transport: T) -> Self

Wrap a transport. The transport owns the base URL and auth.

Source

pub fn transport(&self) -> &T

The underlying transport, for a caller that needs an escape hatch.

Source

pub async fn capabilities(&self) -> Result<Capabilities, ClientError<T::Error>>

GET /agdx/capabilities: feature-detect before showing a view.

Source

pub async fn query( &self, query: &Query, ) -> Result<QueryResult, ClientError<T::Error>>

POST /agdx/query: run a query, get the result page back.

Source

pub async fn list_projections( &self, filter: &ProjectionListQuery, ) -> Result<Vec<ProjectionInfo>, ClientError<T::Error>>

GET /agdx/projections: list projections and their bindings, optionally filtered.

Source

pub async fn list_schemas( &self, filter: &SchemaListQuery, ) -> Result<Vec<SchemaInfo>, ClientError<T::Error>>

GET /agdx/schemas: list registered schemas, optionally filtered.

Source

pub async fn register_schema( &self, source: SchemaSource, name: Option<String>, version: Option<u32>, ) -> Result<u32, ClientError<T::Error>>

POST /agdx/schemas: register a schema, get its allocated id.

Source

pub async fn kv_get( &self, namespace: &str, key: &[u8], ) -> Result<Option<KvValue>, ClientError<T::Error>>

GET /agdx/kv/{namespace}/{key}: fetch one entry, or None on a 404. The value rides the raw response body (no base64 inflation, symmetric with kv_set), and the optional expiry rides the KV_EXPIRES_AT_MICROS_HEADER response header.

Source

pub async fn kv_set( &self, namespace: &str, key: &[u8], value: &[u8], expires_at_micros: Option<u64>, ) -> Result<(), ClientError<T::Error>>

PUT /agdx/kv/{namespace}/{key}: set a value, with an optional absolute expiry (epoch microseconds).

Source

pub async fn kv_cas( &self, namespace: &str, key: &[u8], value: &[u8], expect: CasExpect, expires_at_micros: Option<u64>, ) -> Result<u64, ClientError<T::Error>>

PUT /agdx/kv/{namespace}/{key}/cas: a conditional write (compare-and-swap). Applies value only if expect holds, returning the new version on commit. A precondition miss surfaces as ClientError::Api with ResultCode::Conflict (the response’s ErrorBody.detail carries the current version). Backend-gated by the kv_cas capability: a deployment that does not serve it answers unsupported.

Source

pub async fn kv_delete( &self, namespace: &str, key: &[u8], ) -> Result<bool, ClientError<T::Error>>

DELETE /agdx/kv/{namespace}/{key}: delete one entry, returning true if it existed.

Source

pub async fn kv_scan( &self, namespace: &str, filter: &KvScanQuery, ) -> Result<KvPageView, ClientError<T::Error>>

GET /agdx/kv/{namespace}: scan a page of entries.

Source

pub async fn create_fork( &self, body: &ForkCreateBody, ) -> Result<ForkInfo, ClientError<T::Error>>

POST /agdx/forks: create a fork.

Source

pub async fn list_forks(&self) -> Result<Vec<ForkInfo>, ClientError<T::Error>>

GET /agdx/forks: list the caller’s forks.

Source

pub async fn clients( &self, query: &ClientsQuery, ) -> Result<ClientMetadataListView, ClientError<T::Error>>

GET /agdx/clients: one page of live connections with their advertised metadata, filtered and paginated per query. Follow next_cursor as the next after to page.

Source

pub async fn submit_run( &self, body: &AgentSubmit, ) -> Result<AgentRunInfo, ClientError<T::Error>>

POST /agdx/runs: submit a task to an agent or workflow, returning the minted (or converged) run.

Source

pub async fn run_status( &self, id: &str, ) -> Result<Option<AgentRunInfo>, ClientError<T::Error>>

GET /agdx/runs/{id}: read one run’s status, or None on a 404.

Source

pub async fn list_runs( &self, query: &RunsQuery, ) -> Result<RunPageView, ClientError<T::Error>>

GET /agdx/runs: one page of runs, filtered and paged per query. Follow cursor as the next request’s cursor to page.

Source

pub async fn cancel_run( &self, id: &str, ) -> Result<AgentRunInfo, ClientError<T::Error>>

POST /agdx/runs/{id}/cancel: record the cancel intent, returning the run (the engine observes the intent at its next step boundary).

Source

pub async fn get_projection( &self, id: &str, ) -> Result<Option<ProjectionInfo>, ClientError<T::Error>>

GET /agdx/projections/{id}: read one projection and its bindings, or None on a 404.

Source

pub async fn register_projection( &self, projection: &Projection, ) -> Result<(), ClientError<T::Error>>

POST /agdx/projections: register or replace a projection (a control command, durable on the control topic).

Source

pub async fn drop_projection( &self, id: &str, ) -> Result<(), ClientError<T::Error>>

DELETE /agdx/projections/{id}: drop a projection.

Source

pub async fn apply_binding( &self, binding: &ProjectionBinding, ) -> Result<(), ClientError<T::Error>>

POST /agdx/bindings: apply (add or update) a binding.

Source

pub async fn remove_binding( &self, source: &SourceSelector, projection_ref: Option<String>, ) -> Result<(), ClientError<T::Error>>

DELETE /agdx/bindings: remove a binding for a source, or one projection from it when projection_ref is set.

Source

pub async fn get_schema( &self, id: u32, ) -> Result<Option<SchemaInfo>, ClientError<T::Error>>

GET /agdx/schemas/{id}: read one writer schema, or None on a 404.

Source

pub async fn drop_schema(&self, id: u32) -> Result<(), ClientError<T::Error>>

DELETE /agdx/schemas/{id}: drop (tombstone) a schema.

Source

pub async fn decode_record( &self, id: u32, payload: &[u8], ) -> Result<Option<Value>, ClientError<T::Error>>

POST /agdx/schemas/{id}/decode: decode a record body under the schema, returning its JSON form, or None when the body does not decode under it.

Source

pub async fn kv_namespaces( &self, ) -> Result<Vec<KvNamespaceInfo>, ClientError<T::Error>>

GET /agdx/kv: list the caller’s namespaces and their entry counts.

Source

pub async fn kv_delete_many( &self, namespace: &str, filter: &KvScanQuery, ) -> Result<usize, ClientError<T::Error>>

DELETE /agdx/kv/{namespace}: bulk-delete entries matching the bounds (no bounds clears the namespace). Returns the number removed.

Source

pub async fn promote_fork( &self, id: &str, ) -> Result<usize, ClientError<T::Error>>

POST /agdx/forks/{id}/promote: promote a fork’s rows onto the trunk. Returns the number of rows applied.

Source

pub async fn delete_fork(&self, id: &str) -> Result<(), ClientError<T::Error>>

DELETE /agdx/forks/{id}: squash (discard) a fork.

Source

pub async fn put_fork_row( &self, id: &str, body: &ForkPutBody, ) -> Result<(), ClientError<T::Error>>

PUT /agdx/forks/{id}/rows: write one speculative row into a fork.

Source

pub async fn graph_query( &self, name: &str, query: &GraphQuery, ) -> Result<GraphResultView, ClientError<T::Error>>

POST /agdx/graph/{name}/query: run a traversal over a named graph, get back the reachable nodes and traversed edges. Backend-gated by the graph capability: a deployment without a graph backend answers unsupported.

Source

pub async fn graph_neighbors( &self, name: &str, node: &str, query: &GraphNeighborsQuery, ) -> Result<GraphResultView, ClientError<T::Error>>

GET /agdx/graph/{name}/neighbors/{node}: the neighbor read, the cheap common traversal. node is the Crockford-base32 node id. query carries the direction, an optional edge-type filter, the hop depth, and a limit (a default query reads one hop outward with no filter).

Source

pub async fn list_graphs( &self, filter: &ProjectionListQuery, ) -> Result<Vec<ProjectionInfo>, ClientError<T::Error>>

GET /agdx/graphs: list the registered graph projections, the discovery surface a graph explorer reads to offer the available graphs. Reuses the projection-list filter, narrowed to graph-kind projections server-side.

Source

pub async fn register_graph( &self, projection: &Projection, ) -> Result<(), ClientError<T::Error>>

POST /agdx/graphs: register a graph projection (a Projection with kind = Graph and an entity schema). Applied asynchronously, like every control command.

Source

pub async fn get_graph( &self, id: &str, ) -> Result<Option<ProjectionInfo>, ClientError<T::Error>>

GET /agdx/graphs/{id}: read one graph projection by id, or None when no graph projection has it.

Source

pub async fn drop_graph(&self, id: &str) -> Result<(), ClientError<T::Error>>

DELETE /agdx/graphs/{id}: drop the graph projection registered under id. The materialized nodes and edges are left untouched.

Source

pub async fn authz_whoami(&self) -> Result<WhoamiReply, ClientError<T::Error>>

GET /agdx/authz/whoami: the caller’s own bound roles and effective grants. Backend-gated by the authz capability: a deployment that does not serve the authorization band answers unsupported.

Source

pub async fn list_roles(&self) -> Result<Vec<Role>, ClientError<T::Error>>

GET /agdx/authz/roles: every defined role with its full grant set.

Source

pub async fn get_role( &self, name: &str, ) -> Result<Option<Role>, ClientError<T::Error>>

GET /agdx/authz/roles/{name}: one role by name, or None on a 404.

Source

pub async fn define_role( &self, role: &Role, ) -> Result<(), ClientError<T::Error>>

PUT /agdx/authz/roles/{name}: define or replace a role. The path name is authoritative, so role.name must match it.

Source

pub async fn delete_role(&self, name: &str) -> Result<(), ClientError<T::Error>>

DELETE /agdx/authz/roles/{name}: delete a role.

Source

pub async fn user_roles( &self, user_id: u32, ) -> Result<Vec<String>, ClientError<T::Error>>

GET /agdx/authz/users/{id}/roles: one user’s bound role names.

Source

pub async fn bind_user_roles( &self, user_id: u32, roles: &[String], ) -> Result<(), ClientError<T::Error>>

PUT /agdx/authz/users/{id}/roles: replace the user’s whole role set.

Trait Implementations§

Source§

impl<T: Clone> Clone for HttpClient<T>

Source§

fn clone(&self) -> HttpClient<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for HttpClient<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for HttpClient<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for HttpClient<T>
where T: RefUnwindSafe,

§

impl<T> Send for HttpClient<T>
where T: Send,

§

impl<T> Sync for HttpClient<T>
where T: Sync,

§

impl<T> Unpin for HttpClient<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for HttpClient<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for HttpClient<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V