diff --git a/SpotifyDemo/include/Models.h b/SpotifyDemo/include/Models.h index a1e76dd..00ef033 100644 --- a/SpotifyDemo/include/Models.h +++ b/SpotifyDemo/include/Models.h @@ -6,13 +6,28 @@ namespace Models { + template + class SpotifyVendorBase + { + protected: + void vendorInitialize() + { + disclaimer.assign("By Spotify"); + } + + Str disclaimer; + }; + template - class Song + class Song : public SpotifyVendorBase { public: - Song() = default; + Song() + { + vendorInitialize(); + } Str title; Str artist; @@ -23,10 +38,13 @@ namespace Models template - class Album + class Album : public SpotifyVendorBase { 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; }; } diff --git a/SpotifyDemo/include/TokenRetrieval.hpp b/SpotifyDemo/include/TokenRetrieval.hpp index c707190..eeadb4c 100644 --- a/SpotifyDemo/include/TokenRetrieval.hpp +++ b/SpotifyDemo/include/TokenRetrieval.hpp @@ -37,8 +37,13 @@ namespace Manager auto token = make_call(); + 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(); resp.token_type = token["token_type"].get(); resp.expires_in = token["expires_in"].get(); - resp.scope = token["scope"].get(); + // resp.scope = token["scope"].get(); } diff --git a/SpotifyDemo/src/SpotifyDemo.cpp b/SpotifyDemo/src/SpotifyDemo.cpp index 6ffc877..e706bbb 100644 --- a/SpotifyDemo/src/SpotifyDemo.cpp +++ b/SpotifyDemo/src/SpotifyDemo.cpp @@ -2,6 +2,7 @@ // #include #include +#include #include #include #include