Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
29 changes: 29 additions & 0 deletions javascript/net/grpc/web/genericclient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @fileoverview base interface for grpc web GenericClient.
*/

goog.module('grpc.web.GenericClient');
goog.module.declareLegacyNamespace();

const Metadata = goog.require('grpc.web.Metadata');
const MethodDescriptor = goog.require('grpc.web.MethodDescriptor');
const UnaryResponse = goog.require('grpc.web.UnaryResponse');

/**
* @interface
*/
const GenericClient = function() {};


/**
* @param {!REQUEST} request The request proto message
* @param {!MethodDescriptor<REQUEST, RESPONSE>} methodDescriptor Information of
* this RPC method
* @param {!Metadata} metadata The user defined request metadata.
* @return {!Promise<!UnaryResponse<RESPONSE>>} A promise that resolves to the
* response message
* @template REQUEST, RESPONSE
*/
GenericClient.prototype.unaryCall = goog.abstractMethod;

exports = GenericClient;
15 changes: 15 additions & 0 deletions javascript/net/grpc/web/metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @fileoverview grpc-web request/response metadata.
*
* Request and response headers will be included in the Metadata.
*/

goog.module('grpc.web.Metadata');
goog.module.declareLegacyNamespace();

/**
* @typedef {!Object<string,string>}
*/
let Metadata;

exports = Metadata;
25 changes: 25 additions & 0 deletions javascript/net/grpc/web/unaryresponse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @fileoverview gRPC web client UnaryResponse returned the by grpc unary calls.
* It consists of response message and response metadata(headers).
*/

goog.module('grpc.web.UnaryResponse');
goog.module.declareLegacyNamespace();

const Metadata = goog.require('grpc.web.Metadata');

/**
* @constructor
* @struct
* @template RESPONSE
* @param {RESPONSE} message
* @param {!Metadata=} metadata
*/
const UnaryResponse = function(message, metadata) {
/** @const {RESPONSE} */
this.message = message;
/** @const {!Metadata|undefined} */
this.metadata = metadata;
};

exports = UnaryResponse;