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:
kdeng00
2022-01-21 22:59:17 -05:00
parent c108c868bf
commit ee53380cd5
3 changed files with 35 additions and 8 deletions
+27 -6
View File
@@ -6,13 +6,28 @@
namespace Models namespace Models
{ {
template<typename Str = std::string>
class SpotifyVendorBase
{
protected:
void vendorInitialize()
{
disclaimer.assign("By Spotify");
}
Str disclaimer;
};
template<typename Str = std::string, template<typename Str = std::string,
typename Num = int, typename Num = int,
typename Dur = long> typename Dur = long>
class Song class Song : public SpotifyVendorBase<Str>
{ {
public: public:
Song() = default; Song()
{
vendorInitialize();
}
Str title; Str title;
Str artist; Str artist;
@@ -23,10 +38,13 @@ namespace Models
template<typename Str = std::string, template<typename Str = std::string,
typename Num = int> typename Num = int>
class Album class Album : public SpotifyVendorBase<Str>
{ {
public: public:
Album() = default; Album()
{
vendorInitialize();
}
Str title; Str title;
Str released; Str released;
@@ -61,14 +79,17 @@ namespace Models
class TokenResp class TokenResp
{ {
public: 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 access_token;
Str token_type; Str token_type;
Num expires_in; Num expires_in;
// Not being used as of 2022-01-21
[[deprecated("This field will not be used")]]
Str scope; Str scope;
}; };
} }
+7 -2
View File
@@ -37,8 +37,13 @@ namespace Manager
auto token = make_call<TokResp>(); 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.access_token = token["access_token"].get<Str>();
resp.token_type = token["token_type"].get<Str>(); resp.token_type = token["token_type"].get<Str>();
resp.expires_in = token["expires_in"].get<int>(); resp.expires_in = token["expires_in"].get<int>();
resp.scope = token["scope"].get<Str>(); // resp.scope = token["scope"].get<Str>();
} }
+1
View File
@@ -2,6 +2,7 @@
// //
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <memory>
#include <sstream> #include <sstream>
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>