pub struct Client { /* private fields */ }Expand description
A client for the FoPost API.
let client = fopost::Client::new("fp_…")?;
let workspaces = client.workspaces().list().await?;Cloning is cheap — the underlying connection pool is shared — so pass a
Client around rather than building one per request.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: impl Into<String>) -> Result<Self>
pub fn new(api_key: impl Into<String>) -> Result<Self>
A client with the defaults: the production API, a 30 second timeout, and up to three attempts when the rate limiter or a gateway says to back off.
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Start configuring a client: base url, timeout, retries, or your own
reqwest::Client.
Sourcepub fn workspaces(&self) -> Workspaces<'_>
pub fn workspaces(&self) -> Workspaces<'_>
Workspaces.
Sourcepub fn automations(&self) -> Automations<'_>
pub fn automations(&self) -> Automations<'_>
Automations and their runs.
Sourcepub async fn request<B: Serialize + ?Sized>(
&self,
method: Method,
path: &str,
query: Option<Vec<(&'static str, String)>>,
body: Option<&B>,
) -> Result<Value>
pub async fn request<B: Serialize + ?Sized>( &self, method: Method, path: &str, query: Option<Vec<(&'static str, String)>>, body: Option<&B>, ) -> Result<Value>
Call an endpoint the SDK does not wrap yet, with the auth, retries, and error handling every other call gets. Returns the raw JSON body.
let spec = client
.request(reqwest::Method::GET, "/openapi.json", None, None::<&()>)
.await?;Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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