AccessKeyFetcher.h 748 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <functional>
  3. #include <memory>
  4. #include "CSpotContext.h"
  5. #include "Utils.h"
  6. namespace cspot {
  7. class AccessKeyFetcher {
  8. public:
  9. AccessKeyFetcher(std::shared_ptr<cspot::Context> ctx);
  10. ~AccessKeyFetcher();
  11. typedef std::function<void(std::string)> Callback;
  12. void getAccessKey(Callback callback);
  13. private:
  14. const std::string CLIENT_ID =
  15. "65b708073fc0480ea92a077233ca87bd"; // Spotify web client's client id
  16. const std::string SCOPES =
  17. "streaming,user-library-read,user-library-modify,user-top-read,user-read-"
  18. "recently-played"; // Required access scopes
  19. std::shared_ptr<cspot::Context> ctx;
  20. bool isExpired();
  21. std::string accessKey;
  22. long long int expiresAt;
  23. };
  24. } // namespace cspot