Rust API client for subspaceopenapiclient

Introduction

The Subspace API is based on REST, has resource-oriented URLs, returns JSON-encoded responses, and returns standardHTTP response codes.

The base URL for the API is https://api.subspace.com/

Naming Convention

EARLY ACCESS NOTE: There is no “stable” version yet. Once there is, the version name stable will be used to access the latest stable API version. * Example: https://api.subspace.com/stable * Version name currently in use is: v1 * Example: https://api.subspace.com/v1

Authentication

API Tokens

Subspace authenticates your API requests using JWT Bearer tokens. The provided client library requires this JWT to be set before it can be used, by setting the local access token in the local configuration.

Bearer tokens are granted by requesting one (as noted below) and presenting your publishable (clientid) and secret (clientsecret) tokens.

Subspace provides two types of API tokens: publishable (clientid) and secret (clientsecret). These are available in the Subspace console. * Publishable API tokens (clientid) are meant solely to identify your account with Subspace, they aren’t secret. They can be published in places like your website JavaScript code, or in an iPhone or Android app. * Secret API tokens (clientsecret) should be kept confidential and only stored on your own servers. Your account’s secret API token will allow you to acquire a valid JWT token authorized to perform any API request to Subspace.

Getting a JWT Bearer Token

Subspace uses auth0 for JWT token management. You can acquire a JWT token by utilizing https://id.subspace.com and following the instructions in the curl example below.

Protecting Your API Tokens

Acquiring a valid JWT

Command line example: curl --request POST --url 'https://id.subspace.com/oauth/token' --header 'content-type: application/json' --data '{ \"client_id\": "YOURCLIENTID", "client_secret": "YOURCLIENTSECRET", "audience": "https://api.subspace.com/", "grant_type": "client_credentials" }'

Tips for using the API

Using the library from inside your program use subspace_openapi_client::apis::*;

Configuration:

Set the JWT token, and pass in &my_config on all API calls. let mut my_config = subspace_openapi_client::apis::configuration::Configuration::new(); my_config.oauth_access_token = Some("YOUR_JWT_TOKEN".to_string()); // Example call: let list_accelerators = subspace_openapi_client::apis::accelerator_service_api::accelerator_service_list(&my_config,None,None,None).await;

dependencies.reqwest in Cargo.toml may need to have its features list updated to append "default-tls" or "rustls-tls" to enable your preferred TLS library for HTTPS connections.

Overview

This API client was generated by the OpenAPI Generator project. By using the openapi-spec from a remote server, you can easily generate an API client.

Installation

Put the package under your project folder and add the following to Cargo.toml under [dependencies]:

subspace_openapi_client = { path = "./rust-client" }

Documentation for API Endpoints

All URIs are relative to https://api.subspace.com

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- AcceleratorServiceApi | acceleratorservicecreate | POST /v1/accelerators | CreateAccelerator AcceleratorServiceApi | acceleratorservicedelete | DELETE /v1/accelerators/{id} | DeleteAccelerator AcceleratorServiceApi | acceleratorserviceget | GET /v1/accelerators/{id} | GetAccelerator AcceleratorServiceApi | acceleratorservicelist | GET /v1/accelerators | ListAccelerators AcceleratorServiceApi | acceleratorserviceupdate | PUT /v1/accelerators/{id} | UpdateAccelerator SipTeleportServiceApi | sipteleportservicecreate | POST /v1/sip-teleports | CreateSipTeleport *SipTeleportServiceApi* | sipteleportservicedelete | DELETE /v1/sip-teleports/{id} | DeleteSipTeleport SipTeleportServiceApi | sipteleportserviceget | GET /v1/sip-teleports/{id} | GetSipTeleport *SipTeleportServiceApi* | sipteleportservicelist | GET /v1/sip-teleports | ListSipTeleports SipTeleportServiceApi | sipteleportservice_update | PUT /v1/sip-teleports/{id} | UpdateSipTeleport

Documentation For Models

To get access to the crate's generated documentation, use:

cargo doc --open

Author

sales@subspace.com