Moved to google.golang.org/genproto/googleapis/api/annotations
Fixes #52
This commit is contained in:
2
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/.gitignore
generated
vendored
Normal file
2
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/bower_components
|
||||
/node_modules
|
31
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/README.md
generated
vendored
Normal file
31
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/README.md
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Browser example
|
||||
|
||||
This directory contains an example use of grpc-gateway with web browsers.
|
||||
The following commands automatically runs integration tests with phantomjs.
|
||||
|
||||
```shell-session
|
||||
$ npm install -g gulp-cli
|
||||
$ npm install
|
||||
$ gulp
|
||||
```
|
||||
|
||||
## Other examples
|
||||
|
||||
### Very simple example
|
||||
Run
|
||||
```shell-session
|
||||
$ gulp bower
|
||||
$ gulp backends
|
||||
```
|
||||
|
||||
then, open `index.html`.
|
||||
|
||||
|
||||
### Integration test with your browser
|
||||
|
||||
Run
|
||||
```shell-session
|
||||
$ gulp serve
|
||||
```
|
||||
|
||||
then, open `http://localhost:8000` with your browser.
|
185
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/a_bit_of_everything_service.spec.js
generated
vendored
Normal file
185
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/a_bit_of_everything_service.spec.js
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
'use strict';
|
||||
|
||||
var SwaggerClient = require('swagger-client');
|
||||
|
||||
describe('ABitOfEverythingService', function() {
|
||||
var client;
|
||||
|
||||
beforeEach(function(done) {
|
||||
new SwaggerClient({
|
||||
url: "http://localhost:8080/swagger/a_bit_of_everything.swagger.json",
|
||||
usePromise: true,
|
||||
}).then(function(c) {
|
||||
client = c;
|
||||
}).catch(function(err) {
|
||||
done.fail(err);
|
||||
}).then(done);
|
||||
});
|
||||
|
||||
describe('Create', function() {
|
||||
var created;
|
||||
var expected = {
|
||||
float_value: 1.5,
|
||||
double_value: 2.5,
|
||||
int64_value: "4294967296",
|
||||
uint64_value: "9223372036854775807",
|
||||
int32_value: -2147483648,
|
||||
fixed64_value: "9223372036854775807",
|
||||
fixed32_value: 4294967295,
|
||||
bool_value: true,
|
||||
string_value: "strprefix/foo",
|
||||
uint32_value: 4294967295,
|
||||
sfixed32_value: 2147483647,
|
||||
sfixed64_value: "-4611686018427387904",
|
||||
sint32_value: 2147483647,
|
||||
sint64_value: "4611686018427387903",
|
||||
nonConventionalNameValue: "camelCase",
|
||||
};
|
||||
|
||||
beforeEach(function(done) {
|
||||
client.ABitOfEverythingService.Create(expected).then(function(resp) {
|
||||
created = resp.obj;
|
||||
}).catch(function(err) {
|
||||
done.fail(err);
|
||||
}).then(done);
|
||||
});
|
||||
|
||||
it('should assign id', function() {
|
||||
expect(created.uuid).not.toBe("");
|
||||
});
|
||||
|
||||
it('should echo the request back', function() {
|
||||
delete created.uuid;
|
||||
expect(created).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('CreateBody', function() {
|
||||
var created;
|
||||
var expected = {
|
||||
float_value: 1.5,
|
||||
double_value: 2.5,
|
||||
int64_value: "4294967296",
|
||||
uint64_value: "9223372036854775807",
|
||||
int32_value: -2147483648,
|
||||
fixed64_value: "9223372036854775807",
|
||||
fixed32_value: 4294967295,
|
||||
bool_value: true,
|
||||
string_value: "strprefix/foo",
|
||||
uint32_value: 4294967295,
|
||||
sfixed32_value: 2147483647,
|
||||
sfixed64_value: "-4611686018427387904",
|
||||
sint32_value: 2147483647,
|
||||
sint64_value: "4611686018427387903",
|
||||
nonConventionalNameValue: "camelCase",
|
||||
|
||||
nested: [
|
||||
{ name: "bar", amount: 10 },
|
||||
{ name: "baz", amount: 20 },
|
||||
],
|
||||
repeated_string_value: ["a", "b", "c"],
|
||||
oneof_string: "x",
|
||||
// TODO(yugui) Support enum by name
|
||||
map_value: { a: 1, b: 2 },
|
||||
mapped_string_value: { a: "x", b: "y" },
|
||||
mapped_nested_value: {
|
||||
a: { name: "x", amount: 1 },
|
||||
b: { name: "y", amount: 2 },
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(function(done) {
|
||||
client.ABitOfEverythingService.CreateBody({
|
||||
body: expected,
|
||||
}).then(function(resp) {
|
||||
created = resp.obj;
|
||||
}).catch(function(err) {
|
||||
done.fail(err);
|
||||
}).then(done);
|
||||
});
|
||||
|
||||
it('should assign id', function() {
|
||||
expect(created.uuid).not.toBe("");
|
||||
});
|
||||
|
||||
it('should echo the request back', function() {
|
||||
delete created.uuid;
|
||||
expect(created).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('lookup', function() {
|
||||
var created;
|
||||
var expected = {
|
||||
bool_value: true,
|
||||
string_value: "strprefix/foo",
|
||||
};
|
||||
|
||||
beforeEach(function(done) {
|
||||
client.ABitOfEverythingService.CreateBody({
|
||||
body: expected,
|
||||
}).then(function(resp) {
|
||||
created = resp.obj;
|
||||
}).catch(function(err) {
|
||||
fail(err);
|
||||
}).finally(done);
|
||||
});
|
||||
|
||||
it('should look up an object by uuid', function(done) {
|
||||
client.ABitOfEverythingService.Lookup({
|
||||
uuid: created.uuid
|
||||
}).then(function(resp) {
|
||||
expect(resp.obj).toEqual(created);
|
||||
}).catch(function(err) {
|
||||
fail(err.errObj);
|
||||
}).finally(done);
|
||||
});
|
||||
|
||||
it('should fail if no such object', function(done) {
|
||||
client.ABitOfEverythingService.Lookup({
|
||||
uuid: 'not_exist',
|
||||
}).then(function(resp) {
|
||||
fail('expected failure but succeeded');
|
||||
}).catch(function(err) {
|
||||
expect(err.status).toBe(404);
|
||||
}).finally(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Delete', function() {
|
||||
var created;
|
||||
var expected = {
|
||||
bool_value: true,
|
||||
string_value: "strprefix/foo",
|
||||
};
|
||||
|
||||
beforeEach(function(done) {
|
||||
client.ABitOfEverythingService.CreateBody({
|
||||
body: expected,
|
||||
}).then(function(resp) {
|
||||
created = resp.obj;
|
||||
}).catch(function(err) {
|
||||
fail(err);
|
||||
}).finally(done);
|
||||
});
|
||||
|
||||
it('should delete an object by id', function(done) {
|
||||
client.ABitOfEverythingService.Delete({
|
||||
uuid: created.uuid
|
||||
}).then(function(resp) {
|
||||
expect(resp.obj).toEqual({});
|
||||
}).catch(function(err) {
|
||||
fail(err.errObj);
|
||||
}).then(function() {
|
||||
return client.ABitOfEverythingService.Lookup({
|
||||
uuid: created.uuid
|
||||
});
|
||||
}).then(function(resp) {
|
||||
fail('expected failure but succeeded');
|
||||
}). catch(function(err) {
|
||||
expect(err.status).toBe(404);
|
||||
}).finally(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
2
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bin/.gitignore
generated
vendored
Normal file
2
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bin/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*
|
||||
!/.gitignore
|
21
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bower.json
generated
vendored
Normal file
21
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/bower.json
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "grpc-gateway-example-browser",
|
||||
"description": "Example use of grpc-gateway from browser",
|
||||
"main": "index.js",
|
||||
"authors": [
|
||||
"Yuki Yugui Sonoda <yugui@gengo.com>"
|
||||
],
|
||||
"license": "SEE LICENSE IN LICENSE file",
|
||||
"homepage": "https://github.com/grpc-ecosystem/grpc-gateway",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"swagger-js": "~> 2.1"
|
||||
},
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
43
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/echo_service.spec.js
generated
vendored
Normal file
43
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/echo_service.spec.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var SwaggerClient = require('swagger-client');
|
||||
|
||||
describe('EchoService', function() {
|
||||
var client;
|
||||
|
||||
beforeEach(function(done) {
|
||||
new SwaggerClient({
|
||||
url: "http://localhost:8080/swagger/echo_service.swagger.json",
|
||||
usePromise: true,
|
||||
}).then(function(c) {
|
||||
client = c;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Echo', function() {
|
||||
it('should echo the request back', function(done) {
|
||||
client.EchoService.Echo(
|
||||
{id: "foo"},
|
||||
{responseContentType: "application/json"}
|
||||
).then(function(resp) {
|
||||
expect(resp.obj).toEqual({id: "foo"});
|
||||
}).catch(function(err) {
|
||||
done.fail(err);
|
||||
}).then(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('EchoBody', function() {
|
||||
it('should echo the request back', function(done) {
|
||||
client.EchoService.EchoBody(
|
||||
{body: {id: "foo"}},
|
||||
{responseContentType: "application/json"}
|
||||
).then(function(resp) {
|
||||
expect(resp.obj).toEqual({id: "foo"});
|
||||
}).catch(function(err) {
|
||||
done.fail(err);
|
||||
}).then(done);
|
||||
});
|
||||
});
|
||||
});
|
81
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/gulpfile.js
generated
vendored
Normal file
81
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/gulpfile.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
|
||||
var gulp = require('gulp');
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var bower = require('gulp-bower');
|
||||
var exit = require('gulp-exit');
|
||||
var gprocess = require('gulp-process');
|
||||
var shell = require('gulp-shell');
|
||||
var jasmineBrowser = require('gulp-jasmine-browser');
|
||||
var webpack = require('webpack-stream');
|
||||
|
||||
gulp.task('bower', function(){
|
||||
return bower();
|
||||
});
|
||||
|
||||
gulp.task('server', shell.task([
|
||||
'go build -o bin/example-server github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server',
|
||||
]));
|
||||
|
||||
gulp.task('gateway', shell.task([
|
||||
'go build -o bin/example-gw github.com/grpc-ecosystem/grpc-gateway/examples',
|
||||
]));
|
||||
|
||||
gulp.task('serve-server', ['server'], function(){
|
||||
gprocess.start('server-server', 'bin/example-server', [
|
||||
'--logtostderr',
|
||||
]);
|
||||
gulp.watch('bin/example-server', ['serve-server']);
|
||||
});
|
||||
|
||||
gulp.task('serve-gateway', ['gateway', 'serve-server'], function(){
|
||||
gprocess.start('gateway-server', 'bin/example-gw', [
|
||||
'--logtostderr', '--swagger_dir', path.join(__dirname, "../examplepb"),
|
||||
]);
|
||||
gulp.watch('bin/example-gateway', ['serve-gateway']);
|
||||
});
|
||||
|
||||
gulp.task('backends', ['serve-gateway', 'serve-server']);
|
||||
|
||||
var specFiles = ['*.spec.js'];
|
||||
gulp.task('test', ['backends'], function(done) {
|
||||
return gulp.src(specFiles)
|
||||
.pipe(webpack({output: {filename: 'spec.js'}}))
|
||||
.pipe(jasmineBrowser.specRunner({
|
||||
console: true,
|
||||
sourceMappedStacktrace: true,
|
||||
}))
|
||||
.pipe(jasmineBrowser.headless({
|
||||
findOpenPort: true,
|
||||
catch: true,
|
||||
throwFailures: true,
|
||||
}))
|
||||
.on('error', function(err) {
|
||||
done(err);
|
||||
process.exit(1);
|
||||
})
|
||||
.pipe(exit());
|
||||
});
|
||||
|
||||
gulp.task('serve', ['backends'], function(done) {
|
||||
var JasminePlugin = require('gulp-jasmine-browser/webpack/jasmine-plugin');
|
||||
var plugin = new JasminePlugin();
|
||||
|
||||
return gulp.src(specFiles)
|
||||
.pipe(webpack({
|
||||
output: {filename: 'spec.js'},
|
||||
watch: true,
|
||||
plugins: [plugin],
|
||||
}))
|
||||
.pipe(jasmineBrowser.specRunner({
|
||||
sourceMappedStacktrace: true,
|
||||
}))
|
||||
.pipe(jasmineBrowser.server({
|
||||
port: 8000,
|
||||
whenReady: plugin.whenReady,
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('default', ['test']);
|
22
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/index.html
generated
vendored
Normal file
22
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/index.html
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="bower_components/swagger-js/browser/swagger-client.min.js"></script>
|
||||
<script type="application/javascript">
|
||||
window.client = new SwaggerClient({
|
||||
url: "http://localhost:8080/swagger/echo_service.swagger.json",
|
||||
success: function() {
|
||||
client.EchoService.Echo(
|
||||
{id: "foo"},
|
||||
{responseContentType: "application/json"},
|
||||
function(data) {
|
||||
document.getElementById("echoBack").innerHTML = data.obj.id;
|
||||
});
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="echoBack"></div>
|
||||
</body>
|
||||
</html>
|
23
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/package.json
generated
vendored
Normal file
23
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/browser/package.json
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "grpc-gateway-example",
|
||||
"version": "1.0.0",
|
||||
"description": "Example use of grpc-gateway from browser",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"devDependencies": {
|
||||
"bower": "^1.7.9",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-bower": "0.0.13",
|
||||
"gulp-exit": "0.0.2",
|
||||
"gulp-jasmine-browser": "^1.3.2",
|
||||
"gulp-process": "^0.1.2",
|
||||
"gulp-shell": "^0.5.2",
|
||||
"jasmine": "^2.4.1",
|
||||
"phantomjs": "^2.1.7",
|
||||
"swagger-client": "^2.1.28",
|
||||
"webpack-stream": "^3.2.0"
|
||||
}
|
||||
}
|
162
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/client_test.go
generated
vendored
Normal file
162
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/client_test.go
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo"
|
||||
)
|
||||
|
||||
func TestClientIntegration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEchoClient(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
return
|
||||
}
|
||||
|
||||
cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080")
|
||||
resp, err := cl.Echo("foo")
|
||||
if err != nil {
|
||||
t.Errorf(`cl.Echo("foo") failed with %v; want success`, err)
|
||||
}
|
||||
if got, want := resp.Id, "foo"; got != want {
|
||||
t.Errorf("resp.Id = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEchoBodyClient(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
return
|
||||
}
|
||||
|
||||
cl := echo.NewEchoServiceApiWithBasePath("http://localhost:8080")
|
||||
req := echo.ExamplepbSimpleMessage{Id: "foo"}
|
||||
resp, err := cl.EchoBody(req)
|
||||
if err != nil {
|
||||
t.Errorf("cl.EchoBody(%#v) failed with %v; want success", req, err)
|
||||
}
|
||||
if got, want := resp.Id, "foo"; got != want {
|
||||
t.Errorf("resp.Id = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbitOfEverythingClient(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
return
|
||||
}
|
||||
|
||||
cl := abe.NewABitOfEverythingServiceApiWithBasePath("http://localhost:8080")
|
||||
testABEClientCreate(t, cl)
|
||||
testABEClientCreateBody(t, cl)
|
||||
}
|
||||
|
||||
func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) {
|
||||
want := abe.ExamplepbABitOfEverything{
|
||||
FloatValue: 1.5,
|
||||
DoubleValue: 2.5,
|
||||
Int64Value: "4294967296",
|
||||
Uint64Value: "9223372036854775807",
|
||||
Int32Value: -2147483648,
|
||||
Fixed64Value: "9223372036854775807",
|
||||
Fixed32Value: 4294967295,
|
||||
BoolValue: true,
|
||||
StringValue: "strprefix/foo",
|
||||
Uint32Value: 4294967295,
|
||||
Sfixed32Value: 2147483647,
|
||||
Sfixed64Value: "-4611686018427387904",
|
||||
Sint32Value: 2147483647,
|
||||
Sint64Value: "4611686018427387903",
|
||||
NonConventionalNameValue: "camelCase",
|
||||
}
|
||||
resp, err := cl.Create(
|
||||
want.FloatValue,
|
||||
want.DoubleValue,
|
||||
want.Int64Value,
|
||||
want.Uint64Value,
|
||||
want.Int32Value,
|
||||
want.Fixed64Value,
|
||||
want.Fixed32Value,
|
||||
want.BoolValue,
|
||||
want.StringValue,
|
||||
want.Uint32Value,
|
||||
want.Sfixed32Value,
|
||||
want.Sfixed64Value,
|
||||
want.Sint32Value,
|
||||
want.Sint64Value,
|
||||
want.NonConventionalNameValue,
|
||||
)
|
||||
if err != nil {
|
||||
t.Errorf("cl.Create(%#v) failed with %v; want success", want, err)
|
||||
}
|
||||
if resp.Uuid == "" {
|
||||
t.Errorf("resp.Uuid is empty; want not empty")
|
||||
}
|
||||
resp.Uuid = ""
|
||||
if got := resp; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("resp = %#v; want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) {
|
||||
t.Log("TODO: support enum")
|
||||
return
|
||||
|
||||
want := abe.ExamplepbABitOfEverything{
|
||||
FloatValue: 1.5,
|
||||
DoubleValue: 2.5,
|
||||
Int64Value: "4294967296",
|
||||
Uint64Value: "9223372036854775807",
|
||||
Int32Value: -2147483648,
|
||||
Fixed64Value: "9223372036854775807",
|
||||
Fixed32Value: 4294967295,
|
||||
BoolValue: true,
|
||||
StringValue: "strprefix/foo",
|
||||
Uint32Value: 4294967295,
|
||||
Sfixed32Value: 2147483647,
|
||||
Sfixed64Value: "-4611686018427387904",
|
||||
Sint32Value: 2147483647,
|
||||
Sint64Value: "4611686018427387903",
|
||||
NonConventionalNameValue: "camelCase",
|
||||
|
||||
Nested: []abe.ABitOfEverythingNested{
|
||||
{
|
||||
Name: "bar",
|
||||
Amount: 10,
|
||||
},
|
||||
{
|
||||
Name: "baz",
|
||||
Amount: 20,
|
||||
},
|
||||
},
|
||||
RepeatedStringValue: []string{"a", "b", "c"},
|
||||
OneofString: "x",
|
||||
MapValue: map[string]abe.ExamplepbNumericEnum{
|
||||
// "a": abe.ExamplepbNumericEnum_ONE,
|
||||
// "b": abe.ExamplepbNumericEnum_ZERO,
|
||||
},
|
||||
MappedStringValue: map[string]string{
|
||||
"a": "x",
|
||||
"b": "y",
|
||||
},
|
||||
MappedNestedValue: map[string]abe.ABitOfEverythingNested{
|
||||
"a": {Name: "x", Amount: 1},
|
||||
"b": {Name: "y", Amount: 2},
|
||||
},
|
||||
}
|
||||
resp, err := cl.CreateBody(want)
|
||||
if err != nil {
|
||||
t.Errorf("cl.CreateBody(%#v) failed with %v; want success", want, err)
|
||||
}
|
||||
if resp.Uuid == "" {
|
||||
t.Errorf("resp.Uuid is empty; want not empty")
|
||||
}
|
||||
resp.Uuid = ""
|
||||
if got := resp; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("resp = %#v; want %#v", got, want)
|
||||
}
|
||||
}
|
11
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingNested.go
generated
vendored
Normal file
11
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingNested.go
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type ABitOfEverythingNested struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Amount int64 `json:"amount,omitempty"`
|
||||
Ok NestedDeepEnum `json:"ok,omitempty"`
|
||||
|
||||
}
|
764
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingServiceApi.go
generated
vendored
Normal file
764
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ABitOfEverythingServiceApi.go
generated
vendored
Normal file
@@ -0,0 +1,764 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/dghubble/sling"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ABitOfEverythingServiceApi struct {
|
||||
basePath string
|
||||
}
|
||||
|
||||
func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi{
|
||||
return &ABitOfEverythingServiceApi {
|
||||
basePath: "http://localhost",
|
||||
}
|
||||
}
|
||||
|
||||
func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi{
|
||||
return &ABitOfEverythingServiceApi {
|
||||
basePath: basePath,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param floatValue
|
||||
* @param doubleValue
|
||||
* @param int64Value
|
||||
* @param uint64Value
|
||||
* @param int32Value
|
||||
* @param fixed64Value
|
||||
* @param fixed32Value
|
||||
* @param boolValue
|
||||
* @param stringValue
|
||||
* @param uint32Value
|
||||
* @param sfixed32Value
|
||||
* @param sfixed64Value
|
||||
* @param sint32Value
|
||||
* @param sint64Value
|
||||
* @param nonConventionalNameValue
|
||||
* @return ExamplepbABitOfEverything
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) {
|
||||
func (a ABitOfEverythingServiceApi) Create (floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (ExamplepbABitOfEverything, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}"
|
||||
path = strings.Replace(path, "{" + "float_value" + "}", fmt.Sprintf("%v", floatValue), -1)
|
||||
path = strings.Replace(path, "{" + "double_value" + "}", fmt.Sprintf("%v", doubleValue), -1)
|
||||
path = strings.Replace(path, "{" + "int64_value" + "}", fmt.Sprintf("%v", int64Value), -1)
|
||||
path = strings.Replace(path, "{" + "uint64_value" + "}", fmt.Sprintf("%v", uint64Value), -1)
|
||||
path = strings.Replace(path, "{" + "int32_value" + "}", fmt.Sprintf("%v", int32Value), -1)
|
||||
path = strings.Replace(path, "{" + "fixed64_value" + "}", fmt.Sprintf("%v", fixed64Value), -1)
|
||||
path = strings.Replace(path, "{" + "fixed32_value" + "}", fmt.Sprintf("%v", fixed32Value), -1)
|
||||
path = strings.Replace(path, "{" + "bool_value" + "}", fmt.Sprintf("%v", boolValue), -1)
|
||||
path = strings.Replace(path, "{" + "string_value" + "}", fmt.Sprintf("%v", stringValue), -1)
|
||||
path = strings.Replace(path, "{" + "uint32_value" + "}", fmt.Sprintf("%v", uint32Value), -1)
|
||||
path = strings.Replace(path, "{" + "sfixed32_value" + "}", fmt.Sprintf("%v", sfixed32Value), -1)
|
||||
path = strings.Replace(path, "{" + "sfixed64_value" + "}", fmt.Sprintf("%v", sfixed64Value), -1)
|
||||
path = strings.Replace(path, "{" + "sint32_value" + "}", fmt.Sprintf("%v", sint32Value), -1)
|
||||
path = strings.Replace(path, "{" + "sint64_value" + "}", fmt.Sprintf("%v", sint64Value), -1)
|
||||
path = strings.Replace(path, "{" + "nonConventionalNameValue" + "}", fmt.Sprintf("%v", nonConventionalNameValue), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(ExamplepbABitOfEverything)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param body
|
||||
* @return ExamplepbABitOfEverything
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) {
|
||||
func (a ABitOfEverythingServiceApi) CreateBody (body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
var successPayload = new(ExamplepbABitOfEverything)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param singleNestedName
|
||||
* @param body
|
||||
* @return ExamplepbABitOfEverything
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) {
|
||||
func (a ABitOfEverythingServiceApi) DeepPathEcho (singleNestedName string, body ExamplepbABitOfEverything) (ExamplepbABitOfEverything, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/{single_nested.name}"
|
||||
path = strings.Replace(path, "{" + "single_nested.name" + "}", fmt.Sprintf("%v", singleNestedName), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
var successPayload = new(ExamplepbABitOfEverything)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param uuid
|
||||
* @return ProtobufEmpty
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) {
|
||||
func (a ABitOfEverythingServiceApi) Delete (uuid string) (ProtobufEmpty, error) {
|
||||
|
||||
_sling := sling.New().Delete(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/{uuid}"
|
||||
path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(ProtobufEmpty)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* @return SubStringMessage
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) {
|
||||
func (a ABitOfEverythingServiceApi) Echo (value string) (SubStringMessage, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/echo/{value}"
|
||||
path = strings.Replace(path, "{" + "value" + "}", fmt.Sprintf("%v", value), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(SubStringMessage)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* @return SubStringMessage
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) {
|
||||
func (a ABitOfEverythingServiceApi) Echo_1 (value string) (SubStringMessage, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/example/echo"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
value string `url:"value,omitempty"`
|
||||
|
||||
}
|
||||
_sling = _sling.QueryStruct(&QueryParams{ value: value })
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(SubStringMessage)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param body
|
||||
* @return SubStringMessage
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) {
|
||||
func (a ABitOfEverythingServiceApi) Echo_2 (body string) (SubStringMessage, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/example/echo"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
var successPayload = new(SubStringMessage)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param uuid
|
||||
* @param singleNestedName name is nested field.
|
||||
* @param singleNestedAmount
|
||||
* @param singleNestedOk - FALSE: FALSE is false.\n - TRUE: TRUE is true.
|
||||
* @param floatValue
|
||||
* @param doubleValue
|
||||
* @param int64Value
|
||||
* @param uint64Value
|
||||
* @param int32Value
|
||||
* @param fixed64Value
|
||||
* @param fixed32Value
|
||||
* @param boolValue
|
||||
* @param stringValue
|
||||
* @param uint32Value TODO(yugui) add bytes_value.
|
||||
* @param enumValue - ZERO: ZERO means 0\n - ONE: ONE means 1
|
||||
* @param sfixed32Value
|
||||
* @param sfixed64Value
|
||||
* @param sint32Value
|
||||
* @param sint64Value
|
||||
* @param repeatedStringValue
|
||||
* @param oneofString
|
||||
* @param nonConventionalNameValue
|
||||
* @param timestampValue
|
||||
* @param repeatedEnumValue repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1
|
||||
* @return ProtobufEmpty
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) {
|
||||
func (a ABitOfEverythingServiceApi) GetQuery (uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, enumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (ProtobufEmpty, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/query/{uuid}"
|
||||
path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
singleNestedName string `url:"single_nested.name,omitempty"`
|
||||
singleNestedAmount int64 `url:"single_nested.amount,omitempty"`
|
||||
singleNestedOk string `url:"single_nested.ok,omitempty"`
|
||||
floatValue float32 `url:"float_value,omitempty"`
|
||||
doubleValue float64 `url:"double_value,omitempty"`
|
||||
int64Value string `url:"int64_value,omitempty"`
|
||||
uint64Value string `url:"uint64_value,omitempty"`
|
||||
int32Value int32 `url:"int32_value,omitempty"`
|
||||
fixed64Value string `url:"fixed64_value,omitempty"`
|
||||
fixed32Value int64 `url:"fixed32_value,omitempty"`
|
||||
boolValue bool `url:"bool_value,omitempty"`
|
||||
stringValue string `url:"string_value,omitempty"`
|
||||
uint32Value int64 `url:"uint32_value,omitempty"`
|
||||
enumValue string `url:"enum_value,omitempty"`
|
||||
sfixed32Value int32 `url:"sfixed32_value,omitempty"`
|
||||
sfixed64Value string `url:"sfixed64_value,omitempty"`
|
||||
sint32Value int32 `url:"sint32_value,omitempty"`
|
||||
sint64Value string `url:"sint64_value,omitempty"`
|
||||
repeatedStringValue []string `url:"repeated_string_value,omitempty"`
|
||||
oneofString string `url:"oneof_string,omitempty"`
|
||||
nonConventionalNameValue string `url:"nonConventionalNameValue,omitempty"`
|
||||
timestampValue time.Time `url:"timestamp_value,omitempty"`
|
||||
repeatedEnumValue []string `url:"repeated_enum_value,omitempty"`
|
||||
|
||||
}
|
||||
_sling = _sling.QueryStruct(&QueryParams{ singleNestedName: singleNestedName,singleNestedAmount: singleNestedAmount,singleNestedOk: singleNestedOk,floatValue: floatValue,doubleValue: doubleValue,int64Value: int64Value,uint64Value: uint64Value,int32Value: int32Value,fixed64Value: fixed64Value,fixed32Value: fixed32Value,boolValue: boolValue,stringValue: stringValue,uint32Value: uint32Value,enumValue: enumValue,sfixed32Value: sfixed32Value,sfixed64Value: sfixed64Value,sint32Value: sint32Value,sint64Value: sint64Value,repeatedStringValue: repeatedStringValue,oneofString: oneofString,nonConventionalNameValue: nonConventionalNameValue,timestampValue: timestampValue,repeatedEnumValue: repeatedEnumValue })
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(ProtobufEmpty)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param uuid
|
||||
* @return ExamplepbABitOfEverything
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) {
|
||||
func (a ABitOfEverythingServiceApi) Lookup (uuid string) (ExamplepbABitOfEverything, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/{uuid}"
|
||||
path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(ExamplepbABitOfEverything)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return ProtobufEmpty
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) {
|
||||
func (a ABitOfEverythingServiceApi) Timeout () (ProtobufEmpty, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/example/timeout"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(ProtobufEmpty)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param uuid
|
||||
* @param body
|
||||
* @return ProtobufEmpty
|
||||
*/
|
||||
//func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) {
|
||||
func (a ABitOfEverythingServiceApi) Update (uuid string, body ExamplepbABitOfEverything) (ProtobufEmpty, error) {
|
||||
|
||||
_sling := sling.New().Put(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/a_bit_of_everything/{uuid}"
|
||||
path = strings.Replace(path, "{" + "uuid" + "}", fmt.Sprintf("%v", uuid), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
var successPayload = new(ProtobufEmpty)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
36
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbABitOfEverything.go
generated
vendored
Normal file
36
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbABitOfEverything.go
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type ExamplepbABitOfEverything struct {
|
||||
SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"`
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
Nested []ABitOfEverythingNested `json:"nested,omitempty"`
|
||||
FloatValue float32 `json:"float_value,omitempty"`
|
||||
DoubleValue float64 `json:"double_value,omitempty"`
|
||||
Int64Value string `json:"int64_value,omitempty"`
|
||||
Uint64Value string `json:"uint64_value,omitempty"`
|
||||
Int32Value int32 `json:"int32_value,omitempty"`
|
||||
Fixed64Value string `json:"fixed64_value,omitempty"`
|
||||
Fixed32Value int64 `json:"fixed32_value,omitempty"`
|
||||
BoolValue bool `json:"bool_value,omitempty"`
|
||||
StringValue string `json:"string_value,omitempty"`
|
||||
Uint32Value int64 `json:"uint32_value,omitempty"`
|
||||
EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"`
|
||||
Sfixed32Value int32 `json:"sfixed32_value,omitempty"`
|
||||
Sfixed64Value string `json:"sfixed64_value,omitempty"`
|
||||
Sint32Value int32 `json:"sint32_value,omitempty"`
|
||||
Sint64Value string `json:"sint64_value,omitempty"`
|
||||
RepeatedStringValue []string `json:"repeated_string_value,omitempty"`
|
||||
OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"`
|
||||
OneofString string `json:"oneof_string,omitempty"`
|
||||
MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"`
|
||||
MappedStringValue map[string]string `json:"mapped_string_value,omitempty"`
|
||||
MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"`
|
||||
NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"`
|
||||
TimestampValue time.Time `json:"timestamp_value,omitempty"`
|
||||
RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"`
|
||||
|
||||
}
|
8
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbNumericEnum.go
generated
vendored
Normal file
8
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ExamplepbNumericEnum.go
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type ExamplepbNumericEnum struct {
|
||||
|
||||
}
|
8
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/NestedDeepEnum.go
generated
vendored
Normal file
8
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/NestedDeepEnum.go
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type NestedDeepEnum struct {
|
||||
|
||||
}
|
10
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufDuration.go
generated
vendored
Normal file
10
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufDuration.go
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type ProtobufDuration struct {
|
||||
Seconds string `json:"seconds,omitempty"`
|
||||
Nanos int32 `json:"nanos,omitempty"`
|
||||
|
||||
}
|
8
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufEmpty.go
generated
vendored
Normal file
8
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/ProtobufEmpty.go
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type ProtobufEmpty struct {
|
||||
|
||||
}
|
9
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/Sub2IdMessage.go
generated
vendored
Normal file
9
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/Sub2IdMessage.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type Sub2IdMessage struct {
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
|
||||
}
|
9
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/SubStringMessage.go
generated
vendored
Normal file
9
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/abe/SubStringMessage.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package abe
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type SubStringMessage struct {
|
||||
Value string `json:"value,omitempty"`
|
||||
|
||||
}
|
145
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/EchoServiceApi.go
generated
vendored
Normal file
145
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/EchoServiceApi.go
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
package echo
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/dghubble/sling"
|
||||
)
|
||||
|
||||
type EchoServiceApi struct {
|
||||
basePath string
|
||||
}
|
||||
|
||||
func NewEchoServiceApi() *EchoServiceApi{
|
||||
return &EchoServiceApi {
|
||||
basePath: "http://localhost",
|
||||
}
|
||||
}
|
||||
|
||||
func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi{
|
||||
return &EchoServiceApi {
|
||||
basePath: basePath,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Echo method receives a simple message and returns it.
|
||||
* The message posted as the id parameter will also be\nreturned.
|
||||
* @param id
|
||||
* @return ExamplepbSimpleMessage
|
||||
*/
|
||||
//func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) {
|
||||
func (a EchoServiceApi) Echo (id string) (ExamplepbSimpleMessage, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/echo/{id}"
|
||||
path = strings.Replace(path, "{" + "id" + "}", fmt.Sprintf("%v", id), -1)
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
var successPayload = new(ExamplepbSimpleMessage)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
/**
|
||||
* EchoBody method receives a simple message and returns it.
|
||||
*
|
||||
* @param body
|
||||
* @return ExamplepbSimpleMessage
|
||||
*/
|
||||
//func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) {
|
||||
func (a EchoServiceApi) EchoBody (body ExamplepbSimpleMessage) (ExamplepbSimpleMessage, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v1/example/echo_body"
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json" }
|
||||
for key := range accepts {
|
||||
_sling = _sling.Set("Accept", accepts[key])
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
var successPayload = new(ExamplepbSimpleMessage)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
var failurePayload map[string]interface{}
|
||||
|
||||
httpResponse, err := _sling.Receive(successPayload, &failurePayload)
|
||||
|
||||
if err == nil {
|
||||
// err == nil only means that there wasn't a sub-application-layer error (e.g. no network error)
|
||||
if failurePayload != nil {
|
||||
// If the failurePayload is present, there likely was some kind of non-2xx status
|
||||
// returned (and a JSON payload error present)
|
||||
var str []byte
|
||||
str, err = json.Marshal(failurePayload)
|
||||
if err == nil { // For safety, check for an error marshalling... probably superfluous
|
||||
// This will return the JSON error body as a string
|
||||
err = errors.New(string(str))
|
||||
}
|
||||
} else {
|
||||
// So, there was no network-type error, and nothing in the failure payload,
|
||||
// but we should still check the status code
|
||||
if httpResponse == nil {
|
||||
// This should never happen...
|
||||
err = errors.New("No HTTP Response received.")
|
||||
} else if code := httpResponse.StatusCode; 200 > code || code > 299 {
|
||||
err = errors.New("HTTP Error: " + string(httpResponse.StatusCode))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *successPayload, err
|
||||
}
|
9
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/ExamplepbSimpleMessage.go
generated
vendored
Normal file
9
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/clients/echo/ExamplepbSimpleMessage.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package echo
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type ExamplepbSimpleMessage struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
|
||||
}
|
958
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.go
generated
vendored
Normal file
958
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.go
generated
vendored
Normal file
@@ -0,0 +1,958 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: examples/examplepb/a_bit_of_everything.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package examplepb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import google_protobuf1 "github.com/golang/protobuf/ptypes/empty"
|
||||
import google_protobuf2 "github.com/golang/protobuf/ptypes/duration"
|
||||
import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub"
|
||||
import sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2"
|
||||
import google_protobuf3 "github.com/golang/protobuf/ptypes/timestamp"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// NumericEnum is one or zero.
|
||||
type NumericEnum int32
|
||||
|
||||
const (
|
||||
// ZERO means 0
|
||||
NumericEnum_ZERO NumericEnum = 0
|
||||
// ONE means 1
|
||||
NumericEnum_ONE NumericEnum = 1
|
||||
)
|
||||
|
||||
var NumericEnum_name = map[int32]string{
|
||||
0: "ZERO",
|
||||
1: "ONE",
|
||||
}
|
||||
var NumericEnum_value = map[string]int32{
|
||||
"ZERO": 0,
|
||||
"ONE": 1,
|
||||
}
|
||||
|
||||
func (x NumericEnum) String() string {
|
||||
return proto.EnumName(NumericEnum_name, int32(x))
|
||||
}
|
||||
func (NumericEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
// DeepEnum is one or zero.
|
||||
type ABitOfEverything_Nested_DeepEnum int32
|
||||
|
||||
const (
|
||||
// FALSE is false.
|
||||
ABitOfEverything_Nested_FALSE ABitOfEverything_Nested_DeepEnum = 0
|
||||
// TRUE is true.
|
||||
ABitOfEverything_Nested_TRUE ABitOfEverything_Nested_DeepEnum = 1
|
||||
)
|
||||
|
||||
var ABitOfEverything_Nested_DeepEnum_name = map[int32]string{
|
||||
0: "FALSE",
|
||||
1: "TRUE",
|
||||
}
|
||||
var ABitOfEverything_Nested_DeepEnum_value = map[string]int32{
|
||||
"FALSE": 0,
|
||||
"TRUE": 1,
|
||||
}
|
||||
|
||||
func (x ABitOfEverything_Nested_DeepEnum) String() string {
|
||||
return proto.EnumName(ABitOfEverything_Nested_DeepEnum_name, int32(x))
|
||||
}
|
||||
func (ABitOfEverything_Nested_DeepEnum) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor1, []int{0, 0, 0}
|
||||
}
|
||||
|
||||
// Intentionaly complicated message type to cover much features of Protobuf.
|
||||
// NEXT ID: 27
|
||||
type ABitOfEverything struct {
|
||||
SingleNested *ABitOfEverything_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"`
|
||||
Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"`
|
||||
Nested []*ABitOfEverything_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"`
|
||||
FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"`
|
||||
DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"`
|
||||
Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"`
|
||||
Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"`
|
||||
Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"`
|
||||
Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"`
|
||||
Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"`
|
||||
BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"`
|
||||
StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"`
|
||||
// TODO(yugui) add bytes_value
|
||||
Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"`
|
||||
EnumValue NumericEnum `protobuf:"varint,14,opt,name=enum_value,json=enumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"enum_value,omitempty"`
|
||||
Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"`
|
||||
Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"`
|
||||
Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"`
|
||||
Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"`
|
||||
RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"`
|
||||
// Types that are valid to be assigned to OneofValue:
|
||||
// *ABitOfEverything_OneofEmpty
|
||||
// *ABitOfEverything_OneofString
|
||||
OneofValue isABitOfEverything_OneofValue `protobuf_oneof:"oneof_value"`
|
||||
MapValue map[string]NumericEnum `protobuf:"bytes,22,rep,name=map_value,json=mapValue" json:"map_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=grpc.gateway.examples.examplepb.NumericEnum"`
|
||||
MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
MappedNestedValue map[string]*ABitOfEverything_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"`
|
||||
TimestampValue *google_protobuf3.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"`
|
||||
// repeated enum value. it is comma-separated in query
|
||||
RepeatedEnumValue []NumericEnum `protobuf:"varint,28,rep,packed,name=repeated_enum_value,json=repeatedEnumValue,enum=grpc.gateway.examples.examplepb.NumericEnum" json:"repeated_enum_value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) Reset() { *m = ABitOfEverything{} }
|
||||
func (m *ABitOfEverything) String() string { return proto.CompactTextString(m) }
|
||||
func (*ABitOfEverything) ProtoMessage() {}
|
||||
func (*ABitOfEverything) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
type isABitOfEverything_OneofValue interface {
|
||||
isABitOfEverything_OneofValue()
|
||||
}
|
||||
|
||||
type ABitOfEverything_OneofEmpty struct {
|
||||
OneofEmpty *google_protobuf1.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,oneof"`
|
||||
}
|
||||
type ABitOfEverything_OneofString struct {
|
||||
OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,oneof"`
|
||||
}
|
||||
|
||||
func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {}
|
||||
func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {}
|
||||
|
||||
func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue {
|
||||
if m != nil {
|
||||
return m.OneofValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested {
|
||||
if m != nil {
|
||||
return m.SingleNested
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetUuid() string {
|
||||
if m != nil {
|
||||
return m.Uuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetNested() []*ABitOfEverything_Nested {
|
||||
if m != nil {
|
||||
return m.Nested
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetFloatValue() float32 {
|
||||
if m != nil {
|
||||
return m.FloatValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetDoubleValue() float64 {
|
||||
if m != nil {
|
||||
return m.DoubleValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetInt64Value() int64 {
|
||||
if m != nil {
|
||||
return m.Int64Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetUint64Value() uint64 {
|
||||
if m != nil {
|
||||
return m.Uint64Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetInt32Value() int32 {
|
||||
if m != nil {
|
||||
return m.Int32Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetFixed64Value() uint64 {
|
||||
if m != nil {
|
||||
return m.Fixed64Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetFixed32Value() uint32 {
|
||||
if m != nil {
|
||||
return m.Fixed32Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetBoolValue() bool {
|
||||
if m != nil {
|
||||
return m.BoolValue
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetStringValue() string {
|
||||
if m != nil {
|
||||
return m.StringValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetUint32Value() uint32 {
|
||||
if m != nil {
|
||||
return m.Uint32Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetEnumValue() NumericEnum {
|
||||
if m != nil {
|
||||
return m.EnumValue
|
||||
}
|
||||
return NumericEnum_ZERO
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetSfixed32Value() int32 {
|
||||
if m != nil {
|
||||
return m.Sfixed32Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetSfixed64Value() int64 {
|
||||
if m != nil {
|
||||
return m.Sfixed64Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetSint32Value() int32 {
|
||||
if m != nil {
|
||||
return m.Sint32Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetSint64Value() int64 {
|
||||
if m != nil {
|
||||
return m.Sint64Value
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetRepeatedStringValue() []string {
|
||||
if m != nil {
|
||||
return m.RepeatedStringValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetOneofEmpty() *google_protobuf1.Empty {
|
||||
if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok {
|
||||
return x.OneofEmpty
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetOneofString() string {
|
||||
if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofString); ok {
|
||||
return x.OneofString
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetMapValue() map[string]NumericEnum {
|
||||
if m != nil {
|
||||
return m.MapValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetMappedStringValue() map[string]string {
|
||||
if m != nil {
|
||||
return m.MappedStringValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetMappedNestedValue() map[string]*ABitOfEverything_Nested {
|
||||
if m != nil {
|
||||
return m.MappedNestedValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetNonConventionalNameValue() string {
|
||||
if m != nil {
|
||||
return m.NonConventionalNameValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetTimestampValue() *google_protobuf3.Timestamp {
|
||||
if m != nil {
|
||||
return m.TimestampValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything) GetRepeatedEnumValue() []NumericEnum {
|
||||
if m != nil {
|
||||
return m.RepeatedEnumValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*ABitOfEverything) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _ABitOfEverything_OneofMarshaler, _ABitOfEverything_OneofUnmarshaler, _ABitOfEverything_OneofSizer, []interface{}{
|
||||
(*ABitOfEverything_OneofEmpty)(nil),
|
||||
(*ABitOfEverything_OneofString)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _ABitOfEverything_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*ABitOfEverything)
|
||||
// oneof_value
|
||||
switch x := m.OneofValue.(type) {
|
||||
case *ABitOfEverything_OneofEmpty:
|
||||
b.EncodeVarint(20<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.OneofEmpty); err != nil {
|
||||
return err
|
||||
}
|
||||
case *ABitOfEverything_OneofString:
|
||||
b.EncodeVarint(21<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.OneofString)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("ABitOfEverything.OneofValue has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _ABitOfEverything_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*ABitOfEverything)
|
||||
switch tag {
|
||||
case 20: // oneof_value.oneof_empty
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(google_protobuf1.Empty)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.OneofValue = &ABitOfEverything_OneofEmpty{msg}
|
||||
return true, err
|
||||
case 21: // oneof_value.oneof_string
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.OneofValue = &ABitOfEverything_OneofString{x}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _ABitOfEverything_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*ABitOfEverything)
|
||||
// oneof_value
|
||||
switch x := m.OneofValue.(type) {
|
||||
case *ABitOfEverything_OneofEmpty:
|
||||
s := proto.Size(x.OneofEmpty)
|
||||
n += proto.SizeVarint(20<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *ABitOfEverything_OneofString:
|
||||
n += proto.SizeVarint(21<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.OneofString)))
|
||||
n += len(x.OneofString)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// Nested is nested type.
|
||||
type ABitOfEverything_Nested struct {
|
||||
// name is nested field.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"`
|
||||
Ok ABitOfEverything_Nested_DeepEnum `protobuf:"varint,3,opt,name=ok,enum=grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum" json:"ok,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything_Nested) Reset() { *m = ABitOfEverything_Nested{} }
|
||||
func (m *ABitOfEverything_Nested) String() string { return proto.CompactTextString(m) }
|
||||
func (*ABitOfEverything_Nested) ProtoMessage() {}
|
||||
func (*ABitOfEverything_Nested) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0, 0} }
|
||||
|
||||
func (m *ABitOfEverything_Nested) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything_Nested) GetAmount() uint32 {
|
||||
if m != nil {
|
||||
return m.Amount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum {
|
||||
if m != nil {
|
||||
return m.Ok
|
||||
}
|
||||
return ABitOfEverything_Nested_FALSE
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything")
|
||||
proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested")
|
||||
proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value)
|
||||
proto.RegisterEnum("grpc.gateway.examples.examplepb.ABitOfEverything_Nested_DeepEnum", ABitOfEverything_Nested_DeepEnum_name, ABitOfEverything_Nested_DeepEnum_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for ABitOfEverythingService service
|
||||
|
||||
type ABitOfEverythingServiceClient interface {
|
||||
Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error)
|
||||
CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error)
|
||||
Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error)
|
||||
Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error)
|
||||
DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error)
|
||||
NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
}
|
||||
|
||||
type aBitOfEverythingServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewABitOfEverythingServiceClient(cc *grpc.ClientConn) ABitOfEverythingServiceClient {
|
||||
return &aBitOfEverythingServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) {
|
||||
out := new(ABitOfEverything)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) {
|
||||
out := new(ABitOfEverything)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) {
|
||||
out := new(ABitOfEverything)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) GetQuery(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) Echo(ctx context.Context, in *grpc_gateway_examples_sub.StringMessage, opts ...grpc.CallOption) (*grpc_gateway_examples_sub.StringMessage, error) {
|
||||
out := new(grpc_gateway_examples_sub.StringMessage)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) DeepPathEcho(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) {
|
||||
out := new(ABitOfEverything)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) NoBindings(ctx context.Context, in *google_protobuf2.Duration, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *aBitOfEverythingServiceClient) Timeout(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for ABitOfEverythingService service
|
||||
|
||||
type ABitOfEverythingServiceServer interface {
|
||||
Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error)
|
||||
CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error)
|
||||
Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error)
|
||||
Update(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error)
|
||||
Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error)
|
||||
GetQuery(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error)
|
||||
Echo(context.Context, *grpc_gateway_examples_sub.StringMessage) (*grpc_gateway_examples_sub.StringMessage, error)
|
||||
DeepPathEcho(context.Context, *ABitOfEverything) (*ABitOfEverything, error)
|
||||
NoBindings(context.Context, *google_protobuf2.Duration) (*google_protobuf1.Empty, error)
|
||||
Timeout(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error)
|
||||
}
|
||||
|
||||
func RegisterABitOfEverythingServiceServer(s *grpc.Server, srv ABitOfEverythingServiceServer) {
|
||||
s.RegisterService(&_ABitOfEverythingService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ABitOfEverything)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Create",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).Create(ctx, req.(*ABitOfEverything))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ABitOfEverything)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBody",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).CreateBody(ctx, req.(*ABitOfEverything))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(sub2.IdMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).Lookup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).Lookup(ctx, req.(*sub2.IdMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ABitOfEverything)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).Update(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Update",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).Update(ctx, req.(*ABitOfEverything))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(sub2.IdMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).Delete(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Delete",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).Delete(ctx, req.(*sub2.IdMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_GetQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ABitOfEverything)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/GetQuery",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).GetQuery(ctx, req.(*ABitOfEverything))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(grpc_gateway_examples_sub.StringMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).Echo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Echo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).Echo(ctx, req.(*grpc_gateway_examples_sub.StringMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_DeepPathEcho_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ABitOfEverything)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/DeepPathEcho",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).DeepPathEcho(ctx, req.(*ABitOfEverything))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(google_protobuf2.Duration)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/NoBindings",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).NoBindings(ctx, req.(*google_protobuf2.Duration))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ABitOfEverythingService_Timeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(google_protobuf1.Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ABitOfEverythingServiceServer).Timeout(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Timeout",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ABitOfEverythingServiceServer).Timeout(ctx, req.(*google_protobuf1.Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.gateway.examples.examplepb.ABitOfEverythingService",
|
||||
HandlerType: (*ABitOfEverythingServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Create",
|
||||
Handler: _ABitOfEverythingService_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateBody",
|
||||
Handler: _ABitOfEverythingService_CreateBody_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Lookup",
|
||||
Handler: _ABitOfEverythingService_Lookup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Update",
|
||||
Handler: _ABitOfEverythingService_Update_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Delete",
|
||||
Handler: _ABitOfEverythingService_Delete_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetQuery",
|
||||
Handler: _ABitOfEverythingService_GetQuery_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Echo",
|
||||
Handler: _ABitOfEverythingService_Echo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeepPathEcho",
|
||||
Handler: _ABitOfEverythingService_DeepPathEcho_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NoBindings",
|
||||
Handler: _ABitOfEverythingService_NoBindings_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Timeout",
|
||||
Handler: _ABitOfEverythingService_Timeout_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "examples/examplepb/a_bit_of_everything.proto",
|
||||
}
|
||||
|
||||
// Client API for AnotherServiceWithNoBindings service
|
||||
|
||||
type AnotherServiceWithNoBindingsClient interface {
|
||||
NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error)
|
||||
}
|
||||
|
||||
type anotherServiceWithNoBindingsClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewAnotherServiceWithNoBindingsClient(cc *grpc.ClientConn) AnotherServiceWithNoBindingsClient {
|
||||
return &anotherServiceWithNoBindingsClient{cc}
|
||||
}
|
||||
|
||||
func (c *anotherServiceWithNoBindingsClient) NoBindings(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) {
|
||||
out := new(google_protobuf1.Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for AnotherServiceWithNoBindings service
|
||||
|
||||
type AnotherServiceWithNoBindingsServer interface {
|
||||
NoBindings(context.Context, *google_protobuf1.Empty) (*google_protobuf1.Empty, error)
|
||||
}
|
||||
|
||||
func RegisterAnotherServiceWithNoBindingsServer(s *grpc.Server, srv AnotherServiceWithNoBindingsServer) {
|
||||
s.RegisterService(&_AnotherServiceWithNoBindings_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _AnotherServiceWithNoBindings_NoBindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(google_protobuf1.Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings/NoBindings",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AnotherServiceWithNoBindingsServer).NoBindings(ctx, req.(*google_protobuf1.Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.gateway.examples.examplepb.AnotherServiceWithNoBindings",
|
||||
HandlerType: (*AnotherServiceWithNoBindingsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "NoBindings",
|
||||
Handler: _AnotherServiceWithNoBindings_NoBindings_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "examples/examplepb/a_bit_of_everything.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) }
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 1297 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xcf, 0xd8, 0x89, 0x13, 0x3f, 0xc7, 0x89, 0x33, 0x69, 0x53, 0xd7, 0x2d, 0x64, 0x71, 0x01,
|
||||
0xad, 0x42, 0xb5, 0xab, 0xba, 0x15, 0x6a, 0x23, 0x41, 0x95, 0x34, 0x86, 0x22, 0xda, 0xb4, 0xdd,
|
||||
0xfe, 0x41, 0x8a, 0x5a, 0xac, 0xb5, 0x3d, 0xb6, 0x57, 0xf1, 0xee, 0x2c, 0xbb, 0xb3, 0x26, 0x96,
|
||||
0x31, 0x07, 0x0e, 0x5c, 0x38, 0x72, 0xef, 0x05, 0x09, 0x71, 0xe1, 0xc8, 0x19, 0xbe, 0x03, 0x5f,
|
||||
0x81, 0x03, 0x1f, 0x03, 0xed, 0xcc, 0xec, 0x76, 0xd7, 0x89, 0xe5, 0x26, 0x45, 0xbd, 0xed, 0xcc,
|
||||
0x7b, 0xef, 0xf7, 0x7b, 0x7f, 0xe6, 0xbd, 0x99, 0x85, 0xab, 0xe4, 0xc8, 0xb4, 0xdd, 0x3e, 0xf1,
|
||||
0x75, 0xf9, 0xe1, 0x36, 0x75, 0xb3, 0xd1, 0xb4, 0x58, 0x83, 0x76, 0x1a, 0x64, 0x40, 0xbc, 0x21,
|
||||
0xeb, 0x59, 0x4e, 0x57, 0x73, 0x3d, 0xca, 0x28, 0xde, 0xec, 0x7a, 0x6e, 0x4b, 0xeb, 0x9a, 0x8c,
|
||||
0x7c, 0x6b, 0x0e, 0xb5, 0xc8, 0x54, 0x8b, 0x4d, 0x2b, 0x97, 0xbb, 0x94, 0x76, 0xfb, 0x44, 0x37,
|
||||
0x5d, 0x4b, 0x37, 0x1d, 0x87, 0x32, 0x93, 0x59, 0xd4, 0xf1, 0x85, 0x79, 0xe5, 0x92, 0x94, 0xf2,
|
||||
0x55, 0x33, 0xe8, 0xe8, 0xc4, 0x76, 0xd9, 0x50, 0x0a, 0xdf, 0x9d, 0x14, 0xb6, 0x03, 0x8f, 0x5b,
|
||||
0x4b, 0x79, 0x25, 0xf6, 0xd4, 0x0f, 0x9a, 0xba, 0x4d, 0x7c, 0xdf, 0xec, 0x92, 0x08, 0x38, 0x29,
|
||||
0xab, 0x4d, 0x08, 0x37, 0x27, 0x81, 0x99, 0x65, 0x13, 0x9f, 0x99, 0xb6, 0x2b, 0x14, 0xaa, 0x7f,
|
||||
0xad, 0x42, 0x69, 0x67, 0xd7, 0x62, 0x0f, 0x3a, 0xf5, 0x38, 0x60, 0xfc, 0x02, 0x8a, 0xbe, 0xe5,
|
||||
0x74, 0xfb, 0xa4, 0xe1, 0x10, 0x9f, 0x91, 0x76, 0xf9, 0xa2, 0x82, 0xd4, 0x42, 0xed, 0xa6, 0x36,
|
||||
0x23, 0x05, 0xda, 0x24, 0x92, 0xb6, 0xcf, 0xed, 0x8d, 0x65, 0x01, 0x27, 0x56, 0x18, 0xc3, 0x7c,
|
||||
0x10, 0x58, 0xed, 0x32, 0x52, 0x90, 0x9a, 0x37, 0xf8, 0x37, 0x7e, 0x08, 0x39, 0xc9, 0x95, 0x51,
|
||||
0xb2, 0x6f, 0xc4, 0x25, 0x71, 0xf0, 0x26, 0x14, 0x3a, 0x7d, 0x6a, 0xb2, 0xc6, 0xc0, 0xec, 0x07,
|
||||
0xa4, 0x9c, 0x55, 0x90, 0x9a, 0x31, 0x80, 0x6f, 0x3d, 0x0b, 0x77, 0xf0, 0x7b, 0xb0, 0xdc, 0xa6,
|
||||
0x41, 0xb3, 0x4f, 0xa4, 0xc6, 0xbc, 0x82, 0x54, 0x64, 0x14, 0xc4, 0x9e, 0x50, 0xd9, 0x84, 0x82,
|
||||
0xe5, 0xb0, 0x8f, 0x6f, 0x48, 0x8d, 0x05, 0x05, 0xa9, 0x59, 0x03, 0xf8, 0x56, 0x8c, 0x11, 0x24,
|
||||
0x35, 0x72, 0x0a, 0x52, 0xe7, 0x8d, 0x42, 0x90, 0x50, 0x11, 0x18, 0xd7, 0x6b, 0x52, 0x63, 0x51,
|
||||
0x41, 0xea, 0x02, 0xc7, 0xb8, 0x5e, 0x13, 0x0a, 0x57, 0xa0, 0xd8, 0xb1, 0x8e, 0x48, 0x3b, 0x06,
|
||||
0x59, 0x52, 0x90, 0x9a, 0x33, 0x96, 0xe5, 0x66, 0x5a, 0x29, 0xc6, 0xc9, 0x2b, 0x48, 0x5d, 0x94,
|
||||
0x4a, 0x11, 0xd2, 0x3b, 0x00, 0x4d, 0x4a, 0xfb, 0x52, 0x03, 0x14, 0xa4, 0x2e, 0x19, 0xf9, 0x70,
|
||||
0x27, 0x76, 0xd6, 0x67, 0x9e, 0xe5, 0x74, 0xa5, 0x42, 0x81, 0xe7, 0xbf, 0x20, 0xf6, 0x52, 0xf1,
|
||||
0xc4, 0x2c, 0x45, 0x05, 0xa9, 0x45, 0x11, 0x4f, 0x44, 0xf2, 0x25, 0x00, 0x71, 0x02, 0x5b, 0x2a,
|
||||
0xac, 0x28, 0x48, 0x5d, 0xa9, 0x5d, 0x9d, 0x59, 0xad, 0xfd, 0xc0, 0x26, 0x9e, 0xd5, 0xaa, 0x3b,
|
||||
0x81, 0x6d, 0xe4, 0x43, 0x7b, 0x01, 0xf6, 0x01, 0xac, 0xf8, 0xe9, 0xb8, 0x56, 0x15, 0xa4, 0xae,
|
||||
0x1a, 0x45, 0x3f, 0x15, 0x58, 0xac, 0x16, 0xe7, 0xa8, 0xa4, 0x20, 0xb5, 0x14, 0xa9, 0x25, 0xaa,
|
||||
0xe1, 0x27, 0xbd, 0x5f, 0x53, 0x90, 0xba, 0x66, 0x14, 0xfc, 0x84, 0xf7, 0x52, 0x25, 0xc6, 0xc1,
|
||||
0x0a, 0x52, 0xb1, 0x50, 0x89, 0x50, 0x6a, 0x70, 0xde, 0x23, 0x2e, 0x31, 0x19, 0x69, 0x37, 0x52,
|
||||
0xf9, 0x5a, 0x57, 0xb2, 0x6a, 0xde, 0x58, 0x8f, 0x84, 0x8f, 0x13, 0x79, 0xbb, 0x05, 0x05, 0xea,
|
||||
0x90, 0x70, 0x6c, 0x84, 0x5d, 0x5d, 0x3e, 0xc7, 0xfb, 0x65, 0x43, 0x13, 0xdd, 0xa7, 0x45, 0xdd,
|
||||
0xa7, 0xd5, 0x43, 0xe9, 0xdd, 0x39, 0x03, 0xb8, 0x32, 0x5f, 0xe1, 0x2b, 0xb0, 0x2c, 0x4c, 0x05,
|
||||
0x57, 0xf9, 0x7c, 0x58, 0x95, 0xbb, 0x73, 0x86, 0x00, 0x14, 0x24, 0xf8, 0x39, 0xe4, 0x6d, 0xd3,
|
||||
0x95, 0x7e, 0x6c, 0xf0, 0x0e, 0xb9, 0x7d, 0xfa, 0x0e, 0xb9, 0x6f, 0xba, 0xdc, 0xdd, 0xba, 0xc3,
|
||||
0xbc, 0xa1, 0xb1, 0x64, 0xcb, 0x25, 0x3e, 0x82, 0x75, 0xdb, 0x74, 0xdd, 0xc9, 0x78, 0x2f, 0x70,
|
||||
0x9e, 0xbb, 0x67, 0xe2, 0x71, 0x53, 0xf9, 0x11, 0x84, 0x6b, 0xf6, 0xe4, 0x7e, 0x82, 0x59, 0x74,
|
||||
0xad, 0x64, 0x2e, 0xbf, 0x19, 0xb3, 0x98, 0x04, 0xc7, 0x99, 0x13, 0xfb, 0x78, 0x1b, 0xca, 0x0e,
|
||||
0x75, 0xee, 0x50, 0x67, 0x40, 0x9c, 0x70, 0xd2, 0x9a, 0xfd, 0x7d, 0xd3, 0x16, 0x6d, 0x5f, 0xae,
|
||||
0xf0, 0xc6, 0x98, 0x2a, 0xc7, 0x77, 0x60, 0x35, 0x9e, 0xa3, 0xd2, 0xe3, 0x4b, 0xbc, 0xe2, 0x95,
|
||||
0x63, 0x15, 0x7f, 0x12, 0xe9, 0x19, 0x2b, 0xb1, 0x89, 0x00, 0x79, 0x0e, 0xf1, 0x49, 0x6a, 0x24,
|
||||
0x1a, 0xea, 0xb2, 0x92, 0x3d, 0x75, 0x43, 0xad, 0x45, 0x40, 0xf5, 0xa8, 0xb1, 0x2a, 0xbf, 0x21,
|
||||
0xc8, 0xbd, 0x1a, 0xb7, 0x8e, 0x69, 0x93, 0x68, 0xdc, 0x86, 0xdf, 0x78, 0x03, 0x72, 0xa6, 0x4d,
|
||||
0x03, 0x87, 0x95, 0x33, 0xbc, 0xc3, 0xe5, 0x0a, 0x3f, 0x82, 0x0c, 0x3d, 0xe4, 0xb3, 0x72, 0xa5,
|
||||
0xb6, 0x73, 0xd6, 0x11, 0xac, 0xed, 0x11, 0xe2, 0x72, 0xc7, 0x32, 0xf4, 0xb0, 0xba, 0x09, 0x4b,
|
||||
0xd1, 0x1a, 0xe7, 0x61, 0xe1, 0xb3, 0x9d, 0x7b, 0x8f, 0xeb, 0xa5, 0x39, 0xbc, 0x04, 0xf3, 0x4f,
|
||||
0x8c, 0xa7, 0xf5, 0x12, 0xaa, 0x58, 0x50, 0x4c, 0x1d, 0x4c, 0x5c, 0x82, 0xec, 0x21, 0x19, 0x4a,
|
||||
0x7f, 0xc3, 0x4f, 0xbc, 0x0b, 0x0b, 0x22, 0x3b, 0x99, 0x33, 0x8c, 0x1b, 0x61, 0xba, 0x9d, 0xb9,
|
||||
0x89, 0x2a, 0x7b, 0xb0, 0x71, 0xf2, 0xd9, 0x3c, 0x81, 0xf3, 0x5c, 0x92, 0x33, 0x9f, 0x44, 0xf9,
|
||||
0x3e, 0x42, 0x99, 0x3c, 0x67, 0x27, 0xa0, 0xec, 0x27, 0x51, 0xde, 0xe4, 0x5a, 0x7b, 0xc5, 0xbf,
|
||||
0x5b, 0x8c, 0x86, 0x0d, 0xdf, 0xda, 0x52, 0xa0, 0x90, 0x08, 0x37, 0x4c, 0xec, 0x41, 0xdd, 0x78,
|
||||
0x50, 0x9a, 0xc3, 0x8b, 0x90, 0x7d, 0xb0, 0x5f, 0x2f, 0xa1, 0xda, 0xbf, 0xcb, 0x70, 0x61, 0x12,
|
||||
0xf7, 0x31, 0xf1, 0x06, 0x56, 0x8b, 0xe0, 0x97, 0x59, 0xc8, 0xdd, 0xf1, 0xc2, 0xd3, 0x83, 0xaf,
|
||||
0x9d, 0xda, 0xb9, 0xca, 0xe9, 0x4d, 0xaa, 0xbf, 0x67, 0x7e, 0xf8, 0xfb, 0x9f, 0x9f, 0x33, 0xbf,
|
||||
0x66, 0xaa, 0xbf, 0x64, 0xf4, 0xc1, 0xb5, 0xe8, 0xed, 0x75, 0xd2, 0xcb, 0x4b, 0x1f, 0x25, 0x6e,
|
||||
0xf0, 0xb1, 0x3e, 0x4a, 0x5e, 0xd7, 0x63, 0x7d, 0x94, 0x98, 0xe3, 0x63, 0xdd, 0x27, 0xae, 0xe9,
|
||||
0x99, 0x8c, 0x7a, 0xfa, 0x28, 0x48, 0x09, 0x46, 0x89, 0x1b, 0x61, 0xac, 0x8f, 0x52, 0xd7, 0x48,
|
||||
0xb4, 0x4e, 0xc8, 0x5f, 0x5d, 0xa0, 0x63, 0x7d, 0x94, 0x1c, 0x87, 0x9f, 0xf8, 0xcc, 0x73, 0x3d,
|
||||
0xd2, 0xb1, 0x8e, 0xf4, 0xad, 0xb1, 0x20, 0x49, 0x98, 0xf9, 0x93, 0x38, 0xfe, 0x24, 0x91, 0x3f,
|
||||
0x61, 0x90, 0x76, 0x72, 0xda, 0xac, 0x19, 0xe3, 0x97, 0x08, 0x40, 0x14, 0x68, 0x97, 0xb6, 0x87,
|
||||
0x6f, 0xa9, 0x48, 0x5b, 0xbc, 0x46, 0xef, 0x57, 0x37, 0x67, 0x54, 0x68, 0x1b, 0x6d, 0xe1, 0xef,
|
||||
0x20, 0x77, 0x8f, 0xd2, 0xc3, 0xc0, 0xc5, 0xab, 0x5a, 0xf8, 0x04, 0xd5, 0xbe, 0x68, 0xdf, 0x17,
|
||||
0x8f, 0xd0, 0xb3, 0x30, 0x6b, 0x9c, 0x59, 0xc5, 0x1f, 0xce, 0x3c, 0x1b, 0xe1, 0xbb, 0x71, 0x8c,
|
||||
0x7f, 0x44, 0x90, 0x7b, 0xea, 0xb6, 0xcf, 0x78, 0x7e, 0xa7, 0x5c, 0xd1, 0xd5, 0x6b, 0xdc, 0x8b,
|
||||
0x8f, 0x2a, 0xaf, 0xe9, 0x45, 0x98, 0x06, 0x13, 0x72, 0x7b, 0xa4, 0x4f, 0x18, 0x39, 0x9e, 0x86,
|
||||
0x69, 0x2c, 0x32, 0xd6, 0xad, 0xd7, 0x8d, 0xf5, 0x27, 0x04, 0x4b, 0x9f, 0x13, 0xf6, 0x28, 0x20,
|
||||
0xde, 0xf0, 0xff, 0x8c, 0xf6, 0x06, 0xf7, 0x43, 0xc3, 0x57, 0x67, 0xf9, 0xf1, 0x4d, 0xc8, 0x1c,
|
||||
0x79, 0xf3, 0x27, 0x82, 0xf9, 0x7a, 0xab, 0x47, 0xb1, 0x3a, 0xc5, 0x13, 0x3f, 0x68, 0x6a, 0x62,
|
||||
0xd0, 0x46, 0x89, 0x78, 0x6d, 0xcd, 0x6a, 0x8b, 0xbb, 0xf4, 0x62, 0xb6, 0x4b, 0xa4, 0xd5, 0xa3,
|
||||
0xfa, 0x48, 0xb4, 0xd1, 0xc1, 0xc5, 0x6a, 0x49, 0x1f, 0xd4, 0x62, 0xfd, 0x50, 0xb6, 0x2d, 0x06,
|
||||
0xe7, 0x01, 0xc6, 0xc7, 0x44, 0xf8, 0x0f, 0x04, 0xcb, 0xe1, 0xdd, 0xf4, 0xd0, 0x64, 0x3d, 0x1e,
|
||||
0xc9, 0xdb, 0x69, 0xae, 0xdb, 0x3c, 0xb6, 0x5b, 0xd5, 0x1b, 0x33, 0xcb, 0x9e, 0xfa, 0x0b, 0xd3,
|
||||
0xc2, 0x9b, 0x9b, 0x1f, 0xb5, 0x1d, 0x80, 0x7d, 0xba, 0x6b, 0x39, 0x6d, 0xcb, 0xe9, 0xfa, 0xf8,
|
||||
0xe2, 0xb1, 0xaa, 0xee, 0xc9, 0xbf, 0xc7, 0xa9, 0x05, 0x9f, 0xc3, 0xcf, 0x60, 0x31, 0x7c, 0x9a,
|
||||
0xd0, 0x80, 0xe1, 0x29, 0x4a, 0x53, 0x8d, 0x2f, 0x71, 0xf7, 0xcf, 0xe3, 0xf5, 0x64, 0x3e, 0x99,
|
||||
0x00, 0xab, 0x7d, 0x0d, 0x97, 0x77, 0x1c, 0xca, 0x7a, 0xc4, 0x93, 0x17, 0xcc, 0x57, 0x16, 0xeb,
|
||||
0x25, 0x9c, 0xfd, 0x34, 0xe5, 0xfa, 0x69, 0xa9, 0xe7, 0x76, 0x0b, 0x07, 0xf9, 0x38, 0xb3, 0xcd,
|
||||
0x1c, 0x17, 0x5f, 0xff, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xab, 0xe5, 0x92, 0x0d, 0xc9, 0x0f, 0x00,
|
||||
0x00,
|
||||
}
|
839
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.gw.go
generated
vendored
Normal file
839
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.pb.gw.go
generated
vendored
Normal file
@@ -0,0 +1,839 @@
|
||||
// Code generated by protoc-gen-grpc-gateway
|
||||
// source: examples/examplepb/a_bit_of_everything.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package examplepb is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package examplepb
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/sub"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/sub2"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
|
||||
var (
|
||||
filter_ABitOfEverythingService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}}
|
||||
)
|
||||
|
||||
func request_ABitOfEverythingService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ABitOfEverything
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["float_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value")
|
||||
}
|
||||
|
||||
protoReq.FloatValue, err = runtime.Float32(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["double_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value")
|
||||
}
|
||||
|
||||
protoReq.DoubleValue, err = runtime.Float64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["int64_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value")
|
||||
}
|
||||
|
||||
protoReq.Int64Value, err = runtime.Int64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["uint64_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value")
|
||||
}
|
||||
|
||||
protoReq.Uint64Value, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["int32_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value")
|
||||
}
|
||||
|
||||
protoReq.Int32Value, err = runtime.Int32(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["fixed64_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value")
|
||||
}
|
||||
|
||||
protoReq.Fixed64Value, err = runtime.Uint64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["fixed32_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value")
|
||||
}
|
||||
|
||||
protoReq.Fixed32Value, err = runtime.Uint32(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["bool_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value")
|
||||
}
|
||||
|
||||
protoReq.BoolValue, err = runtime.Bool(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["string_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value")
|
||||
}
|
||||
|
||||
protoReq.StringValue, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["uint32_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value")
|
||||
}
|
||||
|
||||
protoReq.Uint32Value, err = runtime.Uint32(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["sfixed32_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value")
|
||||
}
|
||||
|
||||
protoReq.Sfixed32Value, err = runtime.Int32(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["sfixed64_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value")
|
||||
}
|
||||
|
||||
protoReq.Sfixed64Value, err = runtime.Int64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["sint32_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value")
|
||||
}
|
||||
|
||||
protoReq.Sint32Value, err = runtime.Int32(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["sint64_value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value")
|
||||
}
|
||||
|
||||
protoReq.Sint64Value, err = runtime.Int64(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
val, ok = pathParams["nonConventionalNameValue"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue")
|
||||
}
|
||||
|
||||
protoReq.NonConventionalNameValue, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Create_0); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ABitOfEverything
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.CreateBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq sub2.IdMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["uuid"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid")
|
||||
}
|
||||
|
||||
protoReq.Uuid, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
msg, err := client.Lookup(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ABitOfEverything
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["uuid"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid")
|
||||
}
|
||||
|
||||
protoReq.Uuid, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq sub2.IdMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["uuid"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid")
|
||||
}
|
||||
|
||||
protoReq.Uuid, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_ABitOfEverythingService_GetQuery_0 = &utilities.DoubleArray{Encoding: map[string]int{"uuid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_ABitOfEverythingService_GetQuery_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ABitOfEverything
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["uuid"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uuid")
|
||||
}
|
||||
|
||||
protoReq.Uuid, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_GetQuery_0); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetQuery(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq sub.StringMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["value"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "value")
|
||||
}
|
||||
|
||||
protoReq.Value, err = runtime.StringP(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_Echo_1(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq sub.StringMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Value); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_ABitOfEverythingService_Echo_2 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_ABitOfEverythingService_Echo_2(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq sub.StringMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_Echo_2); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ABitOfEverything
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["single_nested.name"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name")
|
||||
}
|
||||
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_ABitOfEverythingService_Timeout_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq empty.Empty
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.Timeout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterABitOfEverythingServiceHandlerFromEndpoint is same as RegisterABitOfEverythingServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterABitOfEverythingServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterABitOfEverythingServiceHandler registers the http handlers for service ABitOfEverythingService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterABitOfEverythingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
client := NewABitOfEverythingServiceClient(conn)
|
||||
|
||||
mux.Handle("POST", pattern_ABitOfEverythingService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Create_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Create_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_ABitOfEverythingService_CreateBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_CreateBody_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_CreateBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Lookup_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Lookup_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("PUT", pattern_ABitOfEverythingService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Update_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Update_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_ABitOfEverythingService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Delete_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Delete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_ABitOfEverythingService_GetQuery_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_GetQuery_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_GetQuery_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_ABitOfEverythingService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Echo_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_ABitOfEverythingService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Echo_1(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Echo_1(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_ABitOfEverythingService_Echo_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Echo_2(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Echo_2(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_ABitOfEverythingService_DeepPathEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_DeepPathEcho_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_DeepPathEcho_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_ABitOfEverythingService_Timeout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_ABitOfEverythingService_Timeout_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_ABitOfEverythingService_Timeout_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_ABitOfEverythingService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19}, []string{"v1", "example", "a_bit_of_everything", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_GetQuery_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "query", "uuid"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "example", "a_bit_of_everything", "echo", "value"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Echo_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Echo_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "echo"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_DeepPathEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "single_nested.name"}, ""))
|
||||
|
||||
pattern_ABitOfEverythingService_Timeout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "example", "timeout"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_ABitOfEverythingService_Create_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_CreateBody_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Lookup_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Update_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Delete_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_GetQuery_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Echo_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Echo_1 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Echo_2 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_DeepPathEcho_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_ABitOfEverythingService_Timeout_0 = runtime.ForwardResponseMessage
|
||||
)
|
137
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.proto
generated
vendored
Normal file
137
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.proto
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "examplepb";
|
||||
package grpc.gateway.examples.examplepb;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "examples/sub/message.proto";
|
||||
import "examples/sub2/message.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// Intentionaly complicated message type to cover much features of Protobuf.
|
||||
// NEXT ID: 27
|
||||
message ABitOfEverything {
|
||||
// Nested is nested type.
|
||||
message Nested {
|
||||
// name is nested field.
|
||||
string name = 1;
|
||||
uint32 amount = 2;
|
||||
// DeepEnum is one or zero.
|
||||
enum DeepEnum {
|
||||
// FALSE is false.
|
||||
FALSE = 0;
|
||||
// TRUE is true.
|
||||
TRUE = 1;
|
||||
}
|
||||
DeepEnum ok = 3;
|
||||
}
|
||||
Nested single_nested = 25;
|
||||
|
||||
string uuid = 1;
|
||||
repeated Nested nested = 2;
|
||||
float float_value = 3;
|
||||
double double_value = 4;
|
||||
int64 int64_value = 5;
|
||||
uint64 uint64_value = 6;
|
||||
int32 int32_value = 7;
|
||||
fixed64 fixed64_value = 8;
|
||||
fixed32 fixed32_value = 9;
|
||||
bool bool_value = 10;
|
||||
string string_value = 11;
|
||||
// TODO(yugui) add bytes_value
|
||||
uint32 uint32_value = 13;
|
||||
NumericEnum enum_value = 14;
|
||||
sfixed32 sfixed32_value = 15;
|
||||
sfixed64 sfixed64_value = 16;
|
||||
sint32 sint32_value = 17;
|
||||
sint64 sint64_value = 18;
|
||||
repeated string repeated_string_value = 19;
|
||||
oneof oneof_value {
|
||||
google.protobuf.Empty oneof_empty = 20;
|
||||
string oneof_string = 21;
|
||||
}
|
||||
|
||||
map<string, NumericEnum> map_value = 22;
|
||||
map<string, string> mapped_string_value = 23;
|
||||
map<string, Nested> mapped_nested_value = 24;
|
||||
|
||||
string nonConventionalNameValue = 26;
|
||||
|
||||
google.protobuf.Timestamp timestamp_value = 27;
|
||||
|
||||
// repeated enum value. it is comma-separated in query
|
||||
repeated NumericEnum repeated_enum_value = 28;
|
||||
}
|
||||
|
||||
// NumericEnum is one or zero.
|
||||
enum NumericEnum {
|
||||
// ZERO means 0
|
||||
ZERO = 0;
|
||||
// ONE means 1
|
||||
ONE = 1;
|
||||
}
|
||||
|
||||
service ABitOfEverythingService {
|
||||
rpc Create(ABitOfEverything) returns (ABitOfEverything) {
|
||||
// TODO add enum_value
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}"
|
||||
};
|
||||
}
|
||||
rpc CreateBody(ABitOfEverything) returns (ABitOfEverything) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/a_bit_of_everything"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc Lookup(sub2.IdMessage) returns (ABitOfEverything) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/example/a_bit_of_everything/{uuid}"
|
||||
};
|
||||
}
|
||||
rpc Update(ABitOfEverything) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
put: "/v1/example/a_bit_of_everything/{uuid}"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc Delete(sub2.IdMessage) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/example/a_bit_of_everything/{uuid}"
|
||||
};
|
||||
}
|
||||
rpc GetQuery(ABitOfEverything) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/example/a_bit_of_everything/query/{uuid}"
|
||||
};
|
||||
}
|
||||
rpc Echo(grpc.gateway.examples.sub.StringMessage) returns (grpc.gateway.examples.sub.StringMessage) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/example/a_bit_of_everything/echo/{value}"
|
||||
additional_bindings {
|
||||
post: "/v2/example/echo"
|
||||
body: "value"
|
||||
}
|
||||
additional_bindings {
|
||||
get: "/v2/example/echo"
|
||||
}
|
||||
};
|
||||
}
|
||||
rpc DeepPathEcho(ABitOfEverything) returns (ABitOfEverything) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/a_bit_of_everything/{single_nested.name}"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc NoBindings(google.protobuf.Duration) returns (google.protobuf.Empty) {}
|
||||
rpc Timeout(google.protobuf.Empty) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/example/timeout",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
service AnotherServiceWithNoBindings {
|
||||
rpc NoBindings(google.protobuf.Empty) returns (google.protobuf.Empty) {}
|
||||
}
|
759
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.swagger.json
generated
vendored
Normal file
759
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/a_bit_of_everything.swagger.json
generated
vendored
Normal file
@@ -0,0 +1,759 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "examples/examplepb/a_bit_of_everything.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/v1/example/a_bit_of_everything": {
|
||||
"post": {
|
||||
"operationId": "CreateBody",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/example/a_bit_of_everything/echo/{value}": {
|
||||
"get": {
|
||||
"operationId": "Echo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subStringMessage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/example/a_bit_of_everything/query/{uuid}": {
|
||||
"get": {
|
||||
"operationId": "GetQuery",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/protobufEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "uuid",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "single_nested.name",
|
||||
"description": "name is nested field.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "single_nested.amount",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "single_nested.ok",
|
||||
"description": " - FALSE: FALSE is false.\n - TRUE: TRUE is true.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"FALSE",
|
||||
"TRUE"
|
||||
],
|
||||
"default": "FALSE"
|
||||
},
|
||||
{
|
||||
"name": "float_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
{
|
||||
"name": "double_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
{
|
||||
"name": "int64_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "uint64_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
},
|
||||
{
|
||||
"name": "int32_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
{
|
||||
"name": "fixed64_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
},
|
||||
{
|
||||
"name": "fixed32_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "bool_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "boolean",
|
||||
"format": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "string_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "uint32_value",
|
||||
"description": "TODO(yugui) add bytes_value.",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "enum_value",
|
||||
"description": " - ZERO: ZERO means 0\n - ONE: ONE means 1",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ZERO",
|
||||
"ONE"
|
||||
],
|
||||
"default": "ZERO"
|
||||
},
|
||||
{
|
||||
"name": "sfixed32_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
{
|
||||
"name": "sfixed64_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "sint32_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
{
|
||||
"name": "sint64_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "repeated_string_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "oneof_string",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "nonConventionalNameValue",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "timestamp_value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
{
|
||||
"name": "repeated_enum_value",
|
||||
"description": "repeated enum value. it is comma-separated in query.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ZERO",
|
||||
"ONE"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}": {
|
||||
"post": {
|
||||
"operationId": "Create",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "float_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
{
|
||||
"name": "double_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
{
|
||||
"name": "int64_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "uint64_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
},
|
||||
{
|
||||
"name": "int32_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
{
|
||||
"name": "fixed64_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
},
|
||||
{
|
||||
"name": "fixed32_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "bool_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "boolean",
|
||||
"format": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "string_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "uint32_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "sfixed32_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
{
|
||||
"name": "sfixed64_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "sint32_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
{
|
||||
"name": "sint64_value",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
{
|
||||
"name": "nonConventionalNameValue",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/example/a_bit_of_everything/{single_nested.name}": {
|
||||
"post": {
|
||||
"operationId": "DeepPathEcho",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "single_nested.name",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/example/a_bit_of_everything/{uuid}": {
|
||||
"get": {
|
||||
"operationId": "Lookup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "uuid",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
},
|
||||
"delete": {
|
||||
"operationId": "Delete",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/protobufEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "uuid",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "Update",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/protobufEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "uuid",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbABitOfEverything"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v2/example/echo": {
|
||||
"get": {
|
||||
"operationId": "Echo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subStringMessage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "value",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "Echo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/subStringMessage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v2/example/timeout": {
|
||||
"get": {
|
||||
"operationId": "Timeout",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/protobufEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"ABitOfEverythingService"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"ABitOfEverythingNested": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "name is nested field."
|
||||
},
|
||||
"amount": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"ok": {
|
||||
"$ref": "#/definitions/NestedDeepEnum"
|
||||
}
|
||||
},
|
||||
"description": "Nested is nested type."
|
||||
},
|
||||
"NestedDeepEnum": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"FALSE",
|
||||
"TRUE"
|
||||
],
|
||||
"default": "FALSE",
|
||||
"description": "DeepEnum is one or zero.\n\n - FALSE: FALSE is false.\n - TRUE: TRUE is true."
|
||||
},
|
||||
"examplepbABitOfEverything": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"single_nested": {
|
||||
"$ref": "#/definitions/ABitOfEverythingNested"
|
||||
},
|
||||
"uuid": {
|
||||
"type": "string"
|
||||
},
|
||||
"nested": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ABitOfEverythingNested"
|
||||
}
|
||||
},
|
||||
"float_value": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
"double_value": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"int64_value": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"uint64_value": {
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
},
|
||||
"int32_value": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"fixed64_value": {
|
||||
"type": "string",
|
||||
"format": "uint64"
|
||||
},
|
||||
"fixed32_value": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"bool_value": {
|
||||
"type": "boolean",
|
||||
"format": "boolean"
|
||||
},
|
||||
"string_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"uint32_value": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"title": "TODO(yugui) add bytes_value"
|
||||
},
|
||||
"enum_value": {
|
||||
"$ref": "#/definitions/examplepbNumericEnum"
|
||||
},
|
||||
"sfixed32_value": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"sfixed64_value": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"sint32_value": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"sint64_value": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"repeated_string_value": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"oneof_empty": {
|
||||
"$ref": "#/definitions/protobufEmpty"
|
||||
},
|
||||
"oneof_string": {
|
||||
"type": "string"
|
||||
},
|
||||
"map_value": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/examplepbNumericEnum"
|
||||
}
|
||||
},
|
||||
"mapped_string_value": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"mapped_nested_value": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/ABitOfEverythingNested"
|
||||
}
|
||||
},
|
||||
"nonConventionalNameValue": {
|
||||
"type": "string"
|
||||
},
|
||||
"timestamp_value": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"repeated_enum_value": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/examplepbNumericEnum"
|
||||
},
|
||||
"title": "repeated enum value. it is comma-separated in query"
|
||||
}
|
||||
},
|
||||
"title": "Intentionaly complicated message type to cover much features of Protobuf.\nNEXT ID: 27"
|
||||
},
|
||||
"examplepbNumericEnum": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ZERO",
|
||||
"ONE"
|
||||
],
|
||||
"default": "ZERO",
|
||||
"description": "NumericEnum is one or zero.\n\n - ZERO: ZERO means 0\n - ONE: ONE means 1"
|
||||
},
|
||||
"protobufDuration": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"seconds": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"description": "Signed seconds of the span of time. Must be from -315,576,000,000\nto +315,576,000,000 inclusive."
|
||||
},
|
||||
"nanos": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "Signed fractions of a second at nanosecond resolution of the span\nof time. Durations less than one second are represented with a 0\n`seconds` field and a positive or negative `nanos` field. For durations\nof one second or more, a non-zero value for the `nanos` field must be\nof the same sign as the `seconds` field. Must be from -999,999,999\nto +999,999,999 inclusive."
|
||||
}
|
||||
},
|
||||
"description": "A Duration represents a signed, fixed-length span of time represented\nas a count of seconds and fractions of seconds at nanosecond\nresolution. It is independent of any calendar and concepts like \"day\"\nor \"month\". It is related to Timestamp in that the difference between\ntwo Timestamp values is a Duration and it can be added or subtracted\nfrom a Timestamp. Range is approximately +-10,000 years.\n\nExample 1: Compute Duration from two Timestamps in pseudo code.\n\n Timestamp start = ...;\n Timestamp end = ...;\n Duration duration = ...;\n\n duration.seconds = end.seconds - start.seconds;\n duration.nanos = end.nanos - start.nanos;\n\n if (duration.seconds \u003c 0 \u0026\u0026 duration.nanos \u003e 0) {\n duration.seconds += 1;\n duration.nanos -= 1000000000;\n } else if (durations.seconds \u003e 0 \u0026\u0026 duration.nanos \u003c 0) {\n duration.seconds -= 1;\n duration.nanos += 1000000000;\n }\n\nExample 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n\n Timestamp start = ...;\n Duration duration = ...;\n Timestamp end = ...;\n\n end.seconds = start.seconds + duration.seconds;\n end.nanos = start.nanos + duration.nanos;\n\n if (end.nanos \u003c 0) {\n end.seconds -= 1;\n end.nanos += 1000000000;\n } else if (end.nanos \u003e= 1000000000) {\n end.seconds += 1;\n end.nanos -= 1000000000;\n }\n\nExample 3: Compute Duration from datetime.timedelta in Python.\n\n td = datetime.timedelta(days=3, minutes=10)\n duration = Duration()\n duration.FromTimedelta(td)"
|
||||
},
|
||||
"protobufEmpty": {
|
||||
"type": "object",
|
||||
"description": "service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.",
|
||||
"title": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:"
|
||||
},
|
||||
"sub2IdMessage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"uuid": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subStringMessage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
207
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.go
generated
vendored
Normal file
207
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.go
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: examples/examplepb/echo_service.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package examplepb is a generated protocol buffer package.
|
||||
|
||||
Echo Service
|
||||
|
||||
Echo Service API consists of a single service which returns
|
||||
a message.
|
||||
|
||||
It is generated from these files:
|
||||
examples/examplepb/echo_service.proto
|
||||
examples/examplepb/a_bit_of_everything.proto
|
||||
examples/examplepb/stream.proto
|
||||
examples/examplepb/flow_combination.proto
|
||||
|
||||
It has these top-level messages:
|
||||
SimpleMessage
|
||||
ABitOfEverything
|
||||
EmptyProto
|
||||
NonEmptyProto
|
||||
UnaryProto
|
||||
NestedProto
|
||||
SingleNestedProto
|
||||
*/
|
||||
package examplepb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// SimpleMessage represents a simple message sent to the Echo service.
|
||||
type SimpleMessage struct {
|
||||
// Id represents the message identifier.
|
||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SimpleMessage) Reset() { *m = SimpleMessage{} }
|
||||
func (m *SimpleMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleMessage) ProtoMessage() {}
|
||||
func (*SimpleMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *SimpleMessage) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*SimpleMessage)(nil), "grpc.gateway.examples.examplepb.SimpleMessage")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for EchoService service
|
||||
|
||||
type EchoServiceClient interface {
|
||||
// Echo method receives a simple message and returns it.
|
||||
//
|
||||
// The message posted as the id parameter will also be
|
||||
// returned.
|
||||
Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
|
||||
// EchoBody method receives a simple message and returns it.
|
||||
EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error)
|
||||
}
|
||||
|
||||
type echoServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewEchoServiceClient(cc *grpc.ClientConn) EchoServiceClient {
|
||||
return &echoServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *echoServiceClient) Echo(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) {
|
||||
out := new(SimpleMessage)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/Echo", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *echoServiceClient) EchoBody(ctx context.Context, in *SimpleMessage, opts ...grpc.CallOption) (*SimpleMessage, error) {
|
||||
out := new(SimpleMessage)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.EchoService/EchoBody", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for EchoService service
|
||||
|
||||
type EchoServiceServer interface {
|
||||
// Echo method receives a simple message and returns it.
|
||||
//
|
||||
// The message posted as the id parameter will also be
|
||||
// returned.
|
||||
Echo(context.Context, *SimpleMessage) (*SimpleMessage, error)
|
||||
// EchoBody method receives a simple message and returns it.
|
||||
EchoBody(context.Context, *SimpleMessage) (*SimpleMessage, error)
|
||||
}
|
||||
|
||||
func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer) {
|
||||
s.RegisterService(&_EchoService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _EchoService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SimpleMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EchoServiceServer).Echo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.EchoService/Echo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EchoServiceServer).Echo(ctx, req.(*SimpleMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _EchoService_EchoBody_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SimpleMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EchoServiceServer).EchoBody(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.EchoService/EchoBody",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EchoServiceServer).EchoBody(ctx, req.(*SimpleMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _EchoService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.gateway.examples.examplepb.EchoService",
|
||||
HandlerType: (*EchoServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Echo",
|
||||
Handler: _EchoService_Echo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "EchoBody",
|
||||
Handler: _EchoService_EchoBody_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "examples/examplepb/echo_service.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("examples/examplepb/echo_service.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 229 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xad, 0x48, 0xcc,
|
||||
0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x87, 0x32, 0x0a, 0x92, 0xf4, 0x53, 0x93, 0x33, 0xf2, 0xe3, 0x8b,
|
||||
0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xe4, 0xd3, 0x8b,
|
||||
0x0a, 0x92, 0xf5, 0xd2, 0x13, 0x4b, 0x52, 0xcb, 0x13, 0x2b, 0xf5, 0x60, 0x7a, 0xf4, 0xe0, 0x7a,
|
||||
0xa4, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2,
|
||||
0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xda, 0x95, 0xe4, 0xb9, 0x78, 0x83, 0x33,
|
||||
0x41, 0x2a, 0x7d, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x85, 0xf8, 0xb8, 0x98, 0x32, 0x53, 0x24,
|
||||
0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x8c, 0x96, 0x30, 0x71, 0x71, 0xbb, 0x26,
|
||||
0x67, 0xe4, 0x07, 0x43, 0x6c, 0x15, 0x6a, 0x65, 0xe4, 0x62, 0x01, 0xf1, 0x85, 0xf4, 0xf4, 0x08,
|
||||
0xd8, 0xac, 0x87, 0x62, 0xb0, 0x14, 0x89, 0xea, 0x95, 0x64, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, 0x24,
|
||||
0xae, 0x24, 0xaa, 0x5f, 0x66, 0x08, 0x0b, 0x02, 0x70, 0x00, 0xe8, 0x57, 0x67, 0xa6, 0xd4, 0x0a,
|
||||
0xf5, 0x30, 0x72, 0x71, 0x80, 0xdc, 0xe1, 0x94, 0x9f, 0x52, 0x49, 0x73, 0xb7, 0x28, 0x80, 0xdd,
|
||||
0x22, 0x85, 0xe9, 0x96, 0xf8, 0xa4, 0xfc, 0x94, 0x4a, 0x2b, 0x46, 0x2d, 0x27, 0xee, 0x28, 0x4e,
|
||||
0xb8, 0xe6, 0x24, 0x36, 0x70, 0xd8, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x26, 0x96, 0x37,
|
||||
0xac, 0xc3, 0x01, 0x00, 0x00,
|
||||
}
|
169
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.gw.go
generated
vendored
Normal file
169
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.pb.gw.go
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
// Code generated by protoc-gen-grpc-gateway
|
||||
// source: examples/examplepb/echo_service.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package examplepb is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package examplepb
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
|
||||
func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SimpleMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_EchoService_EchoBody_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SimpleMessage
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.EchoBody(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterEchoServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
client := NewEchoServiceClient(conn)
|
||||
|
||||
mux.Handle("POST", pattern_EchoService_Echo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_EchoService_Echo_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_EchoService_Echo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_EchoService_EchoBody_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_EchoService_EchoBody_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_EchoService_EchoBody_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_EchoService_Echo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "echo", "id"}, ""))
|
||||
|
||||
pattern_EchoService_EchoBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "echo_body"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_EchoService_Echo_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_EchoService_EchoBody_0 = runtime.ForwardResponseMessage
|
||||
)
|
36
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.proto
generated
vendored
Normal file
36
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.proto
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "examplepb";
|
||||
|
||||
// Echo Service
|
||||
//
|
||||
// Echo Service API consists of a single service which returns
|
||||
// a message.
|
||||
package grpc.gateway.examples.examplepb;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
// SimpleMessage represents a simple message sent to the Echo service.
|
||||
message SimpleMessage {
|
||||
// Id represents the message identifier.
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// Echo service responds to incoming echo requests.
|
||||
service EchoService {
|
||||
// Echo method receives a simple message and returns it.
|
||||
//
|
||||
// The message posted as the id parameter will also be
|
||||
// returned.
|
||||
rpc Echo(SimpleMessage) returns (SimpleMessage) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/echo/{id}"
|
||||
};
|
||||
}
|
||||
// EchoBody method receives a simple message and returns it.
|
||||
rpc EchoBody(SimpleMessage) returns (SimpleMessage) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/echo_body"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
85
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.swagger.json
generated
vendored
Normal file
85
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/echo_service.swagger.json
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Echo Service",
|
||||
"description": "Echo Service API consists of a single service which returns\na message.",
|
||||
"version": "version not set"
|
||||
},
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/v1/example/echo/{id}": {
|
||||
"post": {
|
||||
"summary": "Echo method receives a simple message and returns it.",
|
||||
"description": "The message posted as the id parameter will also be\nreturned.",
|
||||
"operationId": "Echo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbSimpleMessage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"EchoService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/example/echo_body": {
|
||||
"post": {
|
||||
"summary": "EchoBody method receives a simple message and returns it.",
|
||||
"operationId": "EchoBody",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbSimpleMessage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/examplepbSimpleMessage"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"EchoService"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"examplepbSimpleMessage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Id represents the message identifier."
|
||||
}
|
||||
},
|
||||
"description": "SimpleMessage represents a simple message sent to the Echo service."
|
||||
}
|
||||
}
|
||||
}
|
723
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.go
generated
vendored
Normal file
723
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.go
generated
vendored
Normal file
@@ -0,0 +1,723 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: examples/examplepb/flow_combination.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package examplepb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type EmptyProto struct {
|
||||
}
|
||||
|
||||
func (m *EmptyProto) Reset() { *m = EmptyProto{} }
|
||||
func (m *EmptyProto) String() string { return proto.CompactTextString(m) }
|
||||
func (*EmptyProto) ProtoMessage() {}
|
||||
func (*EmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
|
||||
type NonEmptyProto struct {
|
||||
A string `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
|
||||
B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"`
|
||||
C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"`
|
||||
}
|
||||
|
||||
func (m *NonEmptyProto) Reset() { *m = NonEmptyProto{} }
|
||||
func (m *NonEmptyProto) String() string { return proto.CompactTextString(m) }
|
||||
func (*NonEmptyProto) ProtoMessage() {}
|
||||
func (*NonEmptyProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
|
||||
|
||||
func (m *NonEmptyProto) GetA() string {
|
||||
if m != nil {
|
||||
return m.A
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NonEmptyProto) GetB() string {
|
||||
if m != nil {
|
||||
return m.B
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NonEmptyProto) GetC() string {
|
||||
if m != nil {
|
||||
return m.C
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UnaryProto struct {
|
||||
Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UnaryProto) Reset() { *m = UnaryProto{} }
|
||||
func (m *UnaryProto) String() string { return proto.CompactTextString(m) }
|
||||
func (*UnaryProto) ProtoMessage() {}
|
||||
func (*UnaryProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} }
|
||||
|
||||
func (m *UnaryProto) GetStr() string {
|
||||
if m != nil {
|
||||
return m.Str
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type NestedProto struct {
|
||||
A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
|
||||
B string `protobuf:"bytes,2,opt,name=b" json:"b,omitempty"`
|
||||
C string `protobuf:"bytes,3,opt,name=c" json:"c,omitempty"`
|
||||
}
|
||||
|
||||
func (m *NestedProto) Reset() { *m = NestedProto{} }
|
||||
func (m *NestedProto) String() string { return proto.CompactTextString(m) }
|
||||
func (*NestedProto) ProtoMessage() {}
|
||||
func (*NestedProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{3} }
|
||||
|
||||
func (m *NestedProto) GetA() *UnaryProto {
|
||||
if m != nil {
|
||||
return m.A
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NestedProto) GetB() string {
|
||||
if m != nil {
|
||||
return m.B
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NestedProto) GetC() string {
|
||||
if m != nil {
|
||||
return m.C
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SingleNestedProto struct {
|
||||
A *UnaryProto `protobuf:"bytes,1,opt,name=a" json:"a,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SingleNestedProto) Reset() { *m = SingleNestedProto{} }
|
||||
func (m *SingleNestedProto) String() string { return proto.CompactTextString(m) }
|
||||
func (*SingleNestedProto) ProtoMessage() {}
|
||||
func (*SingleNestedProto) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{4} }
|
||||
|
||||
func (m *SingleNestedProto) GetA() *UnaryProto {
|
||||
if m != nil {
|
||||
return m.A
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*EmptyProto)(nil), "grpc.gateway.examples.examplepb.EmptyProto")
|
||||
proto.RegisterType((*NonEmptyProto)(nil), "grpc.gateway.examples.examplepb.NonEmptyProto")
|
||||
proto.RegisterType((*UnaryProto)(nil), "grpc.gateway.examples.examplepb.UnaryProto")
|
||||
proto.RegisterType((*NestedProto)(nil), "grpc.gateway.examples.examplepb.NestedProto")
|
||||
proto.RegisterType((*SingleNestedProto)(nil), "grpc.gateway.examples.examplepb.SingleNestedProto")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for FlowCombination service
|
||||
|
||||
type FlowCombinationClient interface {
|
||||
RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error)
|
||||
RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error)
|
||||
StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error)
|
||||
StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error)
|
||||
RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error)
|
||||
RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error)
|
||||
RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error)
|
||||
RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error)
|
||||
RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error)
|
||||
RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error)
|
||||
}
|
||||
|
||||
type flowCombinationClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewFlowCombinationClient(cc *grpc.ClientConn) FlowCombinationClient {
|
||||
return &flowCombinationClient{cc}
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcEmptyRpc(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) {
|
||||
out := new(EmptyProto)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcEmptyStream(ctx context.Context, in *EmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcEmptyStreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyStream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &flowCombinationRpcEmptyStreamClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FlowCombination_RpcEmptyStreamClient interface {
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcEmptyStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcEmptyStreamClient) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) StreamEmptyRpc(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyRpcClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyRpc", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &flowCombinationStreamEmptyRpcClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FlowCombination_StreamEmptyRpcClient interface {
|
||||
Send(*EmptyProto) error
|
||||
CloseAndRecv() (*EmptyProto, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type flowCombinationStreamEmptyRpcClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyRpcClient) Send(m *EmptyProto) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyRpcClient) CloseAndRecv() (*EmptyProto, error) {
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := new(EmptyProto)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) StreamEmptyStream(ctx context.Context, opts ...grpc.CallOption) (FlowCombination_StreamEmptyStreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/StreamEmptyStream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &flowCombinationStreamEmptyStreamClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FlowCombination_StreamEmptyStreamClient interface {
|
||||
Send(*EmptyProto) error
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type flowCombinationStreamEmptyStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyStreamClient) Send(m *EmptyProto) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyStreamClient) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcBodyRpc(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (*EmptyProto, error) {
|
||||
out := new(EmptyProto)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcPathSingleNestedRpc(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (*EmptyProto, error) {
|
||||
out := new(EmptyProto)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcPathNestedRpc(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (*EmptyProto, error) {
|
||||
out := new(EmptyProto)
|
||||
err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcBodyStream(ctx context.Context, in *NonEmptyProto, opts ...grpc.CallOption) (FlowCombination_RpcBodyStreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[3], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyStream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &flowCombinationRpcBodyStreamClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FlowCombination_RpcBodyStreamClient interface {
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcBodyStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcBodyStreamClient) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcPathSingleNestedStream(ctx context.Context, in *SingleNestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathSingleNestedStreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[4], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedStream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &flowCombinationRpcPathSingleNestedStreamClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FlowCombination_RpcPathSingleNestedStreamClient interface {
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcPathSingleNestedStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcPathSingleNestedStreamClient) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *flowCombinationClient) RpcPathNestedStream(ctx context.Context, in *NestedProto, opts ...grpc.CallOption) (FlowCombination_RpcPathNestedStreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_FlowCombination_serviceDesc.Streams[5], c.cc, "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedStream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &flowCombinationRpcPathNestedStreamClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FlowCombination_RpcPathNestedStreamClient interface {
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcPathNestedStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcPathNestedStreamClient) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for FlowCombination service
|
||||
|
||||
type FlowCombinationServer interface {
|
||||
RpcEmptyRpc(context.Context, *EmptyProto) (*EmptyProto, error)
|
||||
RpcEmptyStream(*EmptyProto, FlowCombination_RpcEmptyStreamServer) error
|
||||
StreamEmptyRpc(FlowCombination_StreamEmptyRpcServer) error
|
||||
StreamEmptyStream(FlowCombination_StreamEmptyStreamServer) error
|
||||
RpcBodyRpc(context.Context, *NonEmptyProto) (*EmptyProto, error)
|
||||
RpcPathSingleNestedRpc(context.Context, *SingleNestedProto) (*EmptyProto, error)
|
||||
RpcPathNestedRpc(context.Context, *NestedProto) (*EmptyProto, error)
|
||||
RpcBodyStream(*NonEmptyProto, FlowCombination_RpcBodyStreamServer) error
|
||||
RpcPathSingleNestedStream(*SingleNestedProto, FlowCombination_RpcPathSingleNestedStreamServer) error
|
||||
RpcPathNestedStream(*NestedProto, FlowCombination_RpcPathNestedStreamServer) error
|
||||
}
|
||||
|
||||
func RegisterFlowCombinationServer(s *grpc.Server, srv FlowCombinationServer) {
|
||||
s.RegisterService(&_FlowCombination_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcEmptyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(EmptyProto)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcEmptyRpc",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FlowCombinationServer).RpcEmptyRpc(ctx, req.(*EmptyProto))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(EmptyProto)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(FlowCombinationServer).RpcEmptyStream(m, &flowCombinationRpcEmptyStreamServer{stream})
|
||||
}
|
||||
|
||||
type FlowCombination_RpcEmptyStreamServer interface {
|
||||
Send(*EmptyProto) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcEmptyStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcEmptyStreamServer) Send(m *EmptyProto) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _FlowCombination_StreamEmptyRpc_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(FlowCombinationServer).StreamEmptyRpc(&flowCombinationStreamEmptyRpcServer{stream})
|
||||
}
|
||||
|
||||
type FlowCombination_StreamEmptyRpcServer interface {
|
||||
SendAndClose(*EmptyProto) error
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type flowCombinationStreamEmptyRpcServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyRpcServer) SendAndClose(m *EmptyProto) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyRpcServer) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _FlowCombination_StreamEmptyStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(FlowCombinationServer).StreamEmptyStream(&flowCombinationStreamEmptyStreamServer{stream})
|
||||
}
|
||||
|
||||
type FlowCombination_StreamEmptyStreamServer interface {
|
||||
Send(*EmptyProto) error
|
||||
Recv() (*EmptyProto, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type flowCombinationStreamEmptyStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyStreamServer) Send(m *EmptyProto) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *flowCombinationStreamEmptyStreamServer) Recv() (*EmptyProto, error) {
|
||||
m := new(EmptyProto)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcBodyRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NonEmptyProto)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FlowCombinationServer).RpcBodyRpc(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcBodyRpc",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FlowCombinationServer).RpcBodyRpc(ctx, req.(*NonEmptyProto))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcPathSingleNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SingleNestedProto)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathSingleNestedRpc",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FlowCombinationServer).RpcPathSingleNestedRpc(ctx, req.(*SingleNestedProto))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcPathNestedRpc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NestedProto)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.gateway.examples.examplepb.FlowCombination/RpcPathNestedRpc",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FlowCombinationServer).RpcPathNestedRpc(ctx, req.(*NestedProto))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcBodyStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(NonEmptyProto)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(FlowCombinationServer).RpcBodyStream(m, &flowCombinationRpcBodyStreamServer{stream})
|
||||
}
|
||||
|
||||
type FlowCombination_RpcBodyStreamServer interface {
|
||||
Send(*EmptyProto) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcBodyStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcBodyStreamServer) Send(m *EmptyProto) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcPathSingleNestedStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(SingleNestedProto)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(FlowCombinationServer).RpcPathSingleNestedStream(m, &flowCombinationRpcPathSingleNestedStreamServer{stream})
|
||||
}
|
||||
|
||||
type FlowCombination_RpcPathSingleNestedStreamServer interface {
|
||||
Send(*EmptyProto) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcPathSingleNestedStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcPathSingleNestedStreamServer) Send(m *EmptyProto) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _FlowCombination_RpcPathNestedStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(NestedProto)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(FlowCombinationServer).RpcPathNestedStream(m, &flowCombinationRpcPathNestedStreamServer{stream})
|
||||
}
|
||||
|
||||
type FlowCombination_RpcPathNestedStreamServer interface {
|
||||
Send(*EmptyProto) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type flowCombinationRpcPathNestedStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *flowCombinationRpcPathNestedStreamServer) Send(m *EmptyProto) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
var _FlowCombination_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.gateway.examples.examplepb.FlowCombination",
|
||||
HandlerType: (*FlowCombinationServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "RpcEmptyRpc",
|
||||
Handler: _FlowCombination_RpcEmptyRpc_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RpcBodyRpc",
|
||||
Handler: _FlowCombination_RpcBodyRpc_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RpcPathSingleNestedRpc",
|
||||
Handler: _FlowCombination_RpcPathSingleNestedRpc_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RpcPathNestedRpc",
|
||||
Handler: _FlowCombination_RpcPathNestedRpc_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "RpcEmptyStream",
|
||||
Handler: _FlowCombination_RpcEmptyStream_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "StreamEmptyRpc",
|
||||
Handler: _FlowCombination_StreamEmptyRpc_Handler,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "StreamEmptyStream",
|
||||
Handler: _FlowCombination_StreamEmptyStream_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "RpcBodyStream",
|
||||
Handler: _FlowCombination_RpcBodyStream_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "RpcPathSingleNestedStream",
|
||||
Handler: _FlowCombination_RpcPathSingleNestedStream_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "RpcPathNestedStream",
|
||||
Handler: _FlowCombination_RpcPathNestedStream_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "examples/examplepb/flow_combination.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("examples/examplepb/flow_combination.proto", fileDescriptor3) }
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 656 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x3f, 0x8f, 0x12, 0x4f,
|
||||
0x18, 0xc7, 0xf3, 0x70, 0xc9, 0x2f, 0xb9, 0xe1, 0xfe, 0x70, 0xcb, 0x2f, 0x08, 0x1c, 0x1e, 0x77,
|
||||
0xe3, 0x25, 0xe2, 0xbf, 0x5d, 0x82, 0xd5, 0x51, 0x9e, 0xd1, 0x92, 0x5c, 0xb8, 0xd8, 0x6c, 0x63,
|
||||
0x66, 0x87, 0x15, 0x48, 0x60, 0x67, 0x6e, 0x77, 0x0d, 0x5e, 0x08, 0x31, 0xb1, 0xb1, 0xb4, 0xf0,
|
||||
0x05, 0x58, 0x5a, 0xf9, 0x06, 0xec, 0xac, 0x6c, 0x4c, 0x2c, 0x4c, 0xec, 0xec, 0xec, 0x7c, 0x13,
|
||||
0x66, 0x67, 0x66, 0x77, 0x58, 0x05, 0x37, 0x18, 0xb1, 0xdb, 0x99, 0x79, 0x9e, 0x67, 0x3e, 0xf3,
|
||||
0x7d, 0xbe, 0x0f, 0x01, 0xdd, 0x70, 0x9f, 0x92, 0x31, 0x1f, 0xb9, 0x81, 0xa5, 0x3e, 0xb8, 0x63,
|
||||
0x3d, 0x1e, 0xb1, 0xc9, 0x23, 0xca, 0xc6, 0xce, 0xd0, 0x23, 0xe1, 0x90, 0x79, 0x26, 0xf7, 0x59,
|
||||
0xc8, 0x8c, 0x7a, 0xdf, 0xe7, 0xd4, 0xec, 0x93, 0xd0, 0x9d, 0x90, 0x4b, 0x33, 0xce, 0x33, 0x93,
|
||||
0xbc, 0x6a, 0xad, 0xcf, 0x58, 0x7f, 0xe4, 0x5a, 0x84, 0x0f, 0x2d, 0xe2, 0x79, 0x2c, 0x14, 0xd9,
|
||||
0x81, 0x4c, 0xc7, 0x5b, 0x08, 0xdd, 0x1f, 0xf3, 0xf0, 0xf2, 0x4c, 0xac, 0x4e, 0xd0, 0x76, 0x87,
|
||||
0x79, 0x7a, 0xc3, 0xd8, 0x42, 0x40, 0xca, 0x70, 0x08, 0x8d, 0xcd, 0x2e, 0x90, 0x68, 0xe5, 0x94,
|
||||
0x73, 0x72, 0xe5, 0x44, 0x2b, 0x5a, 0xde, 0x90, 0x2b, 0x8a, 0x0f, 0x10, 0x7a, 0xe8, 0x11, 0x5f,
|
||||
0xe5, 0x15, 0xd0, 0x46, 0x10, 0xfa, 0x2a, 0x33, 0xfa, 0xc4, 0x3d, 0x94, 0xef, 0xb8, 0x41, 0xe8,
|
||||
0xf6, 0x64, 0xc0, 0x49, 0x5c, 0x38, 0xdf, 0xba, 0x65, 0x66, 0x3c, 0xc1, 0xd4, 0x85, 0xb3, 0x28,
|
||||
0x3a, 0x68, 0xef, 0x7c, 0xe8, 0xf5, 0x47, 0xee, 0xdf, 0xb9, 0xab, 0xf5, 0x71, 0x17, 0xed, 0x3e,
|
||||
0x18, 0xb1, 0xc9, 0x3d, 0xad, 0xbb, 0xf1, 0x0c, 0xe5, 0xbb, 0x9c, 0x0a, 0x91, 0xba, 0x9c, 0x1a,
|
||||
0xd9, 0x25, 0xb5, 0x9e, 0xd5, 0x55, 0x82, 0x71, 0xe9, 0xf9, 0xe7, 0x6f, 0xaf, 0x72, 0x05, 0xbc,
|
||||
0x63, 0xf9, 0x9c, 0x5a, 0x6e, 0x74, 0x10, 0x7d, 0x19, 0x2f, 0x00, 0xed, 0xc4, 0x04, 0xe7, 0xa1,
|
||||
0xef, 0x92, 0xf1, 0x1a, 0x21, 0x2a, 0x02, 0xa2, 0x88, 0xf7, 0xe6, 0x20, 0x02, 0x71, 0x69, 0x13,
|
||||
0x04, 0x89, 0x24, 0xf8, 0x07, 0x72, 0x68, 0x12, 0x79, 0xbf, 0x56, 0xa4, 0x01, 0xc6, 0x4b, 0x40,
|
||||
0x7b, 0x73, 0x24, 0x6b, 0x97, 0xa5, 0x26, 0x60, 0x4a, 0xf8, 0xff, 0x34, 0x8c, 0x5c, 0x34, 0xa0,
|
||||
0x09, 0xc6, 0xdb, 0x1c, 0x42, 0x5d, 0x4e, 0x4f, 0x59, 0x4f, 0xe8, 0x62, 0x66, 0x56, 0x4f, 0x4d,
|
||||
0xde, 0x6a, 0x34, 0xef, 0x41, 0xe0, 0xbc, 0x03, 0xbc, 0x2d, 0xda, 0xe4, 0xb0, 0x9e, 0x10, 0xa6,
|
||||
0x0d, 0x37, 0xed, 0x7d, 0x5c, 0x11, 0x7b, 0x9c, 0x84, 0x03, 0x6b, 0x4a, 0x66, 0xd6, 0xd4, 0x99,
|
||||
0x59, 0x53, 0x3a, 0x8b, 0x36, 0xed, 0xd8, 0x5c, 0x17, 0x4f, 0x5c, 0x5f, 0x64, 0xd8, 0x75, 0x5c,
|
||||
0xd5, 0x25, 0x52, 0x39, 0xa2, 0x1e, 0xb5, 0xcb, 0xb8, 0xa8, 0x03, 0x92, 0xbc, 0xe8, 0xe4, 0x08,
|
||||
0xd7, 0x16, 0xa4, 0xa6, 0x42, 0x2a, 0xf8, 0x4a, 0x1a, 0x26, 0x39, 0x35, 0x5e, 0x03, 0x2a, 0x75,
|
||||
0x39, 0x3d, 0x23, 0xe1, 0x60, 0x7e, 0x84, 0x23, 0xed, 0x5a, 0x99, 0x5a, 0xfc, 0x32, 0xf4, 0xab,
|
||||
0xe9, 0x77, 0x2c, 0xe4, 0x3b, 0x50, 0xfc, 0x11, 0xdc, 0x1d, 0x4f, 0xd4, 0xb2, 0xa6, 0xc4, 0x0c,
|
||||
0x42, 0x5f, 0x3c, 0xde, 0xf8, 0x0a, 0xa8, 0xa0, 0x08, 0x35, 0xdb, 0xed, 0xec, 0xbe, 0xfe, 0x29,
|
||||
0x95, 0x27, 0xa8, 0x06, 0xf8, 0x70, 0x29, 0xd5, 0x5c, 0x5b, 0x32, 0xe0, 0x93, 0xe6, 0x2c, 0x39,
|
||||
0x6f, 0x03, 0x35, 0x3e, 0xe4, 0xd0, 0xb6, 0x72, 0xac, 0x9a, 0x9f, 0xb5, 0x9a, 0xf6, 0x8b, 0x34,
|
||||
0xed, 0x27, 0xc0, 0x05, 0x6d, 0x1b, 0x39, 0x40, 0x91, 0x6f, 0xe7, 0x1f, 0x94, 0xf2, 0xad, 0x0c,
|
||||
0xb1, 0xe3, 0x9f, 0x24, 0xe9, 0x20, 0xb5, 0x89, 0xf1, 0xd5, 0x25, 0xee, 0x8d, 0x0b, 0x53, 0x7b,
|
||||
0x1f, 0x97, 0x7e, 0x36, 0xb0, 0x3e, 0x3c, 0xc6, 0xf5, 0xa5, 0x1e, 0xd6, 0x51, 0x35, 0x35, 0x24,
|
||||
0x0b, 0x03, 0x9a, 0x60, 0xbc, 0x01, 0x54, 0x59, 0xe0, 0x65, 0xa5, 0xea, 0xda, 0xed, 0x7c, 0x5d,
|
||||
0x08, 0x7b, 0xa4, 0x9e, 0xb2, 0xa8, 0xe3, 0x09, 0xe9, 0x77, 0x40, 0xc5, 0x94, 0xa7, 0x15, 0xe3,
|
||||
0x1a, 0x6d, 0x3d, 0x11, 0x74, 0x17, 0xf8, 0xda, 0x6f, 0x6d, 0xad, 0xc5, 0xce, 0x7e, 0x47, 0xd2,
|
||||
0xb5, 0xe5, 0x21, 0x6d, 0xa0, 0x4d, 0x38, 0xcd, 0xdb, 0x9b, 0x09, 0x92, 0xf3, 0x9f, 0xf8, 0x07,
|
||||
0x74, 0xf7, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x85, 0xaf, 0x3c, 0x6d, 0x09, 0x00, 0x00,
|
||||
}
|
1854
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.gw.go
generated
vendored
Normal file
1854
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.pb.gw.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
168
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.proto
generated
vendored
Normal file
168
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/flow_combination.proto
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "examplepb";
|
||||
package grpc.gateway.examples.examplepb;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
message EmptyProto {}
|
||||
|
||||
message NonEmptyProto {
|
||||
string a = 1;
|
||||
string b = 2;
|
||||
string c = 3;
|
||||
}
|
||||
|
||||
message UnaryProto {
|
||||
string str = 1;
|
||||
}
|
||||
|
||||
message NestedProto {
|
||||
UnaryProto a = 1;
|
||||
string b = 2;
|
||||
string c = 3;
|
||||
}
|
||||
|
||||
message SingleNestedProto {
|
||||
UnaryProto a = 1;
|
||||
}
|
||||
|
||||
service FlowCombination {
|
||||
rpc RpcEmptyRpc(EmptyProto) returns (EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
post: "/rpc/empty/rpc"
|
||||
};
|
||||
}
|
||||
rpc RpcEmptyStream(EmptyProto) returns (stream EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
post: "/rpc/empty/stream"
|
||||
};
|
||||
}
|
||||
rpc StreamEmptyRpc(stream EmptyProto) returns (EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
post: "/stream/empty/rpc"
|
||||
};
|
||||
}
|
||||
rpc StreamEmptyStream(stream EmptyProto) returns (stream EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
post: "/stream/empty/stream"
|
||||
};
|
||||
}
|
||||
|
||||
rpc RpcBodyRpc(NonEmptyProto) returns (EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
// w/ body; w/o path; w/o query
|
||||
post: "/rpc/body/rpc"
|
||||
body: "*"
|
||||
|
||||
// w/o body; w/ path; w/o query
|
||||
additional_bindings {
|
||||
post: "/rpc/path/{a}/{b}/{c}/rpc"
|
||||
}
|
||||
// w/o body; w/o path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/query/rpc"
|
||||
}
|
||||
// w/ body; w/ path; w/o query
|
||||
additional_bindings {
|
||||
post: "/rpc/body/path/{a}/{b}/rpc"
|
||||
body: "c"
|
||||
}
|
||||
// w/ body; w/o path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/body/query/rpc"
|
||||
body: "c"
|
||||
}
|
||||
// w/ body; w/ path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/body/path/{a}/query/rpc"
|
||||
body: "c"
|
||||
}
|
||||
// w/o body; w/ path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/path/{a}/query/rpc"
|
||||
}
|
||||
};
|
||||
}
|
||||
rpc RpcPathSingleNestedRpc(SingleNestedProto) returns (EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
// w/o body; w/ path (IsNestedProto3); w/o query
|
||||
post: "/rpc/path-nested/{a.str}/rpc"
|
||||
};
|
||||
}
|
||||
rpc RpcPathNestedRpc(NestedProto) returns (EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
// w/ body; w/ path (IsNestedProto3); w/o query
|
||||
post: "/rpc/path-nested/{a.str}/{b}/rpc"
|
||||
body: "c"
|
||||
|
||||
// w/o body; w/ path (IsNestedProto3); w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/path-nested/{a.str}/rpc"
|
||||
}
|
||||
// w/ body; w/ path (IsNestedProto3); w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/path-nested/{a.str}/rpc"
|
||||
body: "c"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
rpc RpcBodyStream(NonEmptyProto) returns (stream EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
// w/ body; w/o path; w/o query
|
||||
post: "/rpc/body/stream"
|
||||
body: "*"
|
||||
|
||||
// w/o body; w/ path; w/o query
|
||||
additional_bindings {
|
||||
post: "/rpc/path/{a}/{b}/{c}/stream"
|
||||
}
|
||||
// w/o body; w/o path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/query/stream"
|
||||
}
|
||||
// w/ body; w/ path; w/o query
|
||||
additional_bindings {
|
||||
post: "/rpc/body/path/{a}/{b}/stream"
|
||||
body: "c"
|
||||
}
|
||||
// w/ body; w/o path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/body/query/stream"
|
||||
body: "c"
|
||||
}
|
||||
// w/ body; w/ path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/body/path/{a}/query/stream"
|
||||
body: "c"
|
||||
}
|
||||
// w/o body; w/ path; w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/path/{a}/query/stream"
|
||||
}
|
||||
};
|
||||
}
|
||||
rpc RpcPathSingleNestedStream(SingleNestedProto) returns (stream EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
// w/o body; w/ path (IsNestedProto3); w/o query
|
||||
post: "/rpc/path-nested/{a.str}/stream"
|
||||
};
|
||||
}
|
||||
rpc RpcPathNestedStream(NestedProto) returns (stream EmptyProto) {
|
||||
option (google.api.http) = {
|
||||
// w/ body; w/ path (IsNestedProto3); w/o query
|
||||
post: "/rpc/path-nested/{a.str}/{b}/stream"
|
||||
body: "c"
|
||||
|
||||
// w/o body; w/ path (IsNestedProto3); w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/path-nested/{a.str}/stream"
|
||||
}
|
||||
// w/ body; w/ path (IsNestedProto3); w/ query
|
||||
additional_bindings {
|
||||
post: "/rpc/path-nested/{a.str}/stream"
|
||||
body: "c"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
279
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.go
generated
vendored
Normal file
279
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.go
generated
vendored
Normal file
@@ -0,0 +1,279 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: examples/examplepb/stream.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package examplepb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
import google_protobuf1 "github.com/golang/protobuf/ptypes/empty"
|
||||
import grpc_gateway_examples_sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for StreamService service
|
||||
|
||||
type StreamServiceClient interface {
|
||||
BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error)
|
||||
List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error)
|
||||
BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error)
|
||||
}
|
||||
|
||||
type streamServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewStreamServiceClient(cc *grpc.ClientConn) StreamServiceClient {
|
||||
return &streamServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *streamServiceClient) BulkCreate(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkCreateClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[0], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkCreate", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &streamServiceBulkCreateClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type StreamService_BulkCreateClient interface {
|
||||
Send(*ABitOfEverything) error
|
||||
CloseAndRecv() (*google_protobuf1.Empty, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type streamServiceBulkCreateClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkCreateClient) Send(m *ABitOfEverything) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkCreateClient) CloseAndRecv() (*google_protobuf1.Empty, error) {
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := new(google_protobuf1.Empty)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *streamServiceClient) List(ctx context.Context, in *google_protobuf1.Empty, opts ...grpc.CallOption) (StreamService_ListClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[1], c.cc, "/grpc.gateway.examples.examplepb.StreamService/List", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &streamServiceListClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type StreamService_ListClient interface {
|
||||
Recv() (*ABitOfEverything, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type streamServiceListClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *streamServiceListClient) Recv() (*ABitOfEverything, error) {
|
||||
m := new(ABitOfEverything)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *streamServiceClient) BulkEcho(ctx context.Context, opts ...grpc.CallOption) (StreamService_BulkEchoClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_StreamService_serviceDesc.Streams[2], c.cc, "/grpc.gateway.examples.examplepb.StreamService/BulkEcho", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &streamServiceBulkEchoClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type StreamService_BulkEchoClient interface {
|
||||
Send(*grpc_gateway_examples_sub.StringMessage) error
|
||||
Recv() (*grpc_gateway_examples_sub.StringMessage, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type streamServiceBulkEchoClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkEchoClient) Send(m *grpc_gateway_examples_sub.StringMessage) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkEchoClient) Recv() (*grpc_gateway_examples_sub.StringMessage, error) {
|
||||
m := new(grpc_gateway_examples_sub.StringMessage)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for StreamService service
|
||||
|
||||
type StreamServiceServer interface {
|
||||
BulkCreate(StreamService_BulkCreateServer) error
|
||||
List(*google_protobuf1.Empty, StreamService_ListServer) error
|
||||
BulkEcho(StreamService_BulkEchoServer) error
|
||||
}
|
||||
|
||||
func RegisterStreamServiceServer(s *grpc.Server, srv StreamServiceServer) {
|
||||
s.RegisterService(&_StreamService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _StreamService_BulkCreate_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(StreamServiceServer).BulkCreate(&streamServiceBulkCreateServer{stream})
|
||||
}
|
||||
|
||||
type StreamService_BulkCreateServer interface {
|
||||
SendAndClose(*google_protobuf1.Empty) error
|
||||
Recv() (*ABitOfEverything, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type streamServiceBulkCreateServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkCreateServer) SendAndClose(m *google_protobuf1.Empty) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkCreateServer) Recv() (*ABitOfEverything, error) {
|
||||
m := new(ABitOfEverything)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _StreamService_List_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(google_protobuf1.Empty)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(StreamServiceServer).List(m, &streamServiceListServer{stream})
|
||||
}
|
||||
|
||||
type StreamService_ListServer interface {
|
||||
Send(*ABitOfEverything) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type streamServiceListServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *streamServiceListServer) Send(m *ABitOfEverything) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _StreamService_BulkEcho_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(StreamServiceServer).BulkEcho(&streamServiceBulkEchoServer{stream})
|
||||
}
|
||||
|
||||
type StreamService_BulkEchoServer interface {
|
||||
Send(*grpc_gateway_examples_sub.StringMessage) error
|
||||
Recv() (*grpc_gateway_examples_sub.StringMessage, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type streamServiceBulkEchoServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkEchoServer) Send(m *grpc_gateway_examples_sub.StringMessage) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *streamServiceBulkEchoServer) Recv() (*grpc_gateway_examples_sub.StringMessage, error) {
|
||||
m := new(grpc_gateway_examples_sub.StringMessage)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
var _StreamService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.gateway.examples.examplepb.StreamService",
|
||||
HandlerType: (*StreamServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "BulkCreate",
|
||||
Handler: _StreamService_BulkCreate_Handler,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "List",
|
||||
Handler: _StreamService_List_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "BulkEcho",
|
||||
Handler: _StreamService_BulkEcho_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "examples/examplepb/stream.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("examples/examplepb/stream.proto", fileDescriptor2) }
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 314 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x90, 0xbf, 0x4a, 0x43, 0x31,
|
||||
0x14, 0xc6, 0xb9, 0x2a, 0xa2, 0x11, 0x97, 0x0c, 0x0e, 0x51, 0x28, 0x16, 0xc1, 0x2a, 0x92, 0xb4,
|
||||
0xba, 0xb9, 0x59, 0xe9, 0xa6, 0x38, 0x74, 0x73, 0x29, 0xc9, 0xe5, 0x34, 0x0d, 0xbd, 0xf7, 0x26,
|
||||
0x24, 0xe7, 0x56, 0x0b, 0x4e, 0x8e, 0xae, 0x7d, 0x11, 0xdf, 0xc5, 0x57, 0xf0, 0x41, 0xa4, 0xf7,
|
||||
0xdf, 0xd4, 0xd2, 0xba, 0x25, 0x9c, 0x2f, 0xf9, 0x7e, 0xe7, 0x47, 0x5a, 0xf0, 0x2e, 0x53, 0x97,
|
||||
0x40, 0x10, 0xd5, 0xc1, 0x29, 0x11, 0xd0, 0x83, 0x4c, 0xb9, 0xf3, 0x16, 0x2d, 0x6d, 0x69, 0xef,
|
||||
0x62, 0xae, 0x25, 0xc2, 0x9b, 0x9c, 0xf3, 0x3a, 0xcd, 0x9b, 0x34, 0x3b, 0xd3, 0xd6, 0xea, 0x04,
|
||||
0x84, 0x74, 0x46, 0xc8, 0x2c, 0xb3, 0x28, 0xd1, 0xd8, 0x2c, 0x94, 0xcf, 0xd9, 0x69, 0x35, 0x2d,
|
||||
0x6e, 0x2a, 0x1f, 0x0b, 0x48, 0x1d, 0xce, 0xab, 0xe1, 0xcd, 0x8a, 0x72, 0x39, 0x52, 0x06, 0x47,
|
||||
0x76, 0x3c, 0x82, 0x19, 0xf8, 0x39, 0x4e, 0x4c, 0xa6, 0xab, 0x34, 0x6b, 0xd2, 0x21, 0x57, 0x22,
|
||||
0x85, 0x10, 0xa4, 0x86, 0x72, 0x76, 0xfb, 0xbd, 0x4b, 0x8e, 0x87, 0x05, 0xf6, 0x10, 0xfc, 0xcc,
|
||||
0xc4, 0x40, 0xbf, 0x22, 0x42, 0xfa, 0x79, 0x32, 0x7d, 0xf4, 0x20, 0x11, 0x68, 0x8f, 0x6f, 0xd8,
|
||||
0x83, 0x3f, 0xf4, 0x0d, 0xbe, 0x8c, 0x07, 0x4d, 0x2b, 0x3b, 0xe1, 0x25, 0x3b, 0xaf, 0xd9, 0xf9,
|
||||
0x60, 0xc9, 0xde, 0x16, 0x9f, 0x3f, 0xbf, 0x8b, 0x9d, 0xab, 0xf6, 0x85, 0x98, 0xf5, 0x6a, 0xf0,
|
||||
0x55, 0xd8, 0x42, 0xe5, 0xc9, 0xf4, 0x3e, 0xba, 0xee, 0x44, 0xf4, 0x83, 0xec, 0x3d, 0x99, 0x80,
|
||||
0x74, 0xcd, 0x97, 0xec, 0xff, 0x74, 0xed, 0xcb, 0x82, 0xe2, 0x9c, 0xb6, 0x36, 0x50, 0x74, 0x23,
|
||||
0xba, 0x88, 0xc8, 0xc1, 0x52, 0xc5, 0x20, 0x9e, 0x58, 0xda, 0x59, 0x53, 0x15, 0x72, 0xc5, 0x87,
|
||||
0xe8, 0x4d, 0xa6, 0x9f, 0x4b, 0xb3, 0x6c, 0xeb, 0xe4, 0xf6, 0x46, 0x20, 0x9e, 0xd8, 0xc2, 0x48,
|
||||
0x37, 0xea, 0x1f, 0xbd, 0x1e, 0x36, 0xeb, 0xa9, 0xfd, 0x42, 0xc8, 0xdd, 0x5f, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xbc, 0x52, 0x49, 0x85, 0x8f, 0x02, 0x00, 0x00,
|
||||
}
|
273
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.gw.go
generated
vendored
Normal file
273
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.pb.gw.go
generated
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
// Code generated by protoc-gen-grpc-gateway
|
||||
// source: examples/examplepb/stream.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package examplepb is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package examplepb
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/sub"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
|
||||
func request_StreamService_BulkCreate_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var metadata runtime.ServerMetadata
|
||||
stream, err := client.BulkCreate(ctx)
|
||||
if err != nil {
|
||||
grpclog.Printf("Failed to start streaming: %v", err)
|
||||
return nil, metadata, err
|
||||
}
|
||||
dec := marshaler.NewDecoder(req.Body)
|
||||
for {
|
||||
var protoReq ABitOfEverything
|
||||
err = dec.Decode(&protoReq)
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
grpclog.Printf("Failed to decode request: %v", err)
|
||||
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err = stream.Send(&protoReq); err != nil {
|
||||
grpclog.Printf("Failed to send request: %v", err)
|
||||
return nil, metadata, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := stream.CloseSend(); err != nil {
|
||||
grpclog.Printf("Failed to terminate client stream: %v", err)
|
||||
return nil, metadata, err
|
||||
}
|
||||
header, err := stream.Header()
|
||||
if err != nil {
|
||||
grpclog.Printf("Failed to get header from client: %v", err)
|
||||
return nil, metadata, err
|
||||
}
|
||||
metadata.HeaderMD = header
|
||||
|
||||
msg, err := stream.CloseAndRecv()
|
||||
metadata.TrailerMD = stream.Trailer()
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_StreamService_List_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_ListClient, runtime.ServerMetadata, error) {
|
||||
var protoReq empty.Empty
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
stream, err := client.List(ctx, &protoReq)
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
header, err := stream.Header()
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
metadata.HeaderMD = header
|
||||
return stream, metadata, nil
|
||||
|
||||
}
|
||||
|
||||
func request_StreamService_BulkEcho_0(ctx context.Context, marshaler runtime.Marshaler, client StreamServiceClient, req *http.Request, pathParams map[string]string) (StreamService_BulkEchoClient, runtime.ServerMetadata, error) {
|
||||
var metadata runtime.ServerMetadata
|
||||
stream, err := client.BulkEcho(ctx)
|
||||
if err != nil {
|
||||
grpclog.Printf("Failed to start streaming: %v", err)
|
||||
return nil, metadata, err
|
||||
}
|
||||
dec := marshaler.NewDecoder(req.Body)
|
||||
handleSend := func() error {
|
||||
var protoReq sub.StringMessage
|
||||
err = dec.Decode(&protoReq)
|
||||
if err == io.EOF {
|
||||
return err
|
||||
}
|
||||
if err != nil {
|
||||
grpclog.Printf("Failed to decode request: %v", err)
|
||||
return err
|
||||
}
|
||||
if err = stream.Send(&protoReq); err != nil {
|
||||
grpclog.Printf("Failed to send request: %v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if err := handleSend(); err != nil {
|
||||
if cerr := stream.CloseSend(); cerr != nil {
|
||||
grpclog.Printf("Failed to terminate client stream: %v", cerr)
|
||||
}
|
||||
if err == io.EOF {
|
||||
return stream, metadata, nil
|
||||
}
|
||||
return nil, metadata, err
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
if err := handleSend(); err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
if err := stream.CloseSend(); err != nil {
|
||||
grpclog.Printf("Failed to terminate client stream: %v", err)
|
||||
}
|
||||
}()
|
||||
header, err := stream.Header()
|
||||
if err != nil {
|
||||
grpclog.Printf("Failed to get header from client: %v", err)
|
||||
return nil, metadata, err
|
||||
}
|
||||
metadata.HeaderMD = header
|
||||
return stream, metadata, nil
|
||||
}
|
||||
|
||||
// RegisterStreamServiceHandlerFromEndpoint is same as RegisterStreamServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterStreamServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterStreamServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterStreamServiceHandler registers the http handlers for service StreamService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterStreamServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
client := NewStreamServiceClient(conn)
|
||||
|
||||
mux.Handle("POST", pattern_StreamService_BulkCreate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_StreamService_BulkCreate_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_StreamService_BulkCreate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_StreamService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_StreamService_List_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_StreamService_List_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_StreamService_BulkEcho_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
if cn, ok := w.(http.CloseNotifier); ok {
|
||||
go func(done <-chan struct{}, closed <-chan bool) {
|
||||
select {
|
||||
case <-done:
|
||||
case <-closed:
|
||||
cancel()
|
||||
}
|
||||
}(ctx.Done(), cn.CloseNotify())
|
||||
}
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
}
|
||||
resp, md, err := request_StreamService_BulkEcho_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_StreamService_BulkEcho_0(ctx, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_StreamService_BulkCreate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "bulk"}, ""))
|
||||
|
||||
pattern_StreamService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, ""))
|
||||
|
||||
pattern_StreamService_BulkEcho_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "example", "a_bit_of_everything", "echo"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_StreamService_BulkCreate_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_StreamService_List_0 = runtime.ForwardResponseStream
|
||||
|
||||
forward_StreamService_BulkEcho_0 = runtime.ForwardResponseStream
|
||||
)
|
29
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.proto
generated
vendored
Normal file
29
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/examplepb/stream.proto
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "examplepb";
|
||||
package grpc.gateway.examples.examplepb;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "examples/examplepb/a_bit_of_everything.proto";
|
||||
import "examples/sub/message.proto";
|
||||
|
||||
// Defines some more operations to be added to ABitOfEverythingService
|
||||
service StreamService {
|
||||
rpc BulkCreate(stream ABitOfEverything) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/a_bit_of_everything/bulk"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc List(google.protobuf.Empty) returns (stream ABitOfEverything) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/example/a_bit_of_everything"
|
||||
};
|
||||
}
|
||||
rpc BulkEcho(stream grpc.gateway.examples.sub.StringMessage) returns (stream grpc.gateway.examples.sub.StringMessage) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/example/a_bit_of_everything/echo"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
719
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/integration_test.go
generated
vendored
Normal file
719
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/integration_test.go
generated
vendored
Normal file
@@ -0,0 +1,719 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
gw "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
|
||||
sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
type errorBody struct {
|
||||
Error string `json:"error"`
|
||||
Code int `json:"code"`
|
||||
}
|
||||
|
||||
func TestEcho(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
return
|
||||
}
|
||||
|
||||
testEcho(t, 8080, "application/json")
|
||||
testEchoBody(t)
|
||||
}
|
||||
|
||||
func TestForwardResponseOption(t *testing.T) {
|
||||
go func() {
|
||||
if err := Run(
|
||||
":8081",
|
||||
runtime.WithForwardResponseOption(
|
||||
func(_ context.Context, w http.ResponseWriter, _ proto.Message) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1.1+json")
|
||||
return nil
|
||||
},
|
||||
),
|
||||
); err != nil {
|
||||
t.Errorf("gw.Run() failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
testEcho(t, 8081, "application/vnd.docker.plugins.v1.1+json")
|
||||
}
|
||||
|
||||
func testEcho(t *testing.T, port int, contentType string) {
|
||||
url := fmt.Sprintf("http://localhost:%d/v1/example/echo/myid", port)
|
||||
resp, err := http.Post(url, "application/json", strings.NewReader("{}"))
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
}
|
||||
|
||||
var msg gw.SimpleMessage
|
||||
if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
if got, want := msg.Id, "myid"; got != want {
|
||||
t.Errorf("msg.Id = %q; want %q", got, want)
|
||||
}
|
||||
|
||||
if value := resp.Header.Get("Content-Type"); value != contentType {
|
||||
t.Errorf("Content-Type was %s, wanted %s", value, contentType)
|
||||
}
|
||||
}
|
||||
|
||||
func testEchoBody(t *testing.T) {
|
||||
sent := gw.SimpleMessage{Id: "example"}
|
||||
var m jsonpb.Marshaler
|
||||
payload, err := m.MarshalToString(&sent)
|
||||
if err != nil {
|
||||
t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", payload, err)
|
||||
}
|
||||
|
||||
url := "http://localhost:8080/v1/example/echo_body"
|
||||
resp, err := http.Post(url, "", strings.NewReader(payload))
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
}
|
||||
|
||||
var received gw.SimpleMessage
|
||||
if err := jsonpb.UnmarshalString(string(buf), &received); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
if got, want := received, sent; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("msg.Id = %q; want %q", got, want)
|
||||
}
|
||||
|
||||
if got, want := resp.Header.Get("Grpc-Metadata-Foo"), "foo1"; got != want {
|
||||
t.Errorf("Grpc-Metadata-Foo was %q, wanted %q", got, want)
|
||||
}
|
||||
if got, want := resp.Header.Get("Grpc-Metadata-Bar"), "bar1"; got != want {
|
||||
t.Errorf("Grpc-Metadata-Bar was %q, wanted %q", got, want)
|
||||
}
|
||||
|
||||
if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want {
|
||||
t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want)
|
||||
}
|
||||
if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want {
|
||||
t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestABE(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
return
|
||||
}
|
||||
|
||||
testABECreate(t)
|
||||
testABECreateBody(t)
|
||||
testABEBulkCreate(t)
|
||||
testABELookup(t)
|
||||
testABELookupNotFound(t)
|
||||
testABEList(t)
|
||||
testABEBulkEcho(t)
|
||||
testABEBulkEchoZeroLength(t)
|
||||
testAdditionalBindings(t)
|
||||
}
|
||||
|
||||
func testABECreate(t *testing.T) {
|
||||
want := gw.ABitOfEverything{
|
||||
FloatValue: 1.5,
|
||||
DoubleValue: 2.5,
|
||||
Int64Value: 4294967296,
|
||||
Uint64Value: 9223372036854775807,
|
||||
Int32Value: -2147483648,
|
||||
Fixed64Value: 9223372036854775807,
|
||||
Fixed32Value: 4294967295,
|
||||
BoolValue: true,
|
||||
StringValue: "strprefix/foo",
|
||||
Uint32Value: 4294967295,
|
||||
Sfixed32Value: 2147483647,
|
||||
Sfixed64Value: -4611686018427387904,
|
||||
Sint32Value: 2147483647,
|
||||
Sint64Value: 4611686018427387903,
|
||||
NonConventionalNameValue: "camelCase",
|
||||
}
|
||||
url := fmt.Sprintf("http://localhost:8080/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s", want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue)
|
||||
|
||||
resp, err := http.Post(url, "application/json", strings.NewReader("{}"))
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
}
|
||||
|
||||
var msg gw.ABitOfEverything
|
||||
if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
if msg.Uuid == "" {
|
||||
t.Error("msg.Uuid is empty; want not empty")
|
||||
}
|
||||
msg.Uuid = ""
|
||||
if got := msg; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("msg= %v; want %v", &got, &want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABECreateBody(t *testing.T) {
|
||||
want := gw.ABitOfEverything{
|
||||
FloatValue: 1.5,
|
||||
DoubleValue: 2.5,
|
||||
Int64Value: 4294967296,
|
||||
Uint64Value: 9223372036854775807,
|
||||
Int32Value: -2147483648,
|
||||
Fixed64Value: 9223372036854775807,
|
||||
Fixed32Value: 4294967295,
|
||||
BoolValue: true,
|
||||
StringValue: "strprefix/foo",
|
||||
Uint32Value: 4294967295,
|
||||
Sfixed32Value: 2147483647,
|
||||
Sfixed64Value: -4611686018427387904,
|
||||
Sint32Value: 2147483647,
|
||||
Sint64Value: 4611686018427387903,
|
||||
NonConventionalNameValue: "camelCase",
|
||||
|
||||
Nested: []*gw.ABitOfEverything_Nested{
|
||||
{
|
||||
Name: "bar",
|
||||
Amount: 10,
|
||||
},
|
||||
{
|
||||
Name: "baz",
|
||||
Amount: 20,
|
||||
},
|
||||
},
|
||||
RepeatedStringValue: []string{"a", "b", "c"},
|
||||
OneofValue: &gw.ABitOfEverything_OneofString{
|
||||
OneofString: "x",
|
||||
},
|
||||
MapValue: map[string]gw.NumericEnum{
|
||||
"a": gw.NumericEnum_ONE,
|
||||
"b": gw.NumericEnum_ZERO,
|
||||
},
|
||||
MappedStringValue: map[string]string{
|
||||
"a": "x",
|
||||
"b": "y",
|
||||
},
|
||||
MappedNestedValue: map[string]*gw.ABitOfEverything_Nested{
|
||||
"a": {Name: "x", Amount: 1},
|
||||
"b": {Name: "y", Amount: 2},
|
||||
},
|
||||
}
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything"
|
||||
var m jsonpb.Marshaler
|
||||
payload, err := m.MarshalToString(&want)
|
||||
if err != nil {
|
||||
t.Fatalf("m.MarshalToString(%#v) failed with %v; want success", want, err)
|
||||
}
|
||||
|
||||
resp, err := http.Post(url, "application/json", strings.NewReader(payload))
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
}
|
||||
|
||||
var msg gw.ABitOfEverything
|
||||
if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
if msg.Uuid == "" {
|
||||
t.Error("msg.Uuid is empty; want not empty")
|
||||
}
|
||||
msg.Uuid = ""
|
||||
if got := msg; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("msg= %v; want %v", &got, &want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABEBulkCreate(t *testing.T) {
|
||||
count := 0
|
||||
r, w := io.Pipe()
|
||||
go func(w io.WriteCloser) {
|
||||
defer func() {
|
||||
if cerr := w.Close(); cerr != nil {
|
||||
t.Errorf("w.Close() failed with %v; want success", cerr)
|
||||
}
|
||||
}()
|
||||
for _, val := range []string{
|
||||
"foo", "bar", "baz", "qux", "quux",
|
||||
} {
|
||||
want := gw.ABitOfEverything{
|
||||
FloatValue: 1.5,
|
||||
DoubleValue: 2.5,
|
||||
Int64Value: 4294967296,
|
||||
Uint64Value: 9223372036854775807,
|
||||
Int32Value: -2147483648,
|
||||
Fixed64Value: 9223372036854775807,
|
||||
Fixed32Value: 4294967295,
|
||||
BoolValue: true,
|
||||
StringValue: fmt.Sprintf("strprefix/%s", val),
|
||||
Uint32Value: 4294967295,
|
||||
Sfixed32Value: 2147483647,
|
||||
Sfixed64Value: -4611686018427387904,
|
||||
Sint32Value: 2147483647,
|
||||
Sint64Value: 4611686018427387903,
|
||||
NonConventionalNameValue: "camelCase",
|
||||
|
||||
Nested: []*gw.ABitOfEverything_Nested{
|
||||
{
|
||||
Name: "hoge",
|
||||
Amount: 10,
|
||||
},
|
||||
{
|
||||
Name: "fuga",
|
||||
Amount: 20,
|
||||
},
|
||||
},
|
||||
}
|
||||
var m jsonpb.Marshaler
|
||||
if err := m.Marshal(w, &want); err != nil {
|
||||
t.Fatalf("m.Marshal(%#v, w) failed with %v; want success", want, err)
|
||||
}
|
||||
if _, err := io.WriteString(w, "\n"); err != nil {
|
||||
t.Errorf("w.Write(%q) failed with %v; want success", "\n", err)
|
||||
return
|
||||
}
|
||||
count++
|
||||
}
|
||||
}(w)
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything/bulk"
|
||||
resp, err := http.Post(url, "application/json", r)
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
}
|
||||
|
||||
var msg empty.Empty
|
||||
if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.Header.Get("Grpc-Metadata-Count"), fmt.Sprintf("%d", count); got != want {
|
||||
t.Errorf("Grpc-Metadata-Count was %q, wanted %q", got, want)
|
||||
}
|
||||
|
||||
if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want {
|
||||
t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want)
|
||||
}
|
||||
if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want {
|
||||
t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABELookup(t *testing.T) {
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything"
|
||||
cresp, err := http.Post(url, "application/json", strings.NewReader(`
|
||||
{"bool_value": true, "string_value": "strprefix/example"}
|
||||
`))
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer cresp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(cresp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(cresp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
if got, want := cresp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
return
|
||||
}
|
||||
|
||||
var want gw.ABitOfEverything
|
||||
if err := jsonpb.UnmarshalString(string(buf), &want); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &want) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
|
||||
url = fmt.Sprintf("%s/%s", url, want.Uuid)
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
t.Errorf("http.Get(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
buf, err = ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
var msg gw.ABitOfEverything
|
||||
if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
if got := msg; !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("msg= %v; want %v", &got, &want)
|
||||
}
|
||||
|
||||
if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), want.Uuid; got != want {
|
||||
t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABELookupNotFound(t *testing.T) {
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything"
|
||||
uuid := "not_exist"
|
||||
url = fmt.Sprintf("%s/%s", url, uuid)
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
t.Errorf("http.Get(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("ioutil.ReadAll(resp.Body) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusNotFound; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
t.Logf("%s", buf)
|
||||
return
|
||||
}
|
||||
|
||||
var msg errorBody
|
||||
if err := json.Unmarshal(buf, &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := msg.Code, int(codes.NotFound); got != want {
|
||||
t.Errorf("msg.Code = %d; want %d", got, want)
|
||||
return
|
||||
}
|
||||
|
||||
if got, want := resp.Header.Get("Grpc-Metadata-Uuid"), uuid; got != want {
|
||||
t.Errorf("Grpc-Metadata-Uuid was %s, wanted %s", got, want)
|
||||
}
|
||||
if got, want := resp.Trailer.Get("Grpc-Trailer-Foo"), "foo2"; got != want {
|
||||
t.Errorf("Grpc-Trailer-Foo was %q, wanted %q", got, want)
|
||||
}
|
||||
if got, want := resp.Trailer.Get("Grpc-Trailer-Bar"), "bar2"; got != want {
|
||||
t.Errorf("Grpc-Trailer-Bar was %q, wanted %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABEList(t *testing.T) {
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything"
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
t.Errorf("http.Get(%q) failed with %v; want success", url, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
dec := json.NewDecoder(resp.Body)
|
||||
var i int
|
||||
for i = 0; ; i++ {
|
||||
var item struct {
|
||||
Result json.RawMessage `json:"result"`
|
||||
Error map[string]interface{} `json:"error"`
|
||||
}
|
||||
err := dec.Decode(&item)
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i)
|
||||
}
|
||||
if len(item.Error) != 0 {
|
||||
t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i)
|
||||
continue
|
||||
}
|
||||
var msg gw.ABitOfEverything
|
||||
if err := jsonpb.UnmarshalString(string(item.Result), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success", item.Result, err)
|
||||
}
|
||||
}
|
||||
if i <= 0 {
|
||||
t.Errorf("i == %d; want > 0", i)
|
||||
}
|
||||
|
||||
value := resp.Header.Get("Grpc-Metadata-Count")
|
||||
if value == "" {
|
||||
t.Errorf("Grpc-Metadata-Count should not be empty")
|
||||
}
|
||||
|
||||
count, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
t.Errorf("failed to Atoi %q: %v", value, err)
|
||||
}
|
||||
|
||||
if count <= 0 {
|
||||
t.Errorf("count == %d; want > 0", count)
|
||||
}
|
||||
}
|
||||
|
||||
func testABEBulkEcho(t *testing.T) {
|
||||
reqr, reqw := io.Pipe()
|
||||
var wg sync.WaitGroup
|
||||
var want []*sub.StringMessage
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
defer reqw.Close()
|
||||
var m jsonpb.Marshaler
|
||||
for i := 0; i < 1000; i++ {
|
||||
msg := sub.StringMessage{Value: proto.String(fmt.Sprintf("message %d", i))}
|
||||
buf, err := m.MarshalToString(&msg)
|
||||
if err != nil {
|
||||
t.Errorf("m.Marshal(%v) failed with %v; want success", &msg, err)
|
||||
return
|
||||
}
|
||||
if _, err := fmt.Fprintln(reqw, buf); err != nil {
|
||||
t.Errorf("fmt.Fprintln(reqw, %q) failed with %v; want success", buf, err)
|
||||
return
|
||||
}
|
||||
want = append(want, &msg)
|
||||
}
|
||||
}()
|
||||
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything/echo"
|
||||
req, err := http.NewRequest("POST", url, reqr)
|
||||
if err != nil {
|
||||
t.Errorf("http.NewRequest(%q, %q, reqr) failed with %v; want success", "POST", url, err)
|
||||
return
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Transfer-Encoding", "chunked")
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
}
|
||||
|
||||
var got []*sub.StringMessage
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
dec := json.NewDecoder(resp.Body)
|
||||
for i := 0; ; i++ {
|
||||
var item struct {
|
||||
Result json.RawMessage `json:"result"`
|
||||
Error map[string]interface{} `json:"error"`
|
||||
}
|
||||
err := dec.Decode(&item)
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("dec.Decode(&item) failed with %v; want success; i = %d", err, i)
|
||||
}
|
||||
if len(item.Error) != 0 {
|
||||
t.Errorf("item.Error = %#v; want empty; i = %d", item.Error, i)
|
||||
continue
|
||||
}
|
||||
var msg sub.StringMessage
|
||||
if err := jsonpb.UnmarshalString(string(item.Result), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%q, &msg) failed with %v; want success", item.Result, err)
|
||||
}
|
||||
got = append(got, &msg)
|
||||
}
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("got = %v; want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func testABEBulkEchoZeroLength(t *testing.T) {
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything/echo"
|
||||
req, err := http.NewRequest("POST", url, bytes.NewReader(nil))
|
||||
if err != nil {
|
||||
t.Errorf("http.NewRequest(%q, %q, bytes.NewReader(nil)) failed with %v; want success", "POST", url, err)
|
||||
return
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Transfer-Encoding", "chunked")
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q, %q, req) failed with %v; want success", url, "application/json", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
}
|
||||
|
||||
dec := json.NewDecoder(resp.Body)
|
||||
var item struct {
|
||||
Result json.RawMessage `json:"result"`
|
||||
Error map[string]interface{} `json:"error"`
|
||||
}
|
||||
if err := dec.Decode(&item); err == nil {
|
||||
t.Errorf("dec.Decode(&item) succeeded; want io.EOF; item = %#v", item)
|
||||
} else if err != io.EOF {
|
||||
t.Errorf("dec.Decode(&item) failed with %v; want success", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func testAdditionalBindings(t *testing.T) {
|
||||
for i, f := range []func() *http.Response{
|
||||
func() *http.Response {
|
||||
url := "http://localhost:8080/v1/example/a_bit_of_everything/echo/hello"
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
t.Errorf("http.Get(%q) failed with %v; want success", url, err)
|
||||
return nil
|
||||
}
|
||||
return resp
|
||||
},
|
||||
func() *http.Response {
|
||||
url := "http://localhost:8080/v2/example/echo"
|
||||
resp, err := http.Post(url, "application/json", strings.NewReader(`"hello"`))
|
||||
if err != nil {
|
||||
t.Errorf("http.Post(%q, %q, %q) failed with %v; want success", url, "application/json", `"hello"`, err)
|
||||
return nil
|
||||
}
|
||||
return resp
|
||||
},
|
||||
func() *http.Response {
|
||||
url := "http://localhost:8080/v2/example/echo?value=hello"
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
t.Errorf("http.Get(%q) failed with %v; want success", url, err)
|
||||
return nil
|
||||
}
|
||||
return resp
|
||||
},
|
||||
} {
|
||||
resp := f()
|
||||
if resp == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
buf, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Errorf("iotuil.ReadAll(resp.Body) failed with %v; want success; i=%d", err, i)
|
||||
return
|
||||
}
|
||||
if got, want := resp.StatusCode, http.StatusOK; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d; i=%d", got, want, i)
|
||||
t.Logf("%s", buf)
|
||||
}
|
||||
|
||||
var msg sub.StringMessage
|
||||
if err := jsonpb.UnmarshalString(string(buf), &msg); err != nil {
|
||||
t.Errorf("jsonpb.UnmarshalString(%s, &msg) failed with %v; want success; %d", buf, err, i)
|
||||
return
|
||||
}
|
||||
if got, want := msg.GetValue(), "hello"; got != want {
|
||||
t.Errorf("msg.GetValue() = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimeout(t *testing.T) {
|
||||
url := "http://localhost:8080/v2/example/timeout"
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
t.Errorf(`http.NewRequest("GET", %q, nil) failed with %v; want success`, url, err)
|
||||
return
|
||||
}
|
||||
req.Header.Set("Grpc-Timeout", "10m")
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Errorf("http.DefaultClient.Do(%#v) failed with %v; want success", req, err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if got, want := resp.StatusCode, http.StatusRequestTimeout; got != want {
|
||||
t.Errorf("resp.StatusCode = %d; want %d", got, want)
|
||||
}
|
||||
}
|
109
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main.go
generated
vendored
Normal file
109
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main.go
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
var (
|
||||
echoEndpoint = flag.String("echo_endpoint", "localhost:9090", "endpoint of EchoService")
|
||||
abeEndpoint = flag.String("more_endpoint", "localhost:9090", "endpoint of ABitOfEverythingService")
|
||||
flowEndpoint = flag.String("flow_endpoint", "localhost:9090", "endpoint of FlowCombination")
|
||||
|
||||
swaggerDir = flag.String("swagger_dir", "examples/examplepb", "path to the directory which contains swagger definitions")
|
||||
)
|
||||
|
||||
// newGateway returns a new gateway server which translates HTTP into gRPC.
|
||||
func newGateway(ctx context.Context, opts ...runtime.ServeMuxOption) (http.Handler, error) {
|
||||
mux := runtime.NewServeMux(opts...)
|
||||
dialOpts := []grpc.DialOption{grpc.WithInsecure()}
|
||||
err := examplepb.RegisterEchoServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, dialOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = examplepb.RegisterStreamServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = examplepb.RegisterABitOfEverythingServiceHandlerFromEndpoint(ctx, mux, *abeEndpoint, dialOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = examplepb.RegisterFlowCombinationHandlerFromEndpoint(ctx, mux, *flowEndpoint, dialOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mux, nil
|
||||
}
|
||||
|
||||
func serveSwagger(w http.ResponseWriter, r *http.Request) {
|
||||
if !strings.HasSuffix(r.URL.Path, ".swagger.json") {
|
||||
glog.Errorf("Not Found: %s", r.URL.Path)
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
glog.Infof("Serving %s", r.URL.Path)
|
||||
p := strings.TrimPrefix(r.URL.Path, "/swagger/")
|
||||
p = path.Join(*swaggerDir, p)
|
||||
http.ServeFile(w, r, p)
|
||||
}
|
||||
|
||||
// allowCORS allows Cross Origin Resoruce Sharing from any origin.
|
||||
// Don't do this without consideration in production systems.
|
||||
func allowCORS(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if origin := r.Header.Get("Origin"); origin != "" {
|
||||
w.Header().Set("Access-Control-Allow-Origin", origin)
|
||||
if r.Method == "OPTIONS" && r.Header.Get("Access-Control-Request-Method") != "" {
|
||||
preflightHandler(w, r)
|
||||
return
|
||||
}
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func preflightHandler(w http.ResponseWriter, r *http.Request) {
|
||||
headers := []string{"Content-Type", "Accept"}
|
||||
w.Header().Set("Access-Control-Allow-Headers", strings.Join(headers, ","))
|
||||
methods := []string{"GET", "HEAD", "POST", "PUT", "DELETE"}
|
||||
w.Header().Set("Access-Control-Allow-Methods", strings.Join(methods, ","))
|
||||
glog.Infof("preflight request for %s", r.URL.Path)
|
||||
return
|
||||
}
|
||||
|
||||
// Run starts a HTTP server and blocks forever if successful.
|
||||
func Run(address string, opts ...runtime.ServeMuxOption) error {
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/swagger/", serveSwagger)
|
||||
|
||||
gw, err := newGateway(ctx, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mux.Handle("/", gw)
|
||||
|
||||
return http.ListenAndServe(address, allowCORS(mux))
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
defer glog.Flush()
|
||||
|
||||
if err := Run(":8080"); err != nil {
|
||||
glog.Fatal(err)
|
||||
}
|
||||
}
|
45
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go
generated
vendored
Normal file
45
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/main_test.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
server "github.com/grpc-ecosystem/grpc-gateway/examples/server"
|
||||
)
|
||||
|
||||
func runServers() <-chan error {
|
||||
ch := make(chan error, 2)
|
||||
go func() {
|
||||
if err := server.Run(); err != nil {
|
||||
ch <- fmt.Errorf("cannot run grpc service: %v", err)
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
if err := Run(":8080"); err != nil {
|
||||
ch <- fmt.Errorf("cannot run gateway service: %v", err)
|
||||
}
|
||||
}()
|
||||
return ch
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
errCh := runServers()
|
||||
|
||||
ch := make(chan int, 1)
|
||||
go func() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
ch <- m.Run()
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-errCh:
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
case status := <-ch:
|
||||
os.Exit(status)
|
||||
}
|
||||
}
|
247
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/a_bit_of_everything.go
generated
vendored
Normal file
247
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/a_bit_of_everything.go
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/golang/protobuf/ptypes/duration"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
|
||||
sub "github.com/grpc-ecosystem/grpc-gateway/examples/sub"
|
||||
sub2 "github.com/grpc-ecosystem/grpc-gateway/examples/sub2"
|
||||
"github.com/rogpeppe/fastuuid"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// Implements of ABitOfEverythingServiceServer
|
||||
|
||||
var uuidgen = fastuuid.MustNewGenerator()
|
||||
|
||||
type _ABitOfEverythingServer struct {
|
||||
v map[string]*examples.ABitOfEverything
|
||||
m sync.Mutex
|
||||
}
|
||||
|
||||
type ABitOfEverythingServer interface {
|
||||
examples.ABitOfEverythingServiceServer
|
||||
examples.StreamServiceServer
|
||||
}
|
||||
|
||||
func newABitOfEverythingServer() ABitOfEverythingServer {
|
||||
return &_ABitOfEverythingServer{
|
||||
v: make(map[string]*examples.ABitOfEverything),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) Create(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
glog.Info(msg)
|
||||
var uuid string
|
||||
for {
|
||||
uuid = fmt.Sprintf("%x", uuidgen.Next())
|
||||
if _, ok := s.v[uuid]; !ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
s.v[uuid] = msg
|
||||
s.v[uuid].Uuid = uuid
|
||||
glog.Infof("%v", s.v[uuid])
|
||||
return s.v[uuid], nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) CreateBody(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) {
|
||||
return s.Create(ctx, msg)
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkCreateServer) error {
|
||||
count := 0
|
||||
ctx := stream.Context()
|
||||
for {
|
||||
msg, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
count++
|
||||
glog.Error(msg)
|
||||
if _, err = s.Create(ctx, msg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err := stream.SendHeader(metadata.New(map[string]string{
|
||||
"count": fmt.Sprintf("%d", count),
|
||||
}))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
stream.SetTrailer(metadata.New(map[string]string{
|
||||
"foo": "foo2",
|
||||
"bar": "bar2",
|
||||
}))
|
||||
return stream.SendAndClose(new(empty.Empty))
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) Lookup(ctx context.Context, msg *sub2.IdMessage) (*examples.ABitOfEverything, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
glog.Info(msg)
|
||||
|
||||
err := grpc.SendHeader(ctx, metadata.New(map[string]string{
|
||||
"uuid": msg.Uuid,
|
||||
}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if a, ok := s.v[msg.Uuid]; ok {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
grpc.SetTrailer(ctx, metadata.New(map[string]string{
|
||||
"foo": "foo2",
|
||||
"bar": "bar2",
|
||||
}))
|
||||
return nil, grpc.Errorf(codes.NotFound, "not found")
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) List(_ *empty.Empty, stream examples.StreamService_ListServer) error {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
err := stream.SendHeader(metadata.New(map[string]string{
|
||||
"count": fmt.Sprintf("%d", len(s.v)),
|
||||
}))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, msg := range s.v {
|
||||
if err := stream.Send(msg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// return error when metadata includes error header
|
||||
if header, ok := metadata.FromContext(stream.Context()); ok {
|
||||
if v, ok := header["error"]; ok {
|
||||
stream.SetTrailer(metadata.New(map[string]string{
|
||||
"foo": "foo2",
|
||||
"bar": "bar2",
|
||||
}))
|
||||
return grpc.Errorf(codes.InvalidArgument, "error metadata: %v", v)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) Update(ctx context.Context, msg *examples.ABitOfEverything) (*empty.Empty, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
glog.Info(msg)
|
||||
if _, ok := s.v[msg.Uuid]; ok {
|
||||
s.v[msg.Uuid] = msg
|
||||
} else {
|
||||
return nil, grpc.Errorf(codes.NotFound, "not found")
|
||||
}
|
||||
return new(empty.Empty), nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) Delete(ctx context.Context, msg *sub2.IdMessage) (*empty.Empty, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
glog.Info(msg)
|
||||
if _, ok := s.v[msg.Uuid]; ok {
|
||||
delete(s.v, msg.Uuid)
|
||||
} else {
|
||||
return nil, grpc.Errorf(codes.NotFound, "not found")
|
||||
}
|
||||
return new(empty.Empty), nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) GetQuery(ctx context.Context, msg *examples.ABitOfEverything) (*empty.Empty, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
glog.Info(msg)
|
||||
if _, ok := s.v[msg.Uuid]; ok {
|
||||
s.v[msg.Uuid] = msg
|
||||
} else {
|
||||
return nil, grpc.Errorf(codes.NotFound, "not found")
|
||||
}
|
||||
return new(empty.Empty), nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) Echo(ctx context.Context, msg *sub.StringMessage) (*sub.StringMessage, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
glog.Info(msg)
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) BulkEcho(stream examples.StreamService_BulkEchoServer) error {
|
||||
var msgs []*sub.StringMessage
|
||||
for {
|
||||
msg, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
msgs = append(msgs, msg)
|
||||
}
|
||||
|
||||
hmd := metadata.New(map[string]string{
|
||||
"foo": "foo1",
|
||||
"bar": "bar1",
|
||||
})
|
||||
if err := stream.SendHeader(hmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, msg := range msgs {
|
||||
glog.Info(msg)
|
||||
if err := stream.Send(msg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
stream.SetTrailer(metadata.New(map[string]string{
|
||||
"foo": "foo2",
|
||||
"bar": "bar2",
|
||||
}))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) DeepPathEcho(ctx context.Context, msg *examples.ABitOfEverything) (*examples.ABitOfEverything, error) {
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
glog.Info(msg)
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) NoBindings(ctx context.Context, msg *duration.Duration) (*empty.Empty, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *_ABitOfEverythingServer) Timeout(ctx context.Context, msg *empty.Empty) (*empty.Empty, error) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
}
|
17
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server/main.go
generated
vendored
Normal file
17
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/cmd/example-server/main.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/examples/server"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
defer glog.Flush()
|
||||
|
||||
if err := server.Run(); err != nil {
|
||||
glog.Fatal(err)
|
||||
}
|
||||
}
|
35
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/echo.go
generated
vendored
Normal file
35
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/echo.go
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// Implements of EchoServiceServer
|
||||
|
||||
type echoServer struct{}
|
||||
|
||||
func newEchoServer() examples.EchoServiceServer {
|
||||
return new(echoServer)
|
||||
}
|
||||
|
||||
func (s *echoServer) Echo(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) {
|
||||
glog.Info(msg)
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func (s *echoServer) EchoBody(ctx context.Context, msg *examples.SimpleMessage) (*examples.SimpleMessage, error) {
|
||||
glog.Info(msg)
|
||||
grpc.SendHeader(ctx, metadata.New(map[string]string{
|
||||
"foo": "foo1",
|
||||
"bar": "bar1",
|
||||
}))
|
||||
grpc.SetTrailer(ctx, metadata.New(map[string]string{
|
||||
"foo": "foo2",
|
||||
"bar": "bar2",
|
||||
}))
|
||||
return msg, nil
|
||||
}
|
72
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/flow_combination.go
generated
vendored
Normal file
72
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/flow_combination.go
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type flowCombinationServer struct{}
|
||||
|
||||
func newFlowCombinationServer() examples.FlowCombinationServer {
|
||||
return &flowCombinationServer{}
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcEmptyRpc(ctx context.Context, req *examples.EmptyProto) (*examples.EmptyProto, error) {
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcEmptyStream(req *examples.EmptyProto, stream examples.FlowCombination_RpcEmptyStreamServer) error {
|
||||
return stream.Send(req)
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) StreamEmptyRpc(stream examples.FlowCombination_StreamEmptyRpcServer) error {
|
||||
for {
|
||||
_, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return stream.SendAndClose(new(examples.EmptyProto))
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) StreamEmptyStream(stream examples.FlowCombination_StreamEmptyStreamServer) error {
|
||||
for {
|
||||
_, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return stream.Send(new(examples.EmptyProto))
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcBodyRpc(ctx context.Context, req *examples.NonEmptyProto) (*examples.EmptyProto, error) {
|
||||
return new(examples.EmptyProto), nil
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcPathSingleNestedRpc(ctx context.Context, req *examples.SingleNestedProto) (*examples.EmptyProto, error) {
|
||||
return new(examples.EmptyProto), nil
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcPathNestedRpc(ctx context.Context, req *examples.NestedProto) (*examples.EmptyProto, error) {
|
||||
return new(examples.EmptyProto), nil
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcBodyStream(req *examples.NonEmptyProto, stream examples.FlowCombination_RpcBodyStreamServer) error {
|
||||
return stream.Send(new(examples.EmptyProto))
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcPathSingleNestedStream(req *examples.SingleNestedProto, stream examples.FlowCombination_RpcPathSingleNestedStreamServer) error {
|
||||
return stream.Send(new(examples.EmptyProto))
|
||||
}
|
||||
|
||||
func (s flowCombinationServer) RpcPathNestedStream(req *examples.NestedProto, stream examples.FlowCombination_RpcPathNestedStreamServer) error {
|
||||
return stream.Send(new(examples.EmptyProto))
|
||||
}
|
25
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/main.go
generated
vendored
Normal file
25
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/server/main.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func Run() error {
|
||||
l, err := net.Listen("tcp", ":9090")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s := grpc.NewServer()
|
||||
examples.RegisterEchoServiceServer(s, newEchoServer())
|
||||
examples.RegisterFlowCombinationServer(s, newFlowCombinationServer())
|
||||
|
||||
abe := newABitOfEverythingServer()
|
||||
examples.RegisterABitOfEverythingServiceServer(s, abe)
|
||||
examples.RegisterStreamServiceServer(s, abe)
|
||||
|
||||
s.Serve(l)
|
||||
return nil
|
||||
}
|
63
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.pb.go
generated
vendored
Normal file
63
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.pb.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: examples/sub/message.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package sub is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
examples/sub/message.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StringMessage
|
||||
*/
|
||||
package sub
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type StringMessage struct {
|
||||
Value *string `protobuf:"bytes,1,req,name=value" json:"value,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StringMessage) Reset() { *m = StringMessage{} }
|
||||
func (m *StringMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*StringMessage) ProtoMessage() {}
|
||||
func (*StringMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *StringMessage) GetValue() string {
|
||||
if m != nil && m.Value != nil {
|
||||
return *m.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StringMessage)(nil), "grpc.gateway.examples.sub.StringMessage")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("examples/sub/message.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 111 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0x48, 0xcc,
|
||||
0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f,
|
||||
0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x4c, 0x2f, 0x2a, 0x48, 0xd6, 0x4b, 0x4f, 0x2c,
|
||||
0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x83, 0x29, 0xd4, 0x2b, 0x2e, 0x4d, 0x52, 0x52, 0xe5, 0xe2, 0x0d,
|
||||
0x2e, 0x29, 0xca, 0xcc, 0x4b, 0xf7, 0x85, 0xe8, 0x10, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29,
|
||||
0x4d, 0x95, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x0c, 0x82, 0x70, 0x9c, 0x58, 0xa3, 0x98, 0x8b, 0x4b,
|
||||
0x93, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x10, 0x60, 0xa9, 0x65, 0x00, 0x00, 0x00,
|
||||
}
|
7
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.proto
generated
vendored
Normal file
7
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub/message.proto
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
syntax = "proto2";
|
||||
option go_package = "sub";
|
||||
package grpc.gateway.examples.sub;
|
||||
|
||||
message StringMessage {
|
||||
required string value = 1;
|
||||
}
|
63
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.pb.go
generated
vendored
Normal file
63
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.pb.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: examples/sub2/message.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package sub2 is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
examples/sub2/message.proto
|
||||
|
||||
It has these top-level messages:
|
||||
IdMessage
|
||||
*/
|
||||
package sub2
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type IdMessage struct {
|
||||
Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"`
|
||||
}
|
||||
|
||||
func (m *IdMessage) Reset() { *m = IdMessage{} }
|
||||
func (m *IdMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*IdMessage) ProtoMessage() {}
|
||||
func (*IdMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *IdMessage) GetUuid() string {
|
||||
if m != nil {
|
||||
return m.Uuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*IdMessage)(nil), "sub2.IdMessage")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("examples/sub2/message.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 128 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0x48, 0xcc,
|
||||
0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x2f, 0x2e, 0x4d, 0x32, 0xd2, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c,
|
||||
0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0x89, 0x29, 0xc9, 0x73, 0x71, 0x7a,
|
||||
0xa6, 0xf8, 0x42, 0x24, 0x84, 0x84, 0xb8, 0x58, 0x4a, 0x4b, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18,
|
||||
0x35, 0x38, 0x83, 0xc0, 0x6c, 0x27, 0xb3, 0x28, 0x93, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd,
|
||||
0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xa2, 0x82, 0x64, 0xdd, 0xd4, 0xe4, 0xfc, 0xe2, 0xca, 0xe2, 0x92,
|
||||
0x54, 0x28, 0x37, 0x3d, 0xb1, 0x24, 0xb5, 0x3c, 0xb1, 0x52, 0x1f, 0xc5, 0xb2, 0x24, 0x36, 0xb0,
|
||||
0x2d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x75, 0xef, 0xe0, 0x84, 0x00, 0x00, 0x00,
|
||||
}
|
7
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.proto
generated
vendored
Normal file
7
vendor/github.com/grpc-ecosystem/grpc-gateway/examples/sub2/message.proto
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/grpc-ecosystem/grpc-gateway/examples/sub2";
|
||||
package sub2;
|
||||
|
||||
message IdMessage {
|
||||
string uuid = 1;
|
||||
}
|
Reference in New Issue
Block a user