pub struct IriClient { /* private fields */ }Expand description
OpenAPI-backed blocking operation client.
See also IriClient for the async variant.
Async IRI API client backed by the OpenAPI operation registry.
Use this when you want to call endpoints via operation_id rather than
hard-coded URL paths.
Implementations§
Source§impl IriClient
impl IriClient
Sourcepub fn new(base_url: impl AsRef<str>) -> Result<Self, ClientError>
pub fn new(base_url: impl AsRef<str>) -> Result<Self, ClientError>
Creates a client with an explicit base URL.
Sourcepub fn from_openapi_default_server() -> Result<Self, ClientError>
pub fn from_openapi_default_server() -> Result<Self, ClientError>
Creates a client using the first server URL from the OpenAPI spec.
Returns a new client with a raw access token attached to all requests.
This sets Authorization: <token> (without Bearer prefix).
Sourcepub fn operations() -> &'static [OperationDefinition]
pub fn operations() -> &'static [OperationDefinition]
Returns all operations discovered from the OpenAPI spec.
Sourcepub async fn request_json_with_query(
&self,
method: Method,
path: &str,
query: &[(&str, &str)],
body: Option<Value>,
) -> Result<Value, ClientError>
pub async fn request_json_with_query( &self, method: Method, path: &str, query: &[(&str, &str)], body: Option<Value>, ) -> Result<Value, ClientError>
Sends a request using a raw path and method.
This bypasses operation-id lookup but keeps IRI client configuration.
Sourcepub async fn call_operation(
&self,
operation_id: &str,
path_params: &[(&str, &str)],
query: &[(&str, &str)],
body: Option<Value>,
) -> Result<Value, ClientError>
pub async fn call_operation( &self, operation_id: &str, path_params: &[(&str, &str)], query: &[(&str, &str)], body: Option<Value>, ) -> Result<Value, ClientError>
Calls an endpoint by OpenAPI operation_id.
path_params replaces {param} segments in the operation path template.
Missing required parameters return
ClientError::MissingPathParameter.