Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(generator): prepare for dynamic query params #14596

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,78 +46,94 @@ DefaultGoldenKitchenSinkRestStub::GenerateAccessToken(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::GenerateAccessTokenRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::test::admin::database::v1::GenerateAccessTokenResponse>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.name(), ":generateAccessToken"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.name(), ":generateAccessToken"), std::move(query_params));
}

StatusOr<google::test::admin::database::v1::GenerateIdTokenResponse>
DefaultGoldenKitchenSinkRestStub::GenerateIdToken(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::GenerateIdTokenRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::test::admin::database::v1::GenerateIdTokenResponse>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "token", ":generate"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "token", ":generate"), std::move(query_params));
}

StatusOr<google::test::admin::database::v1::WriteLogEntriesResponse>
DefaultGoldenKitchenSinkRestStub::WriteLogEntries(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::WriteLogEntriesRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::test::admin::database::v1::WriteLogEntriesResponse>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "entries", ":write"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "entries", ":write"), std::move(query_params));
}

StatusOr<google::test::admin::database::v1::ListLogsResponse>
DefaultGoldenKitchenSinkRestStub::ListLogs(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::ListLogsRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params.push_back({"page_size", std::to_string(request.page_size())});
query_params.push_back({"page_token", request.page_token()});
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Get<google::test::admin::database::v1::ListLogsResponse>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.parent(), "/", "logs"),
rest_internal::TrimEmptyQueryParameters({std::make_pair("page_size", std::to_string(request.page_size())),
std::make_pair("page_token", request.page_token())}));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.parent(), "/", "logs"), std::move(query_params));
}

StatusOr<google::test::admin::database::v1::ListServiceAccountKeysResponse>
DefaultGoldenKitchenSinkRestStub::ListServiceAccountKeys(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::ListServiceAccountKeysRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Get<google::test::admin::database::v1::ListServiceAccountKeysResponse>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.name(), "/", "keys"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.name(), "/", "keys"), std::move(query_params));
}

Status DefaultGoldenKitchenSinkRestStub::DoNothing(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::protobuf::Empty const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::cloud::rest_internal::EmptyResponseType>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "doNothing"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "doNothing"), std::move(query_params));
}

Status DefaultGoldenKitchenSinkRestStub::ExplicitRouting1(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::ExplicitRoutingRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::cloud::rest_internal::EmptyResponseType>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.table_name(), ":explicitRouting1"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.table_name(), ":explicitRouting1"), std::move(query_params));
}

Status DefaultGoldenKitchenSinkRestStub::ExplicitRouting2(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::test::admin::database::v1::ExplicitRoutingRequest const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::cloud::rest_internal::EmptyResponseType>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.table_name(), ":explicitRouting2"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", request.table_name(), ":explicitRouting2"), std::move(query_params));
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ Status DefaultGoldenRestOnlyRestStub::Noop(
google::cloud::rest_internal::RestContext& rest_context,
Options const& options,
google::protobuf::Empty const& request) {
std::vector<std::pair<std::string, std::string>> query_params;
query_params = rest_internal::TrimEmptyQueryParameters(std::move(query_params));
return rest_internal::Post<google::cloud::rest_internal::EmptyResponseType>(
*service_, rest_context, request, false,
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "noop"));
absl::StrCat("/", rest_internal::DetermineApiVersion("v1", options), "/", "noop"), std::move(query_params));
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Loading
Loading