跳转至

Api

负责Api请求构造

struct RequestParam

打包的请求参数

struct RequestParam {
    boost::url url;
    http::request<http::string_body> req;
};

class Api

Api类, 用于快速构造请求

fn Api

Api(utils::Session& session,
    std::string module,
    std::string method,
    utils::Credential credential = {},
    nlohmann::json common = {{}})
    : session(session)
    , module(std::move(module))
    , method(std::move(method)){};

fn prepare_request

根据请求参数构造请求

qqmusic::Task<qqmusic::Result<RequestParam>> prepare_request(const nlohmann::json& params);

Cookie

prepare_request函数构造的请求是不带Cookie的, 若需要, 自行添加.

fn parse_response

将回复报文解析成Json对象

qqmusic::Result<nlohmann::json> parse_response(utils::buffer&& response);