Mercurial > minori
comparison src/services/anilist.cc @ 228:d030b30526d5
config: remove unused username parameter from anilist auth
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Tue, 09 Jan 2024 08:05:36 -0500 |
| parents | 7cf53145de11 |
| children | c130f47f6f48 |
comparison
equal
deleted
inserted
replaced
| 227:c4f03f83b252 | 228:d030b30526d5 |
|---|---|
| 28 | 28 |
| 29 constexpr int CLIENT_ID = 13706; | 29 constexpr int CLIENT_ID = 13706; |
| 30 | 30 |
| 31 class Account { | 31 class Account { |
| 32 public: | 32 public: |
| 33 std::string Username() const { return session.config.auth.anilist.username; } | |
| 34 void SetUsername(std::string const& username) { session.config.auth.anilist.username = username; } | |
| 35 | |
| 36 int UserId() const { return session.config.auth.anilist.user_id; } | 33 int UserId() const { return session.config.auth.anilist.user_id; } |
| 37 void SetUserId(const int id) { session.config.auth.anilist.user_id = id; } | 34 void SetUserId(const int id) { session.config.auth.anilist.user_id = id; } |
| 38 | 35 |
| 39 std::string AuthToken() const { return session.config.auth.anilist.auth_token; } | 36 std::string AuthToken() const { return session.config.auth.anilist.auth_token; } |
| 40 void SetAuthToken(std::string const& auth_token) { session.config.auth.anilist.auth_token = auth_token; } | 37 void SetAuthToken(std::string const& auth_token) { session.config.auth.anilist.auth_token = auth_token; } |
| 298 | 295 |
| 299 return JSON::GetNumber(ret, "/data/SaveMediaListEntry/id"_json_pointer, 0); | 296 return JSON::GetNumber(ret, "/data/SaveMediaListEntry/id"_json_pointer, 0); |
| 300 } | 297 } |
| 301 | 298 |
| 302 int ParseUser(const nlohmann::json& json) { | 299 int ParseUser(const nlohmann::json& json) { |
| 303 account.SetUsername(JSON::GetString<std::string>(json, "/name"_json_pointer, "")); | |
| 304 account.SetUserId(JSON::GetNumber(json, "/id"_json_pointer, 0)); | 300 account.SetUserId(JSON::GetNumber(json, "/id"_json_pointer, 0)); |
| 305 return account.UserId(); | 301 return account.UserId(); |
| 306 } | 302 } |
| 307 | 303 |
| 308 bool AuthorizeUser() { | 304 bool AuthorizeUser() { |
