// SPDX-FileCopyrightText: 2023 Yury Gubich // SPDX-License-Identifier: GPL-3.0-or-later #include "session.h" #include "handler/poll.h" Session::Session(unsigned int id, const std::string& access, const std::string& renew): id(id), access(access), renew(renew), polling(nullptr) {} std::string Session::getAccessToken() const { return access; } std::string Session::getRenewToken() const { return renew; } void Session::accept(std::unique_ptr request) { if (polling) { Response& res = request->createResponse(Response::Status::ok); nlohmann::json body = nlohmann::json::object(); body["result"] = Handler::Poll::Result::replace; res.setBody(body); res.send(); } polling = std::move(request); }