1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
6 #include "remote/i2-remote.hpp"
7 #include "base/object.hpp"
8 #include "base/string.hpp"
9 #include "base/array.hpp"
10 #include "base/value.hpp"
19 * A url class to use with the API
23 class Url final : public Object
26 DECLARE_PTR_TYPEDEFS(Url);
29 Url(const String& url);
31 String Format(bool onlyPathAndQuery = false, bool printCredentials = false) const;
33 String GetScheme() const;
34 String GetAuthority() const;
35 String GetUsername() const;
36 String GetPassword() const;
37 String GetHost() const;
38 String GetPort() const;
39 const std::vector<String>& GetPath() const;
40 const std::vector<std::pair<String, String>>& GetQuery() const;
41 String GetFragment() const;
43 void SetScheme(const String& scheme);
44 void SetUsername(const String& username);
45 void SetPassword(const String& password);
46 void SetHost(const String& host);
47 void SetPort(const String& port);
48 void SetPath(const std::vector<String>& path);
49 void SetQuery(const std::vector<std::pair<String, String>>& query);
50 void SetArrayFormatUseBrackets(bool useBrackets = true);
52 void AddQueryElement(const String& name, const String& query);
53 void SetFragment(const String& fragment);
61 std::vector<String> m_Path;
62 std::vector<std::pair<String, String>> m_Query;
63 bool m_ArrayFormatUseBrackets;
66 bool ParseScheme(const String& scheme);
67 bool ParseAuthority(const String& authority);
68 bool ParseUserinfo(const String& userinfo);
69 bool ParsePort(const String& port);
70 bool ParsePath(const String& path);
71 bool ParseQuery(const String& query);
72 bool ParseFragment(const String& fragment);
74 static bool ValidateToken(const String& token, const String& symbols);