Rename Request() to Send().

This commit is contained in:
Chunting Gu
2019-08-26 12:13:25 +08:00
parent 1a21989b2e
commit ad1016734e
10 changed files with 196 additions and 236 deletions
+12 -17
View File
@@ -55,9 +55,8 @@ void PrettyPrintJsonString(const std::string& str) {
// List public events.
void ListEvents(webcc::ClientSession& session) {
try {
auto r = session.Request(webcc::RequestBuilder{}.
Get(kUrlRoot).Path("events")
());
auto r = session.Send(webcc::RequestBuilder{}.Get(kUrlRoot).Path("events")
());
PRINT_JSON_STRING(r->data());
@@ -71,10 +70,9 @@ void ListEvents(webcc::ClientSession& session) {
// ListUserFollowers(session, "<user>")
void ListUserFollowers(webcc::ClientSession& session, const std::string& user) {
try {
auto r = session.Request(webcc::RequestBuilder{}.
Get(kUrlRoot).Path("users").Path(user).
Path("followers")
());
auto r = session.Send(webcc::RequestBuilder{}.Get(kUrlRoot).
Path("users").Path(user).Path("followers")
());
PRINT_JSON_STRING(r->data());
@@ -90,10 +88,9 @@ void ListAuthUserFollowers(webcc::ClientSession& session,
const std::string& login,
const std::string& password) {
try {
auto r = session.Request(webcc::RequestBuilder{}.
Get(kUrlRoot).Path("user/followers").
AuthBasic(login, password)
());
auto r = session.Send(webcc::RequestBuilder{}.Get(kUrlRoot).
Path("user/followers").AuthBasic(login, password)
());
PRINT_JSON_STRING(r->data());
@@ -112,12 +109,10 @@ void CreateAuthorization(webcc::ClientSession& session,
" 'scopes': ['public_repo', 'repo', 'repo:status', 'user']\n"
"}";
auto r = session.Request(webcc::RequestBuilder{}.
Post(kUrlRoot).Path("authorizations").
Body(std::move(data)).
Json().Utf8().
AuthBasic(login, password)
());
auto r = session.Send(webcc::RequestBuilder{}.Post(kUrlRoot).
Path("authorizations").AuthBasic(login, password).
Body(std::move(data)).Json().Utf8()
());
std::cout << r->data() << std::endl;