Add option that allows returning also response object from client calls.
I noticed that when using option outputClientImpl=grpc-web the generated client calls return typed protobuf message as typescript type but prevents caller to access response metadata which might also be important to caller.
Would it be possible to add option to generator that exposes response object to the caller ?
Exposing response metadata can be helpful for example when server wants to return pagination info in response trailers.
Current generated client
export interface CategoryService {
CreateCategory(
request: DeepPartial<CreateCategoryRequest>,
metadata?: grpc.Metadata
): Promise<CreateCategoryReply>; // <----- returns only Reply
}
Proposal
export interface CategoryService {
CreateCategory(
request: DeepPartial<CreateCategoryRequest>,
metadata?: grpc.Metadata
): Promise<[CreateCategoryReply, grpc.UnaryOutput<any>]>; // <----- returns also response object
}
By using tuple, callers can easily extract response object via deconstruction
const [message, resp] = serviceClient.CreateCategory({...})
or simply ignore it
const [message] = serviceClient.CreateCategory({...})
Personally I'd be tempted to cheat and assert/nudge the server to return pagination info in-band, instead of as metadata, but otherwise yet-another-option to generate this style of output sounds fine.