@@ -140,6 +140,22 @@ client::OlpClient::RequestBodyType GenerateAppleSignInBody(
140140 return std::make_shared<RequestBodyData>(content, content + data.GetSize ());
141141}
142142
143+ std::string GenerateBearerHeader (const std::string& bearer_token) {
144+ return std::string (http::kBearer + std::string (" " ) + bearer_token);
145+ }
146+
147+ client::HttpResponse CallApi (const client::OlpClient& client,
148+ const std::string& endpoint,
149+ client::CancellationContext context,
150+ const std::string& auth_header,
151+ client::OlpClient::RequestBodyType body) {
152+ client::OlpClient::ParametersType headers{
153+ {http::kAuthorizationHeader , auth_header}};
154+
155+ return client.CallApi (endpoint, " POST" , {}, std::move (headers), {},
156+ std::move (body), kApplicationJson , std::move (context));
157+ }
158+
143159} // namespace
144160
145161AuthenticationClientImpl::RequestTimer::RequestTimer ()
@@ -187,17 +203,6 @@ olp::client::HttpResponse AuthenticationClientImpl::CallAuth(
187203 std::move (body), kApplicationJson , std::move (context));
188204}
189205
190- olp::client::HttpResponse AuthenticationClientImpl::CallAuth (
191- const client::OlpClient& client, const std::string& endpoint,
192- client::CancellationContext context, const std::string& auth_header,
193- client::OlpClient::RequestBodyType body) {
194- client::OlpClient::ParametersType headers{
195- {http::kAuthorizationHeader , auth_header}};
196-
197- return client.CallApi (endpoint, " POST" , {}, std::move (headers), {},
198- std::move (body), kApplicationJson , std::move (context));
199- }
200-
201206SignInResult AuthenticationClientImpl::ParseAuthResponse (
202207 int status, std::stringstream& auth_response) {
203208 auto document = std::make_shared<rapidjson::Document>();
@@ -435,8 +440,8 @@ client::CancellationToken AuthenticationClientImpl::SignInApple(
435440
436441 client::OlpClient client = CreateOlpClient (settings_, boost::none);
437442
438- auto auth_response = CallAuth (client, kOauthEndpoint , context,
439- properties.GetAccessToken (), request_body);
443+ auto auth_response = CallApi (client, kOauthEndpoint , context,
444+ properties.GetAccessToken (), request_body);
440445
441446 auto status = auth_response.GetStatus ();
442447 if (status < 0 ) {
@@ -837,13 +842,6 @@ client::CancellationToken AuthenticationClientImpl::GetMyAccount(
837842 std::move (callback));
838843}
839844
840- std::string AuthenticationClientImpl::GenerateBearerHeader (
841- const std::string& bearer_token) {
842- std::string authorization = http::kBearer + std::string (" " );
843- authorization += bearer_token;
844- return authorization;
845- }
846-
847845client::OlpClient::RequestBodyType AuthenticationClientImpl::GenerateClientBody (
848846 const SignInProperties& properties) {
849847 rapidjson::StringBuffer data;
@@ -1041,7 +1039,8 @@ AuthenticationClientImpl::GenerateAcceptTermBody(
10411039}
10421040
10431041client::OlpClient::RequestBodyType
1044- AuthenticationClientImpl::GenerateAuthorizeBody (AuthorizeRequest properties) {
1042+ AuthenticationClientImpl::GenerateAuthorizeBody (
1043+ const AuthorizeRequest& properties) {
10451044 rapidjson::StringBuffer data;
10461045 rapidjson::Writer<rapidjson::StringBuffer> writer (data);
10471046 writer.StartObject ();
0 commit comments