/****************************************************************************** * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN */ #include "create_room.h" #include "converters.h" #include using namespace QMatrixClient; static const auto basePath = QStringLiteral("/_matrix/client/r0"); namespace QMatrixClient { // Converters QJsonObject toJson(const CreateRoomJob::Invite3pid& pod) { QJsonObject _json; addToJson<>(_json, "id_server", pod.idServer); addToJson<>(_json, "medium", pod.medium); addToJson<>(_json, "address", pod.address); return _json; } QJsonObject toJson(const CreateRoomJob::StateEvent& pod) { QJsonObject _json; addToJson(_json, "type", pod.type); addToJson(_json, "state_key", pod.stateKey); addToJson(_json, "content", pod.content); return _json; } } // namespace QMatrixClient class CreateRoomJob::Private { public: QString roomId; }; CreateRoomJob::CreateRoomJob(const QString& visibility, const QString& roomAliasName, const QString& name, const QString& topic, const QStringList& invite, const QVector& invite3pid, const QJsonObject& creationContent, const QVector& initialState, const QString& preset, bool isDirect, bool guestCanJoin) : BaseJob(HttpVerb::Post, "CreateRoomJob", basePath % "/createRoom") , d(new Private) { QJsonObject _data; addToJson(_data, "visibility", visibility); addToJson(_data, "room_alias_name", roomAliasName); addToJson(_data, "name", name); addToJson(_data, "topic", topic); addToJson(_data, "invite", invite); addToJson(_data, "invite_3pid", invite3pid); addToJson(_data, "creation_content", creationContent); addToJson(_data, "initial_state", initialState); addToJson(_data, "preset", preset); addToJson(_data, "is_direct", isDirect); addToJson(_data, "guest_can_join", guestCanJoin); setRequestData(_data); } CreateRoomJob::~CreateRoomJob() = default; const QString& CreateRoomJob::roomId() const { return d->roomId; } BaseJob::Status CreateRoomJob::parseJson(const QJsonDocument& data) { auto json = data.object(); d->roomId = fromJson(json.value("room_id")); return Success; }