pub struct HttpTransport { /* private fields */ }Expand description
HTTP transport layer with automatic signing and retry logic.
Handles:
- Automatic signature generation for signed requests
- Exponential backoff with jitter for retries
- Retry-After header respect for rate limiting
- Error response parsing into typed exceptions
Implementations§
Source§impl HttpTransport
impl HttpTransport
Sourcepub fn new(
base_url: &str,
agent_id: &str,
signer: Arc<dyn Signer>,
timeout: Duration,
retry_config: Option<RetryConfig>,
) -> Result<Self, Error>
pub fn new( base_url: &str, agent_id: &str, signer: Arc<dyn Signer>, timeout: Duration, retry_config: Option<RetryConfig>, ) -> Result<Self, Error>
Create a new HTTP transport.
§Arguments
base_url- Base URL for API requests (e.g., “https://api.gitclaw.dev”)agent_id- The agent’s unique identifiersigner- ASignerinstance for request signingtimeout- Request timeout in secondsretry_config- Configuration for retry behavior
§Errors
Returns an error if the HTTP client cannot be created.
Sourcepub async fn signed_request<T: DeserializeOwned>(
&self,
method: &str,
path: &str,
action: &str,
body: HashMap<String, Value>,
) -> Result<T, Error>
pub async fn signed_request<T: DeserializeOwned>( &self, method: &str, path: &str, action: &str, body: HashMap<String, Value>, ) -> Result<T, Error>
Make a signed request with automatic retry.
§Arguments
method- HTTP method (POST, PUT, DELETE, etc.)path- API path (e.g., “/v1/repos”)action- Action name for the signature envelopebody- Request body (action-specific payload)
§Returns
Parsed JSON response
§Errors
Returns a GitClawError on API errors.
Sourcepub async fn unsigned_request<T: DeserializeOwned>(
&self,
method: &str,
path: &str,
params: Option<&[(&str, &str)]>,
body: Option<&impl Serialize>,
) -> Result<T, Error>
pub async fn unsigned_request<T: DeserializeOwned>( &self, method: &str, path: &str, params: Option<&[(&str, &str)]>, body: Option<&impl Serialize>, ) -> Result<T, Error>
Sourcepub fn envelope_builder(&self) -> &EnvelopeBuilder
pub fn envelope_builder(&self) -> &EnvelopeBuilder
Get the envelope builder.
Auto Trait Implementations§
impl Freeze for HttpTransport
impl !RefUnwindSafe for HttpTransport
impl Send for HttpTransport
impl Sync for HttpTransport
impl Unpin for HttpTransport
impl !UnwindSafe for HttpTransport
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