An unofficial collection of APIs used in FreeJam games and mods
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
418B

  1. use crate::robocraft::{DEFAULT_TOKEN};
  2. /// Token generator for authenticated API endpoints
  3. pub trait ITokenProvider {
  4. /// Retrieve the token to use
  5. fn token(&self) -> Result<String, ()>;
  6. }
  7. /// Token provider which uses DEFAULT_TOKEN
  8. pub struct DefaultTokenProvider {
  9. }
  10. impl ITokenProvider for DefaultTokenProvider {
  11. fn token(&self) -> Result<String, ()> {
  12. Ok(DEFAULT_TOKEN.to_string())
  13. }
  14. }