pub struct Client { /* private fields */ }Expand description
Entrypoint for interacting with the API client.
Implementations§
source§impl Client
impl Client
sourcepub fn new_from_reqwest<T>(
token: T,
builder_http: ClientBuilder,
builder_websocket: ClientBuilder
) -> Selfwhere
T: ToString + Debug,
pub fn new_from_reqwest<T>( token: T, builder_http: ClientBuilder, builder_websocket: ClientBuilder ) -> Selfwhere T: ToString + Debug,
Create a new Client struct. It takes a type that can convert into
an &str (String or Vec<u8> for example). As long as the function is
given a valid API key your requests will work.
Also takes reqwest client builders, for customizing the client’s behaviour.
sourcepub fn new<T>(token: T) -> Selfwhere
T: ToString + Debug,
pub fn new<T>(token: T) -> Selfwhere T: ToString + Debug,
Create a new Client struct. It takes a type that can convert into
an &str (String or Vec<u8> for example). As long as the function is
given a valid API key your requests will work.
sourcepub fn set_base_url<H>(&mut self, base_url: H)where
H: Into<String> + Display + Debug,
pub fn set_base_url<H>(&mut self, base_url: H)where H: Into<String> + Display + Debug,
Set the base URL for the client to something other than the default: https://api.kittycad.io.
sourcepub fn new_from_env() -> Self
pub fn new_from_env() -> Self
Create a new Client struct from the environment variable: KITTYCAD_API_TOKEN.
sourcepub async fn request_raw(
&self,
method: Method,
uri: &str,
body: Option<Body>
) -> Result<RequestBuilder>
pub async fn request_raw( &self, method: Method, uri: &str, body: Option<Body> ) -> Result<RequestBuilder>
Create a raw request to our API.
sourcepub fn api_calls(&self) -> ApiCalls
pub fn api_calls(&self) -> ApiCalls
API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing.
sourcepub fn api_tokens(&self) -> ApiTokens
pub fn api_tokens(&self) -> ApiTokens
API tokens allow users to call the API outside of their session token that is used as a cookie in the user interface. Users can create, delete, and list their API tokens. But, of course, you need an API token to do this, so first be sure to generate one in the account UI.
sourcepub fn executor(&self) -> Executor
pub fn executor(&self) -> Executor
Endpoints that allow for code execution or creation of code execution environments.
sourcepub fn file(&self) -> File
pub fn file(&self) -> File
CAD file operations. Create, get, and list CAD file conversions. More endpoints will be added here in the future as we build out transforms, etc on CAD models.
Hidden API endpoints that should not show up in the docs.
sourcepub fn modeling(&self) -> Modeling
pub fn modeling(&self) -> Modeling
Modeling API for updating your 3D files using the KittyCAD engine.