2018-03-30 20:08:47 +02:00
|
|
|
/* This file is part of mastodon-cpp.
|
|
|
|
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-03-31 03:28:18 +02:00
|
|
|
#include <jsoncpp/json/json.h>
|
2018-03-30 20:08:47 +02:00
|
|
|
#include "instance.hpp"
|
|
|
|
#include "account.hpp"
|
|
|
|
#include "macros.hpp"
|
|
|
|
|
|
|
|
using namespace Mastodon;
|
|
|
|
using Instance = Easy::Instance;
|
|
|
|
|
|
|
|
Instance::Instance(const string &json)
|
|
|
|
: Entity(json)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Instance::Instance()
|
|
|
|
: Entity()
|
|
|
|
{}
|
|
|
|
|
|
|
|
const Easy::Account Instance::contact_account() const
|
|
|
|
{
|
2018-03-31 03:28:18 +02:00
|
|
|
const Json::Value node = get("contact_account");
|
2018-03-30 20:08:47 +02:00
|
|
|
if (node.isObject())
|
|
|
|
{
|
|
|
|
return Easy::Account(node.toStyledString());
|
|
|
|
}
|
|
|
|
|
|
|
|
ttdebug << "Could not get data: contact_account\n";
|
2018-03-30 20:16:31 +02:00
|
|
|
return Easy::Account();
|
2018-03-30 20:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const string Instance::description() const
|
|
|
|
{
|
|
|
|
return get_string("description");
|
|
|
|
}
|
|
|
|
|
|
|
|
const string Instance::email() const
|
|
|
|
{
|
|
|
|
return get_string("email");
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<string> Instance::languages() const
|
|
|
|
{
|
|
|
|
return get_vector("languages");
|
|
|
|
}
|
|
|
|
|
|
|
|
const string Instance::title() const
|
|
|
|
{
|
|
|
|
return get_string("title");
|
|
|
|
}
|
|
|
|
|
|
|
|
const string Instance::uri() const
|
|
|
|
{
|
|
|
|
return get_string("uri");
|
|
|
|
}
|
|
|
|
|
|
|
|
const string Instance::version() const
|
|
|
|
{
|
|
|
|
return get_string("version");
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<string> Instance::urls() const
|
|
|
|
{
|
|
|
|
return get_vector("urls");
|
|
|
|
}
|