Subsonic API: better compability with clients

This commit is contained in:
emeric
2021-09-24 12:37:54 +02:00
parent 5aa0e835cd
commit 828e2364a7
17 changed files with 405 additions and 204 deletions
+5 -6
View File
@@ -27,8 +27,6 @@
#include "RequestContext.hpp"
#define API_VERSION_MAJOR 1
namespace API::Subsonic
{
@@ -205,6 +203,9 @@ class Response
void addArrayChild(const std::string& key, Node node);
private:
void setVersionAttribute(ProtocolVersion version);
friend class Response;
using Value = std::variant<std::string, bool, long long>;
std::map<std::string, Value> _attributes;
@@ -213,8 +214,8 @@ class Response
std::map<std::string, std::vector<Node>> _childrenArrays;
};
static Response createOkResponse(const RequestContext& context);
static Response createFailedResponse(std::string_view clientName, const Error& error);
static Response createOkResponse(ProtocolVersion protocolVersion);
static Response createFailedResponse(ProtocolVersion protocolVersion, const Error& error);
virtual ~Response() {}
Response(const Response&) = delete;
@@ -228,9 +229,7 @@ class Response
void write(std::ostream& os, ResponseFormat format);
static unsigned getAPIMinorVersion(std::string_view clientName);
private:
void writeJSON(std::ostream& os);
void writeXML(std::ostream& os);