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

grpc-native-support #296

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Binary file added .DS_Store
Binary file not shown.
Binary file added examples/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// package: examplecom
// file: proto/examplecom/annotations.proto

import * as jspb from "google-protobuf";

export class AnnotatedMessage extends jspb.Message {
getMyunit64(): string;
setMyunit64(value: string): void;

getMyint64(): string;
setMyint64(value: string): void;

getMyfixed64(): string;
setMyfixed64(value: string): void;

getMysint64(): string;
setMysint64(value: string): void;

getMysfixed64(): string;
setMysfixed64(value: string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AnnotatedMessage.AsObject;
static toObject(includeInstance: boolean, msg: AnnotatedMessage): AnnotatedMessage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AnnotatedMessage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AnnotatedMessage;
static deserializeBinaryFromReader(message: AnnotatedMessage, reader: jspb.BinaryReader): AnnotatedMessage;
}

export namespace AnnotatedMessage {
export type AsObject = {
myunit64: string,
myint64: string,
myfixed64: string,
mysint64: string,
mysfixed64: string,
}
}

290 changes: 290 additions & 0 deletions examples/generated-grpc-native/proto/examplecom/annotations_pb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
// source: proto/examplecom/annotations.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck

var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();

goog.exportSymbol('proto.examplecom.AnnotatedMessage', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.examplecom.AnnotatedMessage = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.examplecom.AnnotatedMessage, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.examplecom.AnnotatedMessage.displayName = 'proto.examplecom.AnnotatedMessage';
}



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.examplecom.AnnotatedMessage.prototype.toObject = function(opt_includeInstance) {
return proto.examplecom.AnnotatedMessage.toObject(opt_includeInstance, this);
};


/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.examplecom.AnnotatedMessage} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.examplecom.AnnotatedMessage.toObject = function(includeInstance, msg) {
var f, obj = {
myunit64: jspb.Message.getFieldWithDefault(msg, 1, "0"),
myint64: jspb.Message.getFieldWithDefault(msg, 2, "0"),
myfixed64: jspb.Message.getFieldWithDefault(msg, 3, "0"),
mysint64: jspb.Message.getFieldWithDefault(msg, 4, "0"),
mysfixed64: jspb.Message.getFieldWithDefault(msg, 5, "0")
};

if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}


/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.examplecom.AnnotatedMessage}
*/
proto.examplecom.AnnotatedMessage.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.examplecom.AnnotatedMessage;
return proto.examplecom.AnnotatedMessage.deserializeBinaryFromReader(msg, reader);
};


/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.examplecom.AnnotatedMessage} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.examplecom.AnnotatedMessage}
*/
proto.examplecom.AnnotatedMessage.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readUint64String());
msg.setMyunit64(value);
break;
case 2:
var value = /** @type {string} */ (reader.readInt64String());
msg.setMyint64(value);
break;
case 3:
var value = /** @type {string} */ (reader.readFixed64String());
msg.setMyfixed64(value);
break;
case 4:
var value = /** @type {string} */ (reader.readSint64String());
msg.setMysint64(value);
break;
case 5:
var value = /** @type {string} */ (reader.readSfixed64String());
msg.setMysfixed64(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};


/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.examplecom.AnnotatedMessage.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.examplecom.AnnotatedMessage.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};


/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.examplecom.AnnotatedMessage} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.examplecom.AnnotatedMessage.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getMyunit64();
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
}
f = message.getMyint64();
if (parseInt(f, 10) !== 0) {
writer.writeInt64String(
2,
f
);
}
f = message.getMyfixed64();
if (parseInt(f, 10) !== 0) {
writer.writeFixed64String(
3,
f
);
}
f = message.getMysint64();
if (parseInt(f, 10) !== 0) {
writer.writeSint64String(
4,
f
);
}
f = message.getMysfixed64();
if (parseInt(f, 10) !== 0) {
writer.writeSfixed64String(
5,
f
);
}
};


/**
* optional uint64 myUnit64 = 1;
* @return {string}
*/
proto.examplecom.AnnotatedMessage.prototype.getMyunit64 = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};


/**
* @param {string} value
* @return {!proto.examplecom.AnnotatedMessage} returns this
*/
proto.examplecom.AnnotatedMessage.prototype.setMyunit64 = function(value) {
return jspb.Message.setProto3StringIntField(this, 1, value);
};


/**
* optional int64 myInt64 = 2;
* @return {string}
*/
proto.examplecom.AnnotatedMessage.prototype.getMyint64 = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0"));
};


/**
* @param {string} value
* @return {!proto.examplecom.AnnotatedMessage} returns this
*/
proto.examplecom.AnnotatedMessage.prototype.setMyint64 = function(value) {
return jspb.Message.setProto3StringIntField(this, 2, value);
};


/**
* optional fixed64 myFixed64 = 3;
* @return {string}
*/
proto.examplecom.AnnotatedMessage.prototype.getMyfixed64 = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0"));
};


/**
* @param {string} value
* @return {!proto.examplecom.AnnotatedMessage} returns this
*/
proto.examplecom.AnnotatedMessage.prototype.setMyfixed64 = function(value) {
return jspb.Message.setProto3StringIntField(this, 3, value);
};


/**
* optional sint64 mySint64 = 4;
* @return {string}
*/
proto.examplecom.AnnotatedMessage.prototype.getMysint64 = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0"));
};


/**
* @param {string} value
* @return {!proto.examplecom.AnnotatedMessage} returns this
*/
proto.examplecom.AnnotatedMessage.prototype.setMysint64 = function(value) {
return jspb.Message.setProto3StringIntField(this, 4, value);
};


/**
* optional sfixed64 mySfixed64 = 5;
* @return {string}
*/
proto.examplecom.AnnotatedMessage.prototype.getMysfixed64 = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "0"));
};


/**
* @param {string} value
* @return {!proto.examplecom.AnnotatedMessage} returns this
*/
proto.examplecom.AnnotatedMessage.prototype.setMysfixed64 = function(value) {
return jspb.Message.setProto3StringIntField(this, 5, value);
};


goog.object.extend(exports, proto.examplecom);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// package: examplecom
// file: proto/examplecom/annotations.proto

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// package: examplecom
// file: proto/examplecom/annotations.proto

41 changes: 41 additions & 0 deletions examples/generated-grpc-native/proto/examplecom/casing_pb.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// package: examplecom
// file: proto/examplecom/casing.proto

import * as jspb from "google-protobuf";

export class CasingMessage extends jspb.Message {
getTitlecase(): string;
setTitlecase(value: string): void;

getCamelcase(): string;
setCamelcase(value: string): void;

getSnakeCase(): string;
setSnakeCase(value: string): void;

getLeadingunderscorecamelcase(): string;
setLeadingunderscorecamelcase(value: string): void;

getLeadingunderscoretitlecase(): string;
setLeadingunderscoretitlecase(value: string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CasingMessage.AsObject;
static toObject(includeInstance: boolean, msg: CasingMessage): CasingMessage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CasingMessage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CasingMessage;
static deserializeBinaryFromReader(message: CasingMessage, reader: jspb.BinaryReader): CasingMessage;
}

export namespace CasingMessage {
export type AsObject = {
titlecase: string,
camelcase: string,
snakeCase: string,
leadingunderscorecamelcase: string,
leadingunderscoretitlecase: string,
}
}

Loading