pub struct FerriskeySdk<T: Transport + Clone> { /* private fields */ }Expand description
FerrisKey SDK entrypoint parameterized by a transport implementation.
§Type-Driven Design
The generic parameter T: Transport ensures that:
- The transport type is known at compile time
- Invalid transport configurations are caught before runtime
- The compiler can optimize based on the concrete transport type
§Builder Pattern
Use FerriskeySdk::builder() for a fluent, type-safe construction:
use ferriskey_sdk::{AuthStrategy, FerriskeySdk, HpxTransport, SdkConfig};
let config = SdkConfig::new("https://api.example.com", AuthStrategy::None);
let sdk = FerriskeySdk::builder(config).transport(HpxTransport::default()).build();Implementations§
Source§impl<T: Transport + Clone> FerriskeySdk<T>
impl<T: Transport + Clone> FerriskeySdk<T>
Sourcepub const fn new(config: SdkConfig, transport: T) -> Self
pub const fn new(config: SdkConfig, transport: T) -> Self
Construct a new SDK instance directly.
Prefer using Self::builder() for a more fluent API.
Sourcepub const fn builder(config: SdkConfig) -> FerriskeySdkBuilder<T, Unconfigured>
pub const fn builder(config: SdkConfig) -> FerriskeySdkBuilder<T, Unconfigured>
Create a typed builder with the required configuration.
The builder ensures the transport is set before calling .build().
Sourcepub const fn operations(&self) -> &'static [GeneratedOperationDescriptor]
pub const fn operations(&self) -> &'static [GeneratedOperationDescriptor]
Access the full generated operation registry.
Sourcepub fn operation(&self, operation_id: &str) -> Option<OperationCall<'_, T>>
pub fn operation(&self, operation_id: &str) -> Option<OperationCall<'_, T>>
Resolve a generated operation by its operation ID.
Sourcepub fn execute_operation(
&self,
operation_id: &str,
input: OperationInput,
) -> Pin<Box<dyn Future<Output = Result<SdkResponse, SdkError>> + Send + '_>>
pub fn execute_operation( &self, operation_id: &str, input: OperationInput, ) -> Pin<Box<dyn Future<Output = Result<SdkResponse, SdkError>> + Send + '_>>
Execute a generated operation through the canonical SDK request path.
Sourcepub fn prepare_request(
&self,
request: SdkRequest,
) -> Result<SdkRequest, SdkError>
pub fn prepare_request( &self, request: SdkRequest, ) -> Result<SdkRequest, SdkError>
Prepare a request by resolving its URL and applying auth.
§Design Decision: Result Type
Returns Result<SdkRequest, SdkError> rather than panicking,
enabling callers to handle configuration errors gracefully.
Sourcepub fn execute(
&self,
request: SdkRequest,
) -> Pin<Box<dyn Future<Output = Result<SdkResponse, SdkError>> + Send + '_>>
pub fn execute( &self, request: SdkRequest, ) -> Pin<Box<dyn Future<Output = Result<SdkResponse, SdkError>> + Send + '_>>
Execute a request through the configured transport.
Uses tower::ServiceExt::oneshot for clean single-request execution.
Sourcepub fn execute_json<Output>(
&self,
request: SdkRequest,
expected_status: u16,
) -> Pin<Box<dyn Future<Output = Result<Output, SdkError>> + Send + '_>>
pub fn execute_json<Output>( &self, request: SdkRequest, expected_status: u16, ) -> Pin<Box<dyn Future<Output = Result<Output, SdkError>> + Send + '_>>
Execute a request and decode a JSON response for the expected status.
Trait Implementations§
Source§impl<T: Clone + Transport + Clone> Clone for FerriskeySdk<T>
impl<T: Clone + Transport + Clone> Clone for FerriskeySdk<T>
Source§fn clone(&self) -> FerriskeySdk<T>
fn clone(&self) -> FerriskeySdk<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more