pub struct CodesClient { /* private fields */ }Implementations§
Source§impl CodesClient
impl CodesClient
Sourcepub fn new(api_key: Option<ApiKey>) -> Self
pub fn new(api_key: Option<ApiKey>) -> Self
Construct a new CodesClient providing an optional API key
If no values need to ever change - or if the write feature is always disabled,
consider using default instead.
Sourcepub fn new_full(
api_key: Option<ApiKey>,
base_url: Option<String>,
client: Option<Client>,
) -> Self
pub fn new_full( api_key: Option<ApiKey>, base_url: Option<String>, client: Option<Client>, ) -> Self
Construct a new CodesClient, optionally providing an API Key.
If left to None, default values will be used.
If no values need to change, consider using default instead.
Sourcepub async fn get(&self, route: &str) -> Result<String, ClientError>
pub async fn get(&self, route: &str) -> Result<String, ClientError>
Perform any arbitrary GET request and take ownership of deserializing the response.
Sourcepub async fn get_codes(&self) -> Result<Vec<Code>, ClientError>
pub async fn get_codes(&self) -> Result<Vec<Code>, ClientError>
Query HTTP GET /api/v1/codes and deserialize the response.
This is useful if you need the code itself, and the meta-information. All Optional fields will try to have values, unless they were not provided by the remote.
If you only need the code and the expiry information, use get_codes_slim instead.
Sourcepub async fn get_codes_slim(&self) -> Result<Vec<Code>, ClientError>
pub async fn get_codes_slim(&self) -> Result<Vec<Code>, ClientError>
Query HTTP GET /api/v1/codes and deserialize the response, returning a slim subset including only essential data.
This is useful if you only need the code itself, and not the meta-information. All Optional fields will be None.
If you need the code and the meta-information, use get_codes instead.