Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Add generated types for each LRO response #40

Open
michaelbausor opened this issue Apr 24, 2019 · 0 comments
Open

Add generated types for each LRO response #40

michaelbausor opened this issue Apr 24, 2019 · 0 comments
Assignees

Comments

@michaelbausor
Copy link
Contributor

For each LRO rpc e.g.

rpc GetBigFoo(GetBigFooRequest) returns (google.longrunning.Operation)

generate a using statement for the gax::Operation response in the client and use it in the generated method. E.g.:

using GetBigFooOperation = gax::Operation<Foo, FooMeta>;

This turns this code:

gax::StatusOr<gax::Operation<Foo, FooMeta>> res = client.GetBigFoo(getBigFooRequest);
if (res) {
  gax::Operation<Foo, FooMeta> op = *std::move(res);
}

into this:

gax::StatusOr<GetBigFooOperation> res = client.GetBigFoo(getBigFooRequest);
if (res) {
  GetBigFooOperation op = *std::move(res);
}

This is not only a saving of characters typed, but also ties together the two parameters (result and metadata type) into a single type that describes a particular operation. These parameters and not mix-and-matchable, so it makes sense to treat each possible LRO response as a unit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants