Saving changes
Might shift focus away from c++. In order to retrieve user playlist data, the Authorization Code Token process flow must be used which requests an agreement via a url. This is the stuff JavaScript was made for
This commit is contained in:
@@ -6,13 +6,28 @@
|
||||
|
||||
namespace Models
|
||||
{
|
||||
template<typename Str = std::string>
|
||||
class SpotifyVendorBase
|
||||
{
|
||||
protected:
|
||||
void vendorInitialize()
|
||||
{
|
||||
disclaimer.assign("By Spotify");
|
||||
}
|
||||
|
||||
Str disclaimer;
|
||||
};
|
||||
|
||||
template<typename Str = std::string,
|
||||
typename Num = int,
|
||||
typename Dur = long>
|
||||
class Song
|
||||
class Song : public SpotifyVendorBase<Str>
|
||||
{
|
||||
public:
|
||||
Song() = default;
|
||||
Song()
|
||||
{
|
||||
vendorInitialize();
|
||||
}
|
||||
|
||||
Str title;
|
||||
Str artist;
|
||||
@@ -23,10 +38,13 @@ namespace Models
|
||||
|
||||
template<typename Str = std::string,
|
||||
typename Num = int>
|
||||
class Album
|
||||
class Album : public SpotifyVendorBase<Str>
|
||||
{
|
||||
public:
|
||||
Album() = default;
|
||||
Album()
|
||||
{
|
||||
vendorInitialize();
|
||||
}
|
||||
|
||||
Str title;
|
||||
Str released;
|
||||
@@ -61,14 +79,17 @@ namespace Models
|
||||
class TokenResp
|
||||
{
|
||||
public:
|
||||
auto is_empty()
|
||||
auto is_empty() noexcept
|
||||
{
|
||||
return this->access_token.empty();
|
||||
auto result = this->access_token.empty();
|
||||
return result;
|
||||
}
|
||||
|
||||
Str access_token;
|
||||
Str token_type;
|
||||
Num expires_in;
|
||||
// Not being used as of 2022-01-21
|
||||
[[deprecated("This field will not be used")]]
|
||||
Str scope;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,8 +37,13 @@ namespace Manager
|
||||
|
||||
auto token = make_call<TokResp>();
|
||||
|
||||
if (token.is_empty())
|
||||
{
|
||||
return TokResp();
|
||||
}
|
||||
|
||||
return (token.is_empty()) ? TokResp() : token;
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +68,7 @@ namespace Manager
|
||||
resp.access_token = token["access_token"].get<Str>();
|
||||
resp.token_type = token["token_type"].get<Str>();
|
||||
resp.expires_in = token["expires_in"].get<int>();
|
||||
resp.scope = token["scope"].get<Str>();
|
||||
// resp.scope = token["scope"].get<Str>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
//
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
Reference in New Issue
Block a user