Struct seaplane_cli::api::FormationsReq
source · pub struct FormationsReq { /* private fields */ }Expand description
Wraps an SDK FormationsRequest where we do additional things like re-use request access
tokens, allow changing the Formation this request is pointed to, and map errors appropriately.
Implementations§
source§impl FormationsReq
impl FormationsReq
sourcepub fn new<S: AsRef<str>>(ctx: &Ctx, oid: Option<S>) -> Result<Self>
pub fn new<S: AsRef<str>>(ctx: &Ctx, oid: Option<S>) -> Result<Self>
Builds a FormationsRequest and immediately requests an access token using the given API key.
If the oid is None it should be noted that not all requests can be made without
error. At present only is FormationsRequest::create and
FormationsRequest::get_all_formations
sourcepub fn new_delay_token(ctx: &Ctx) -> Result<Self>
pub fn new_delay_token(ctx: &Ctx) -> Result<Self>
Builds a FormationsRequest but does not request an access token using the given API key.
You must call refresh_token to have the access token requested.
sourcepub fn refresh_token(&mut self) -> Result<()>
pub fn refresh_token(&mut self) -> Result<()>
Request a new Access Token
sourcepub fn token_or_refresh(&mut self) -> Result<&str>
pub fn token_or_refresh(&mut self) -> Result<&str>
Retrieves the JWT access token, requesting a new one if required.
sourcepub fn set_id_str<S: AsRef<str>>(&mut self, oid: S) -> Result<()>
pub fn set_id_str<S: AsRef<str>>(&mut self, oid: S) -> Result<()>
Sets the Formation ID and re-builds the inner FormationsRequest also requesting a new access token if required
sourcepub fn set_id(&mut self, oid: FormationId) -> Result<()>
pub fn set_id(&mut self, oid: FormationId) -> Result<()>
Sets the Formation ID and re-builds the inner FormationsRequest also requesting a new access token if required