An unofficial collection of APIs used in FreeJam games and mods
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

19 行
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. }