Skip to main content

FerriskeySdk

Struct FerriskeySdk 

Source
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:

  1. The transport type is known at compile time
  2. Invalid transport configurations are caught before runtime
  3. 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>

Source

pub const fn new(config: SdkConfig, transport: T) -> Self

Construct a new SDK instance directly.

Prefer using Self::builder() for a more fluent API.

Source

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().

Source

pub const fn config(&self) -> &SdkConfig

Access the SDK configuration.

Source

pub const fn transport(&self) -> &T

Access the underlying transport.

Source

pub const fn operations(&self) -> &'static [GeneratedOperationDescriptor]

Access the full generated operation registry.

Source

pub const fn tag(&self, tag: &'static str) -> TagClient<'_, T>

Access a tag-scoped SDK view.

Source

pub fn operation(&self, operation_id: &str) -> Option<OperationCall<'_, T>>

Resolve a generated operation by its operation ID.

Source

pub fn execute_operation( &self, operation_id: &str, input: OperationInput, ) -> Pin<Box<dyn Future<Output = Result<SdkResponse, SdkError>> + Send + '_>>
where <T as Service<SdkRequest>>::Future: Send,

Execute a generated operation through the canonical SDK request path.

Source

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.

Source

pub fn execute( &self, request: SdkRequest, ) -> Pin<Box<dyn Future<Output = Result<SdkResponse, SdkError>> + Send + '_>>
where <T as Service<SdkRequest>>::Future: Send,

Execute a request through the configured transport.

Uses tower::ServiceExt::oneshot for clean single-request execution.

Source

pub fn execute_json<Output>( &self, request: SdkRequest, expected_status: u16, ) -> Pin<Box<dyn Future<Output = Result<Output, SdkError>> + Send + '_>>
where Output: DeserializeOwned + Send + 'static, <T as Service<SdkRequest>>::Future: 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>

Source§

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

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<T: Debug + Transport + Clone> Debug for FerriskeySdk<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Transport + Clone> SdkExt for FerriskeySdk<T>

Source§

type Transport = T

The transport type for this SDK.
Source§

fn with_transport(config: SdkConfig, transport: T) -> Self

Create an SDK with a fluent one-liner. Read more

Auto Trait Implementations§

§

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

§

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

§

impl<T> Send for FerriskeySdk<T>

§

impl<T> Sync for FerriskeySdk<T>

§

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

§

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

§

impl<T> UnwindSafe for FerriskeySdk<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<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, 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> 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.