add more tips ops
diff --git a/examples/tips/client.cc b/examples/tips/client.cc
index 695ff80..f9d5319 100644
--- a/examples/tips/client.cc
+++ b/examples/tips/client.cc
@@ -36,7 +36,11 @@
#include "examples/tips/client.h"
using tech::pubsub::Topic;
+using tech::pubsub::DeleteTopicRequest;
+using tech::pubsub::GetTopicRequest;
using tech::pubsub::PublisherService;
+using tech::pubsub::ListTopicsRequest;
+using tech::pubsub::ListTopicsResponse;
namespace grpc {
namespace examples {
@@ -55,6 +59,34 @@
return stub_->CreateTopic(&context, request, &response);
}
+Status Client::ListTopics() {
+ ListTopicsRequest request;
+ ListTopicsResponse response;
+ ClientContext context;
+
+ return stub_->ListTopics(&context, request, &response);
+}
+
+Status Client::GetTopic(grpc::string topic) {
+ GetTopicRequest request;
+ Topic response;
+ ClientContext context;
+
+ request.set_topic(topic);
+
+ return stub_->GetTopic(&context, request, &response);
+}
+
+Status Client::DeleteTopic(grpc::string topic) {
+ DeleteTopicRequest request;
+ proto2::Empty response;
+ ClientContext context;
+
+ request.set_topic(topic);
+
+ return stub_->DeleteTopic(&context, request, &response);
+}
+
} // namespace tips
} // namespace examples
} // namespace grpc
diff --git a/examples/tips/client.h b/examples/tips/client.h
index 6ae9d50..661ee5c 100644
--- a/examples/tips/client.h
+++ b/examples/tips/client.h
@@ -47,6 +47,9 @@
public:
Client(std::shared_ptr<grpc::ChannelInterface> channel);
Status CreateTopic(grpc::string topic);
+ Status GetTopic(grpc::string topic);
+ Status DeleteTopic(grpc::string topic);
+ Status ListTopics();
private:
std::unique_ptr<tech::pubsub::PublisherService::Stub> stub_;
diff --git a/examples/tips/client_main.cc b/examples/tips/client_main.cc
index b4adde2..041dbd5 100644
--- a/examples/tips/client_main.cc
+++ b/examples/tips/client_main.cc
@@ -97,8 +97,17 @@
creds));
grpc::examples::tips::Client client(channel);
- grpc::Status s = client.CreateTopic("test");
- gpr_log(GPR_INFO, "return code %d", s.code());
+
+ grpc::Status s = client.CreateTopic("/topics/stoked-keyword-656/testtopics");
+ gpr_log(GPR_INFO, "return code %d, %s", s.code(), s.details().c_str());
+ GPR_ASSERT(s.IsOk());
+
+ s = client.GetTopic("/topics/stoked-keyword-656/testtopics");
+ gpr_log(GPR_INFO, "return code %d, %s", s.code(), s.details().c_str());
+ GPR_ASSERT(s.IsOk());
+
+ s = client.DeleteTopic("/topics/stoked-keyword-656/testtopics");
+ gpr_log(GPR_INFO, "return code %d, %s", s.code(), s.details().c_str());
GPR_ASSERT(s.IsOk());
channel.reset();