Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Client for Hindclaw API

Access control API for Hindsight memory server

Version: 0.1.0

Implementations§

Source§

impl Client

Source

pub fn new(baseurl: &str) -> Self

Create a new client.

baseurl is the base URL provided to the internal reqwest::Client, and should include a scheme and hostname, as well as port and a path stem if applicable.

Source

pub fn new_with_client(baseurl: &str, client: Client) -> Self

Construct a new client with an existing reqwest::Client, allowing more control over its configuration.

baseurl is the base URL provided to the internal reqwest::Client, and should include a scheme and hostname, as well as port and a path stem if applicable.

Source§

impl Client

Source

pub async fn list_template_sources<'a>( &'a self, ) -> Result<ResponseValue<Vec<SourceResponse>>, Error<()>>

List Template Sources

List all configured marketplace sources.

Sends a GET request to /ext/hindclaw/admin/template-sources

Source

pub async fn create_template_source<'a>( &'a self, body: &'a CreateSourceRequest, ) -> Result<ResponseValue<SourceResponse>, Error<HttpValidationError>>

Create Template Source

Register a trusted marketplace source.

Sends a POST request to /ext/hindclaw/admin/template-sources

Source

pub async fn delete_template_source<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Template Source

Remove a trusted marketplace source.

Sends a DELETE request to /ext/hindclaw/admin/template-sources/{name}

Source

pub async fn create_bank_from_template<'a>( &'a self, body: &'a CreateBankFromTemplateRequest, ) -> Result<ResponseValue<BankCreationResponse>, Error<HttpValidationError>>

Create Bank From Template

Create a bank from an installed template.

Sends a POST request to /ext/hindclaw/banks

Source

pub async fn get_bank_policy<'a>( &'a self, bank_id: &'a str, ) -> Result<ResponseValue<BankPolicyResponse>, Error<HttpValidationError>>

Get Bank Policy Endpoint

Sends a GET request to /ext/hindclaw/banks/{bank_id}/policy

Source

pub async fn upsert_bank_policy<'a>( &'a self, bank_id: &'a str, body: &'a UpsertBankPolicyRequest, ) -> Result<ResponseValue<BankPolicyResponse>, Error<HttpValidationError>>

Upsert Bank Policy Endpoint

Sends a PUT request to /ext/hindclaw/banks/{bank_id}/policy

Source

pub async fn delete_bank_policy<'a>( &'a self, bank_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Bank Policy Endpoint

Sends a DELETE request to /ext/hindclaw/banks/{bank_id}/policy

Source

pub async fn debug_resolve<'a>( &'a self, action: Option<&'a str>, bank: &'a str, sa_id: Option<&'a str>, sender: Option<&'a str>, user_id: Option<&'a str>, ) -> Result<ResponseValue<Value>, Error<HttpValidationError>>

Debug Resolve

Resolve and return effective access policy + bank policy for a context.

Sends a GET request to /ext/hindclaw/debug/resolve

Source

pub async fn list_groups<'a>( &'a self, ) -> Result<ResponseValue<Vec<GroupSummaryResponse>>, Error<()>>

List Groups

Sends a GET request to /ext/hindclaw/groups

Source

pub async fn create_group<'a>( &'a self, body: &'a CreateGroupRequest, ) -> Result<ResponseValue<GroupSummaryResponse>, Error<HttpValidationError>>

Create Group

Sends a POST request to /ext/hindclaw/groups

Source

pub async fn get_group<'a>( &'a self, group_id: &'a str, ) -> Result<ResponseValue<GroupSummaryResponse>, Error<HttpValidationError>>

Get Group

Sends a GET request to /ext/hindclaw/groups/{group_id}

Source

pub async fn update_group<'a>( &'a self, group_id: &'a str, body: &'a UpdateGroupRequest, ) -> Result<ResponseValue<GroupSummaryResponse>, Error<HttpValidationError>>

Update Group

Sends a PUT request to /ext/hindclaw/groups/{group_id}

Source

pub async fn delete_group<'a>( &'a self, group_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Group

Sends a DELETE request to /ext/hindclaw/groups/{group_id}

Source

pub async fn list_group_members<'a>( &'a self, group_id: &'a str, ) -> Result<ResponseValue<Vec<GroupMemberResponse>>, Error<HttpValidationError>>

List Group Members

Sends a GET request to /ext/hindclaw/groups/{group_id}/members

Source

pub async fn add_group_member<'a>( &'a self, group_id: &'a str, body: &'a AddMemberRequest, ) -> Result<ResponseValue<GroupMembershipConfirmation>, Error<HttpValidationError>>

Add Group Member

Sends a POST request to /ext/hindclaw/groups/{group_id}/members

Source

pub async fn remove_group_member<'a>( &'a self, group_id: &'a str, user_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Remove Group Member

Sends a DELETE request to /ext/hindclaw/groups/{group_id}/members/{user_id}

Marketplace Search

Search marketplace templates across configured sources.

Sends a GET request to /ext/hindclaw/marketplace/search

Arguments:

  • q: Search query
  • source: Filter by source name
  • tag: Filter by tag
Source

pub async fn list_my_service_accounts<'a>( &'a self, ) -> Result<ResponseValue<Vec<ServiceAccountResponse>>, Error<()>>

List My Service Accounts

Sends a GET request to /ext/hindclaw/me/service-accounts

Source

pub async fn create_my_service_account<'a>( &'a self, body: &'a CreateSelfServiceAccountRequest, ) -> Result<ResponseValue<ServiceAccountResponse>, Error<HttpValidationError>>

Create My Service Account

Sends a POST request to /ext/hindclaw/me/service-accounts

Source

pub async fn get_my_service_account<'a>( &'a self, sa_id: &'a str, ) -> Result<ResponseValue<ServiceAccountResponse>, Error<HttpValidationError>>

Get My Service Account

Sends a GET request to /ext/hindclaw/me/service-accounts/{sa_id}

Source

pub async fn update_my_service_account<'a>( &'a self, sa_id: &'a str, body: &'a UpdateSelfServiceAccountRequest, ) -> Result<ResponseValue<ServiceAccountResponse>, Error<HttpValidationError>>

Update My Service Account

Sends a PUT request to /ext/hindclaw/me/service-accounts/{sa_id}

Source

pub async fn delete_my_service_account<'a>( &'a self, sa_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete My Service Account

Sends a DELETE request to /ext/hindclaw/me/service-accounts/{sa_id}

Source

pub async fn list_my_sa_keys<'a>( &'a self, sa_id: &'a str, ) -> Result<ResponseValue<Vec<SaKeyResponse>>, Error<HttpValidationError>>

List My Sa Keys

Sends a GET request to /ext/hindclaw/me/service-accounts/{sa_id}/keys

Source

pub async fn create_my_sa_key<'a>( &'a self, sa_id: &'a str, body: &'a CreateSaKeyRequest, ) -> Result<ResponseValue<SaKeyCreateResponse>, Error<HttpValidationError>>

Create My Sa Key

Sends a POST request to /ext/hindclaw/me/service-accounts/{sa_id}/keys

Source

pub async fn delete_my_sa_key<'a>( &'a self, sa_id: &'a str, key_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete My Sa Key

Sends a DELETE request to /ext/hindclaw/me/service-accounts/{sa_id}/keys/{key_id}

Source

pub async fn list_policies<'a>( &'a self, ) -> Result<ResponseValue<Vec<PolicyResponse>>, Error<()>>

List Policies

Sends a GET request to /ext/hindclaw/policies

Source

pub async fn create_policy<'a>( &'a self, body: &'a CreatePolicyRequest, ) -> Result<ResponseValue<PolicyResponse>, Error<HttpValidationError>>

Create Policy

Sends a POST request to /ext/hindclaw/policies

Source

pub async fn get_policy<'a>( &'a self, policy_id: &'a str, ) -> Result<ResponseValue<PolicyResponse>, Error<HttpValidationError>>

Get Policy Endpoint

Sends a GET request to /ext/hindclaw/policies/{policy_id}

Source

pub async fn update_policy<'a>( &'a self, policy_id: &'a str, body: &'a UpdatePolicyRequest, ) -> Result<ResponseValue<PolicyResponse>, Error<HttpValidationError>>

Update Policy Endpoint

Sends a PUT request to /ext/hindclaw/policies/{policy_id}

Source

pub async fn delete_policy<'a>( &'a self, policy_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Policy Endpoint

Sends a DELETE request to /ext/hindclaw/policies/{policy_id}

Source

pub async fn list_policy_attachments<'a>( &'a self, policy_id: &'a str, ) -> Result<ResponseValue<Vec<PolicyAttachmentResponse>>, Error<HttpValidationError>>

List Attachments

Sends a GET request to /ext/hindclaw/policy-attachments

Source

pub async fn upsert_policy_attachment<'a>( &'a self, body: &'a CreatePolicyAttachmentRequest, ) -> Result<ResponseValue<PolicyAttachmentResponse>, Error<HttpValidationError>>

Upsert Attachment

Sends a PUT request to /ext/hindclaw/policy-attachments

Source

pub async fn delete_policy_attachment<'a>( &'a self, policy_id: &'a str, principal_type: &'a str, principal_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Attachment

Sends a DELETE request to /ext/hindclaw/policy-attachments/{policy_id}/{principal_type}/{principal_id}

Source

pub async fn list_service_accounts<'a>( &'a self, ) -> Result<ResponseValue<Vec<ServiceAccountResponse>>, Error<()>>

List Service Accounts

Sends a GET request to /ext/hindclaw/service-accounts

Source

pub async fn create_service_account<'a>( &'a self, body: &'a CreateServiceAccountRequest, ) -> Result<ResponseValue<ServiceAccountResponse>, Error<HttpValidationError>>

Create Service Account

Sends a POST request to /ext/hindclaw/service-accounts

Source

pub async fn get_service_account<'a>( &'a self, sa_id: &'a str, ) -> Result<ResponseValue<ServiceAccountResponse>, Error<HttpValidationError>>

Get Service Account Endpoint

Sends a GET request to /ext/hindclaw/service-accounts/{sa_id}

Source

pub async fn update_service_account<'a>( &'a self, sa_id: &'a str, body: &'a UpdateServiceAccountRequest, ) -> Result<ResponseValue<ServiceAccountResponse>, Error<HttpValidationError>>

Update Service Account Endpoint

Sends a PUT request to /ext/hindclaw/service-accounts/{sa_id}

Source

pub async fn delete_service_account<'a>( &'a self, sa_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Service Account Endpoint

Sends a DELETE request to /ext/hindclaw/service-accounts/{sa_id}

Source

pub async fn list_sa_keys<'a>( &'a self, sa_id: &'a str, ) -> Result<ResponseValue<Vec<SaKeyResponse>>, Error<HttpValidationError>>

List Sa Keys

Sends a GET request to /ext/hindclaw/service-accounts/{sa_id}/keys

Source

pub async fn create_sa_key<'a>( &'a self, sa_id: &'a str, body: &'a CreateSaKeyRequest, ) -> Result<ResponseValue<SaKeyCreateResponse>, Error<HttpValidationError>>

Create Sa Key

Sends a POST request to /ext/hindclaw/service-accounts/{sa_id}/keys

Source

pub async fn delete_sa_key<'a>( &'a self, sa_id: &'a str, key_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Sa Key

Sends a DELETE request to /ext/hindclaw/service-accounts/{sa_id}/keys/{key_id}

Source

pub async fn list_templates<'a>( &'a self, scope: Option<&'a str>, ) -> Result<ResponseValue<Vec<TemplateSummaryResponse>>, Error<HttpValidationError>>

List Templates

List installed templates filtered by access.

When scope is None, returns all server templates plus the caller’s personal templates. When scope is specified, returns only that scope.

Args: scope: Optional scope filter (‘server’ or ‘personal’). principal: Authenticated principal from IAM.

Returns: List of template summaries.

Sends a GET request to /ext/hindclaw/templates

Source

pub async fn create_template<'a>( &'a self, body: &'a CreateTemplateRequest, ) -> Result<ResponseValue<TemplateResponse>, Error<HttpValidationError>>

Create Template

Create a custom template (no marketplace source).

Args: request: Template creation payload. principal: Authenticated principal from IAM.

Returns: The created template.

Raises: HTTPException: 409 if template already exists.

Sends a POST request to /ext/hindclaw/templates

Source

pub async fn install_template<'a>( &'a self, body: &'a InstallTemplateRequest, ) -> Result<ResponseValue<TemplateResponse>, Error<HttpValidationError>>

Install Template

Install a template from a registered marketplace source.

Sends a POST request to /ext/hindclaw/templates/install

Source

pub async fn get_template<'a>( &'a self, scope: &'a str, name: &'a str, ) -> Result<ResponseValue<TemplateResponse>, Error<HttpValidationError>>

Get Template Endpoint

Get a template by scope and name.

Finds any template matching (scope, name) regardless of source. This covers both custom templates and marketplace-installed ones.

Args: scope: Template scope (‘server’ or ‘personal’). name: Template name. principal: Authenticated principal from IAM.

Returns: Full template details.

Raises: HTTPException: 404 if template not found.

Sends a GET request to /ext/hindclaw/templates/{scope}/{name}

Source

pub async fn update_template<'a>( &'a self, scope: &'a str, name: &'a str, body: &'a UpdateTemplateRequest, ) -> Result<ResponseValue<TemplateResponse>, Error<HttpValidationError>>

Update Template Endpoint

Update a custom template.

Performs cross-field validation when extraction mode or custom instructions are part of the update by merging with the existing record before applying.

Args: scope: Template scope (‘server’ or ‘personal’). name: Template name. request: Partial update payload. principal: Authenticated principal from IAM.

Returns: The updated template.

Raises: HTTPException: 404 if template not found, 422 if cross-field validation fails.

Sends a PUT request to /ext/hindclaw/templates/{scope}/{name}

Source

pub async fn delete_template<'a>( &'a self, scope: &'a str, name: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Template Endpoint

Delete a custom template.

Args: scope: Template scope (‘server’ or ‘personal’). name: Template name. principal: Authenticated principal from IAM.

Raises: HTTPException: 404 if template not found.

Sends a DELETE request to /ext/hindclaw/templates/{scope}/{name}

Source

pub async fn update_template_from_marketplace<'a>( &'a self, scope: &'a str, source: &'a str, name: &'a str, ) -> Result<ResponseValue<TemplateUpdateResponse>, Error<HttpValidationError>>

Update Template From Marketplace

Update an installed template from its marketplace source.

Sends a POST request to /ext/hindclaw/templates/{scope}/{source}/{name}/update

Source

pub async fn list_users<'a>( &'a self, ) -> Result<ResponseValue<Vec<UserResponse>>, Error<()>>

List Users

Sends a GET request to /ext/hindclaw/users

Source

pub async fn create_user<'a>( &'a self, body: &'a CreateUserRequest, ) -> Result<ResponseValue<UserResponse>, Error<HttpValidationError>>

Create User

Sends a POST request to /ext/hindclaw/users

Source

pub async fn get_user<'a>( &'a self, user_id: &'a str, ) -> Result<ResponseValue<UserResponse>, Error<HttpValidationError>>

Get User

Sends a GET request to /ext/hindclaw/users/{user_id}

Source

pub async fn update_user<'a>( &'a self, user_id: &'a str, body: &'a UpdateUserRequest, ) -> Result<ResponseValue<UserResponse>, Error<HttpValidationError>>

Update User

Sends a PUT request to /ext/hindclaw/users/{user_id}

Source

pub async fn delete_user<'a>( &'a self, user_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete User

Sends a DELETE request to /ext/hindclaw/users/{user_id}

Source

pub async fn list_api_keys<'a>( &'a self, user_id: &'a str, ) -> Result<ResponseValue<Vec<ApiKeyResponse>>, Error<HttpValidationError>>

List Api Keys

List API keys for a user. Keys are masked after creation.

Sends a GET request to /ext/hindclaw/users/{user_id}/api-keys

Source

pub async fn create_api_key<'a>( &'a self, user_id: &'a str, body: &'a CreateApiKeyRequest, ) -> Result<ResponseValue<ApiKeyCreateResponse>, Error<HttpValidationError>>

Create Api Key

Sends a POST request to /ext/hindclaw/users/{user_id}/api-keys

Source

pub async fn delete_api_key<'a>( &'a self, user_id: &'a str, key_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Delete Api Key

Sends a DELETE request to /ext/hindclaw/users/{user_id}/api-keys/{key_id}

Source

pub async fn list_user_channels<'a>( &'a self, user_id: &'a str, ) -> Result<ResponseValue<Vec<ChannelResponse>>, Error<HttpValidationError>>

List User Channels

Sends a GET request to /ext/hindclaw/users/{user_id}/channels

Source

pub async fn add_user_channel<'a>( &'a self, user_id: &'a str, body: &'a AddChannelRequest, ) -> Result<ResponseValue<ChannelResponse>, Error<HttpValidationError>>

Add User Channel

Sends a POST request to /ext/hindclaw/users/{user_id}/channels

Source

pub async fn remove_user_channel<'a>( &'a self, user_id: &'a str, provider: &'a str, sender_id: &'a str, ) -> Result<ResponseValue<()>, Error<HttpValidationError>>

Remove User Channel

Sends a DELETE request to /ext/hindclaw/users/{user_id}/channels/{provider}/{sender_id}

Trait Implementations§

Source§

impl ClientHooks for &Client

Source§

async fn pre<E>( &self, request: &mut Request, info: &OperationInfo, ) -> Result<(), Error<E>>

Runs prior to the execution of the request. This may be used to modify the request before it is transmitted.
Source§

async fn post<E>( &self, result: &Result<Response, Error>, info: &OperationInfo, ) -> Result<(), Error<E>>

Runs after completion of the request.
Source§

async fn exec( &self, request: Request, info: &OperationInfo, ) -> Result<Response, Error>

Execute the request. Note that for almost any reasonable implementation this will include code equivalent to this: Read more
Source§

impl ClientInfo<()> for Client

Source§

fn api_version() -> &'static str

Get the version of this API. Read more
Source§

fn baseurl(&self) -> &str

Get the base URL to which requests are made.
Source§

fn client(&self) -> &Client

Get the internal reqwest::Client used to make requests.
Source§

fn inner(&self) -> &()

Get the inner value of type T if one is specified.
Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more