// Copyright 2021 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 // // http://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"; package google.example.showcase.v1; import "google/api/annotations.proto"; import "google/api/client.proto"; option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; option java_multiple_files = true; option java_outer_classname = "ComplicanceProto"; option java_package = "com.google.example.showcase.v1"; // This service is used to test that GAPICs can transcode proto3 requests to // REST format correctly for various types of HTTP annotations.... service Compliance { option (google.api.default_host) = "showcase.googleapis.com"; // This method echoes the ComplianceData request. This method exercises // sending the entire request object in the REST body. rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) { option (google.api.http) = { post: "/v1/repeat:body" body: "*" }; } // This method echoes the ComplianceData request. This method exercises // sending the a message-type field in the REST body. Per AIP-127, only // top-level, non-repeated fields can be sent this way. rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) { option (google.api.http) = { post: "/v1/repeat:bodyinfo" body: "info" }; } // This method echoes the ComplianceData request. This method exercises // sending all request fields as query parameters. rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) { option (google.api.http) = { get: "/v1/repeat:query" }; } // This method echoes the ComplianceData request. This method exercises // sending some parameters as "simple" path variables (i.e., of the form // "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) { option (google.api.http) = { get: "/v1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}:simplepath" }; } // Same as RepeatDataSimplePath, but with a path resource. rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { option (google.api.http) = { get: "/v1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" }; } // Same as RepeatDataSimplePath, but with a trailing resource. rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { option (google.api.http) = { get: "/v1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" }; } } message RepeatRequest { string name = 1; ComplianceData info = 2; } message RepeatResponse { ComplianceData info = 1; } // ComplianceData is a message used for testing REST transcoding of // different data types. message ComplianceData { string f_string = 1; int32 f_int32 = 2; sint32 f_sint32 = 3; sfixed32 f_sfixed32 = 4; uint32 f_uint32 = 5; fixed32 f_fixed32 = 6; int64 f_int64 = 7; sint64 f_sint64 = 8; sfixed64 f_sfixed64 = 9; uint64 f_uint64 = 10; fixed64 f_fixed64 = 11; double f_double = 12; float f_float = 13; bool f_bool = 14; bytes f_bytes = 15; ComplianceDataChild f_child = 16; optional string p_string = 17; optional int32 p_int32 = 18; optional double p_double = 19; optional bool p_bool = 20; optional ComplianceDataChild p_child = 21; } message ComplianceDataChild { string f_string = 1; float f_float = 2; double f_double = 3; bool f_bool = 4; ComplianceDataGrandchild f_child = 5; optional string p_string = 6; optional float p_float = 7; optional double p_double = 8; optional bool p_bool = 9; optional ComplianceDataGrandchild p_child = 10; } message ComplianceDataGrandchild { string f_string = 1; double f_double = 2; bool f_bool = 3; }