pub struct StakpakApiClient { /* private fields */ }Expand description
Client for Stakpak’s non-inference APIs
Implementations§
Source§impl StakpakApiClient
impl StakpakApiClient
Sourcepub fn new(config: &StakpakApiConfig) -> Result<Self, String>
pub fn new(config: &StakpakApiConfig) -> Result<Self, String>
Create a new StakpakApiClient
Sourcepub async fn create_session(
&self,
req: &CreateSessionRequest,
) -> Result<CreateSessionResponse, String>
pub async fn create_session( &self, req: &CreateSessionRequest, ) -> Result<CreateSessionResponse, String>
Create a new session
Sourcepub async fn create_checkpoint(
&self,
session_id: Uuid,
req: &CreateCheckpointRequest,
) -> Result<CreateCheckpointResponse, String>
pub async fn create_checkpoint( &self, session_id: Uuid, req: &CreateCheckpointRequest, ) -> Result<CreateCheckpointResponse, String>
Create a checkpoint for a session
Sourcepub async fn list_sessions(
&self,
query: &ListSessionsQuery,
) -> Result<ListSessionsResponse, String>
pub async fn list_sessions( &self, query: &ListSessionsQuery, ) -> Result<ListSessionsResponse, String>
List sessions
Sourcepub async fn get_session(&self, id: Uuid) -> Result<GetSessionResponse, String>
pub async fn get_session(&self, id: Uuid) -> Result<GetSessionResponse, String>
Get a session by ID
Sourcepub async fn update_session(
&self,
id: Uuid,
req: &UpdateSessionRequest,
) -> Result<UpdateSessionResponse, String>
pub async fn update_session( &self, id: Uuid, req: &UpdateSessionRequest, ) -> Result<UpdateSessionResponse, String>
Update a session
Sourcepub async fn list_checkpoints(
&self,
session_id: Uuid,
query: &ListCheckpointsQuery,
) -> Result<ListCheckpointsResponse, String>
pub async fn list_checkpoints( &self, session_id: Uuid, query: &ListCheckpointsQuery, ) -> Result<ListCheckpointsResponse, String>
List checkpoints for a session
Sourcepub async fn get_checkpoint(
&self,
id: Uuid,
) -> Result<GetCheckpointResponse, String>
pub async fn get_checkpoint( &self, id: Uuid, ) -> Result<GetCheckpointResponse, String>
Get a checkpoint by ID
Sourcepub async fn cancel_request(&self, request_id: &str) -> Result<(), String>
pub async fn cancel_request(&self, request_id: &str) -> Result<(), String>
Cancel an active inference request
Sourcepub async fn get_account(&self) -> Result<GetMyAccountResponse, String>
pub async fn get_account(&self) -> Result<GetMyAccountResponse, String>
Get the current user’s account info
Sourcepub async fn get_billing(
&self,
username: &str,
) -> Result<BillingResponse, String>
pub async fn get_billing( &self, username: &str, ) -> Result<BillingResponse, String>
Get billing info for a user
Sourcepub async fn list_rulebooks(&self) -> Result<Vec<ListRuleBook>, String>
pub async fn list_rulebooks(&self) -> Result<Vec<ListRuleBook>, String>
List all rulebooks
Sourcepub async fn get_rulebook_by_uri(&self, uri: &str) -> Result<RuleBook, String>
pub async fn get_rulebook_by_uri(&self, uri: &str) -> Result<RuleBook, String>
Get a rulebook by URI
Sourcepub async fn create_rulebook(
&self,
input: &CreateRuleBookInput,
) -> Result<CreateRuleBookResponse, String>
pub async fn create_rulebook( &self, input: &CreateRuleBookInput, ) -> Result<CreateRuleBookResponse, String>
Create a new rulebook
Sourcepub async fn search_docs(
&self,
req: &SearchDocsRequest,
) -> Result<Vec<Content>, String>
pub async fn search_docs( &self, req: &SearchDocsRequest, ) -> Result<Vec<Content>, String>
Search documentation
Sourcepub async fn search_memory(
&self,
req: &SearchMemoryRequest,
) -> Result<Vec<Content>, String>
pub async fn search_memory( &self, req: &SearchMemoryRequest, ) -> Result<Vec<Content>, String>
Search memory
Sourcepub async fn memorize_session(&self, checkpoint_id: Uuid) -> Result<(), String>
pub async fn memorize_session(&self, checkpoint_id: Uuid) -> Result<(), String>
Memorize a session checkpoint (extract memory)
Sourcepub async fn slack_read_messages(
&self,
req: &SlackReadMessagesRequest,
) -> Result<Vec<Content>, String>
pub async fn slack_read_messages( &self, req: &SlackReadMessagesRequest, ) -> Result<Vec<Content>, String>
Read Slack messages from a channel
Sourcepub async fn slack_read_replies(
&self,
req: &SlackReadRepliesRequest,
) -> Result<Vec<Content>, String>
pub async fn slack_read_replies( &self, req: &SlackReadRepliesRequest, ) -> Result<Vec<Content>, String>
Read Slack thread replies
Sourcepub async fn slack_send_message(
&self,
req: &SlackSendMessageRequest,
) -> Result<Vec<Content>, String>
pub async fn slack_send_message( &self, req: &SlackSendMessageRequest, ) -> Result<Vec<Content>, String>
Send a Slack message
Source§impl StakpakApiClient
impl StakpakApiClient
Sourcepub async fn read_knowledge_file(
&self,
path: &str,
) -> Result<Vec<u8>, KnowledgeApiError>
pub async fn read_knowledge_file( &self, path: &str, ) -> Result<Vec<u8>, KnowledgeApiError>
Read a knowledge file. Uses the on-disk cache at
~/.stakpak/remote-knowledge/<account>/<path> together with the
server’s If-None-Match support to avoid re-downloading unchanged
content.
Sourcepub async fn peek_knowledge_file(
&self,
path: &str,
max_bytes: usize,
) -> Result<Vec<u8>, KnowledgeApiError>
pub async fn peek_knowledge_file( &self, path: &str, max_bytes: usize, ) -> Result<Vec<u8>, KnowledgeApiError>
Read at most the first max_bytes of a knowledge file. The server
supports a peek query parameter that returns a compact preview; if
the response exceeds max_bytes we truncate client-side.
Peek requests bypass the on-disk cache because they share the path with full reads but return a different body.
Sourcepub async fn knowledge_file_exists(
&self,
path: &str,
) -> Result<bool, KnowledgeApiError>
pub async fn knowledge_file_exists( &self, path: &str, ) -> Result<bool, KnowledgeApiError>
Cheap existence check using HTTP HEAD. Does not transfer the body.
Sourcepub async fn list_knowledge_files(
&self,
query: &ListKnowledgeFilesQuery,
) -> Result<ListKnowledgeFilesResponse, KnowledgeApiError>
pub async fn list_knowledge_files( &self, query: &ListKnowledgeFilesQuery, ) -> Result<ListKnowledgeFilesResponse, KnowledgeApiError>
List knowledge files with optional filtering. Bypasses the on-disk cache (no ETag mechanism for list responses).
Sourcepub async fn create_knowledge_file(
&self,
path: &str,
content: &[u8],
) -> Result<CreateKnowledgeFileResponse, KnowledgeApiError>
pub async fn create_knowledge_file( &self, path: &str, content: &[u8], ) -> Result<CreateKnowledgeFileResponse, KnowledgeApiError>
Create a new knowledge file. Returns Conflict if a file already
exists at the target path.
The cache is not populated here: the local cache only holds bodies
that came from a GET /v1/knowledge/... so we know the cached SHA
matches the server’s ETag. The next read will populate it.
Sourcepub async fn overwrite_knowledge_file(
&self,
path: &str,
content: &[u8],
) -> Result<UpdateKnowledgeFileResponse, KnowledgeApiError>
pub async fn overwrite_knowledge_file( &self, path: &str, content: &[u8], ) -> Result<UpdateKnowledgeFileResponse, KnowledgeApiError>
Overwrite an existing knowledge file (or create if not exists).
The cache is not populated here. Any stale local copy will be
revalidated on the next read: If-None-Match will miss against the
new server ETag and the client will refetch + replace the cached
body.
Sourcepub async fn delete_knowledge_file(
&self,
path: &str,
) -> Result<(), KnowledgeApiError>
pub async fn delete_knowledge_file( &self, path: &str, ) -> Result<(), KnowledgeApiError>
Delete a knowledge file or directory. On success, evicts the matching cache entry (file or directory tree).
Trait Implementations§
Source§impl Clone for StakpakApiClient
impl Clone for StakpakApiClient
Source§fn clone(&self) -> StakpakApiClient
fn clone(&self) -> StakpakApiClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for StakpakApiClient
impl !UnwindSafe for StakpakApiClient
impl Freeze for StakpakApiClient
impl Send for StakpakApiClient
impl Sync for StakpakApiClient
impl Unpin for StakpakApiClient
impl UnsafeUnpin for StakpakApiClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request