-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
599e23c
commit be27d86
Showing
8 changed files
with
302 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 177 additions & 0 deletions
177
typescript/test/testdata/showcase/protos/google/showcase/v1beta1/echo.proto.baseline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
// Copyright 2018 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
import "google/api/annotations.proto"; | ||
import "google/api/client.proto"; | ||
import "google/api/field_behavior.proto"; | ||
import "google/longrunning/operations.proto"; | ||
import "google/protobuf/duration.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "google/rpc/status.proto"; | ||
|
||
package google.showcase.v1beta1; | ||
|
||
option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; | ||
option java_package = "com.google.showcase.v1beta1"; | ||
option java_multiple_files = true; | ||
|
||
// This service is used showcase the four main types of rpcs - unary, server | ||
// side streaming, client side streaming, and bidirectional streaming. This | ||
// service also exposes methods that explicitly implement server delay, and | ||
// paginated calls. | ||
service Echo { | ||
// This service is meant to only run locally on the port 7469 (keypad digits | ||
// for "show"). | ||
option (google.api.default_host) = "localhost:7469"; | ||
|
||
// This method simply echos the request. This method is showcases unary rpcs. | ||
rpc Echo(EchoRequest) returns (EchoResponse) { | ||
option (google.api.http) = { | ||
post: "/v1beta1/echo:echo" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// This method split the given content into words and will pass each word back | ||
// through the stream. This method showcases server-side streaming rpcs. | ||
rpc Expand(ExpandRequest) returns (stream EchoResponse) { | ||
option (google.api.http) = { | ||
post: "/v1beta1/echo:expand" | ||
body: "*" | ||
}; | ||
// TODO(landrito): change this to be `fields: ["content", "error"]` once | ||
// github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. | ||
option (google.api.method_signature) = "content,error"; | ||
} | ||
|
||
// This method will collect the words given to it. When the stream is closed | ||
// by the client, this method will return the a concatenation of the strings | ||
// passed to it. This method showcases client-side streaming rpcs. | ||
rpc Collect(stream EchoRequest) returns (EchoResponse) { | ||
option (google.api.http) = { | ||
post: "/v1beta1/echo:collect" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// This method, upon receiving a request on the stream, the same content will | ||
// be passed back on the stream. This method showcases bidirectional | ||
// streaming rpcs. | ||
rpc Chat(stream EchoRequest) returns (stream EchoResponse); | ||
|
||
// This is similar to the Expand method but instead of returning a stream of | ||
// expanded words, this method returns a paged list of expanded words. | ||
rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { | ||
option (google.api.http) = { | ||
post: "/v1beta1/echo:pagedExpand" | ||
body: "*" | ||
}; | ||
} | ||
|
||
// This method will wait the requested amount of and then return. | ||
// This method showcases how a client handles a request timing out. | ||
rpc Wait(WaitRequest) returns (google.longrunning.Operation) { | ||
option (google.api.http) = { | ||
post: "/v1beta1/echo:wait" | ||
body: "*" | ||
}; | ||
option (google.longrunning.operation_info) = { | ||
response_type: "WaitResponse" | ||
metadata_type: "WaitMetadata" | ||
}; | ||
} | ||
} | ||
|
||
// The request message used for the Echo, Collect and Chat methods. If content | ||
// is set in this message then the request will succeed. If status is set in | ||
// this message then the status will be returned as an error. | ||
message EchoRequest { | ||
oneof response { | ||
// The content to be echoed by the server. | ||
string content = 1; | ||
|
||
// The error to be thrown by the server. | ||
google.rpc.Status error = 2; | ||
} | ||
} | ||
|
||
// The response message for the Echo methods. | ||
message EchoResponse { | ||
// The content specified in the request. | ||
string content = 1; | ||
} | ||
|
||
// The request message for the Expand method. | ||
message ExpandRequest { | ||
// The content that will be split into words and returned on the stream. | ||
string content = 1; | ||
|
||
// The error that is thrown after all words are sent on the stream. | ||
google.rpc.Status error = 2; | ||
} | ||
|
||
// The request for the PagedExpand method. | ||
message PagedExpandRequest { | ||
// The string to expand. | ||
string content = 1 [(google.api.field_behavior) = REQUIRED]; | ||
|
||
// The amount of words to returned in each page. | ||
int32 page_size = 2; | ||
|
||
// The position of the page to be returned. | ||
string page_token = 3; | ||
} | ||
|
||
// The response for the PagedExpand method. | ||
message PagedExpandResponse { | ||
// The words that were expanded. | ||
repeated EchoResponse responses = 1; | ||
|
||
// The next page token. | ||
string next_page_token = 2; | ||
} | ||
|
||
// The request for Wait method. | ||
message WaitRequest { | ||
oneof end { | ||
// The time that this operation will complete. | ||
google.protobuf.Timestamp end_time = 1; | ||
|
||
// The duration of this operation. | ||
google.protobuf.Duration ttl = 4; | ||
} | ||
|
||
oneof response { | ||
// The error that will be returned by the server. If this code is specified | ||
// to be the OK rpc code, an empty response will be returned. | ||
google.rpc.Status error = 2; | ||
|
||
// The response to be returned on operation completion. | ||
WaitResponse success = 3; | ||
} | ||
} | ||
|
||
// The result of the Wait operation. | ||
message WaitResponse { | ||
// This content of the result. | ||
string content = 1; | ||
} | ||
|
||
// The metadata for Wait operation. | ||
message WaitMetadata { | ||
// The time that this operation will complete. | ||
google.protobuf.Timestamp end_time =1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.