diff --git a/baselines/disable-packing-test/package.json b/baselines/disable-packing-test/package.json index baa79ac72..972a9e397 100644 --- a/baselines/disable-packing-test/package.json +++ b/baselines/disable-packing-test/package.json @@ -21,9 +21,11 @@ "cloud", "google showcase", "showcase", + "compliance", "echo", "identity", "messaging", + "sequence service", "testing" ], "scripts": { diff --git a/baselines/disable-packing-test/protos/google/showcase/v1beta1/compliance.proto.baseline b/baselines/disable-packing-test/protos/google/showcase/v1beta1/compliance.proto.baseline new file mode 100644 index 000000000..9b6c0b7d7 --- /dev/null +++ b/baselines/disable-packing-test/protos/google/showcase/v1beta1/compliance.proto.baseline @@ -0,0 +1,269 @@ +// 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 +// +// 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"; + +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; +option ruby_package = "Google::Showcase::V1beta1"; + +// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format +// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped +// correctly. +service Compliance { + // 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 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: "/v1beta1/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: "/v1beta1/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: "/v1beta1/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: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" + }; + } + + // Same as RepeatDataSimplePath, but with a path resource. + rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" + additional_bindings { + get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" + } + }; + } + + // Same as RepeatDataSimplePath, but with a trailing resource. + rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" + }; + } + + // This method echoes the ComplianceData request, using the HTTP PUT method. + rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + put: "/v1beta1/repeat:bodyput" + body: "*" + }; + } + + // This method echoes the ComplianceData request, using the HTTP PATCH method. + rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + patch: "/v1beta1/repeat:bodypatch" + body: "*" + }; + } + + // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the + // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the + // response from this RPC as the request to VerifyEnum() + // + // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for + // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. + rpc GetEnum(EnumRequest) returns (EnumResponse) { + option (google.api.http) = { + get: "/v1beta1/compliance/enum" + }; + } + + // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() + // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds + // with the same EnumResponse; otherwise, the RPC errors. + // + // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, + // although they are not guaranteed to be the same across separate Showcase server runs. + rpc VerifyEnum(EnumResponse) returns (EnumResponse) { + option (google.api.http) = { + post: "/v1beta1/compliance/enum" + }; + } + +} + +message RepeatRequest { + string name = 1; + ComplianceData info = 2; + + // If true, the server will verify that the received request matches + // the request with the same name in the compliance test suite. + bool server_verify = 3; + + // The URI template this request is expected to be bound to server-side. + optional string intended_binding_uri = 10; + + // Some top level fields, to test that these are encoded correctly + // in query params. + int32 f_int32 = 4; + int64 f_int64 = 5; + double f_double = 6; + + optional int32 p_int32 = 7; + optional int64 p_int64 = 8; + optional double p_double = 9; +} + +message RepeatResponse { + RepeatRequest request = 1; + + // The URI template the request was bound to server-side. + string binding_uri = 2; +} + +// ComplianceSuite contains a set of requests that microgenerators should issue +// over REST to the Compliance service to test their gRPC-to-REST transcoding +// implementation. +message ComplianceSuite { + repeated ComplianceGroup group = 1; +} + +// ComplianceGroups encapsulates a group of RPC requests to the Compliance +// server: one request for each combination of elements of `rpcs` and of +// `requests`. +message ComplianceGroup { + string name = 1; + repeated string rpcs = 2; + repeated RepeatRequest requests = 3; +} + +// ComplianceData is a message used for testing REST transcoding of +// different data types. +message ComplianceData { + enum LifeKingdom { + LIFE_KINGDOM_UNSPECIFIED = 0; + ARCHAEBACTERIA = 1; + EUBACTERIA = 2; + PROTISTA = 3; + FUNGI = 4; + PLANTAE = 5; + ANIMALIA = 6; +} + // scalar types + + 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; + + LifeKingdom f_kingdom = 22; + + ComplianceDataChild f_child = 16; + + // optional fields + + optional string p_string = 17; + optional int32 p_int32 = 18; + optional double p_double = 19; + optional bool p_bool = 20; + optional LifeKingdom p_kingdom = 23; + optional ComplianceDataChild p_child = 21; +} + +message ComplianceDataChild { + string f_string = 1; + float f_float = 2; + double f_double = 3; + bool f_bool = 4; + Continent f_continent = 11; + ComplianceDataGrandchild f_child = 5; + + optional string p_string = 6; + optional float p_float = 7; + optional double p_double = 8; + optional bool p_bool = 9; + Continent p_continent = 12; + optional ComplianceDataGrandchild p_child = 10; +} + +message ComplianceDataGrandchild { + string f_string = 1; + double f_double = 2; + bool f_bool = 3; +} + +enum Continent { + CONTINENT_UNSPECIFIED = 0; + AFRICA = 1; + AMERICA = 2; + ANTARTICA = 3; + AUSTRALIA = 4; + EUROPE = 5; +} + + +message EnumRequest { + // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. + bool unknown_enum = 1; +} + +message EnumResponse { + // The original request for a known or unknown enum from the server. + EnumRequest request = 1; + + // The actual enum the server provided. + Continent continent = 2; +} diff --git a/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline b/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline index 6e9d78a37..1b1b160f0 100644 --- a/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline +++ b/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline @@ -17,6 +17,7 @@ syntax = "proto3"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/routing.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -27,27 +28,63 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // 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. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. +// to have the values echoed in the response trailers. Set the +// 'x-goog-request-params' metadata key on any method to have the values +// echoed in the response headers. 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. + // This method simply echoes the request. This method showcases unary RPCs. rpc Echo(EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:echo" body: "*" }; + option (google.api.routing) = { + routing_parameters{ + field: "header" + } + routing_parameters{ + field: "header" + path_template: "{routing_id=**}" + } + routing_parameters{ + field: "header" + path_template: "{table_name=regions/*/zones/*/**}" + } + routing_parameters{ + field: "header" + path_template: "{super_id=projects/*}/**" + } + routing_parameters{ + field: "header" + path_template: "{table_name=projects/*/instances/*/**}" + } + routing_parameters{ + field: "header" + path_template: "projects/*/{instance_id=instances/*}/**" + } + routing_parameters{ + field: "other_header" + path_template: "{baz=**}" + } + routing_parameters{ + field: "other_header" + path_template: "{qux=projects/*}/**" + } + }; } - // This method split the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming rpcs. + // This method splits 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" @@ -60,7 +97,7 @@ service Echo { // 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. + // passed to it. This method showcases client-side streaming RPCs. rpc Collect(stream EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:collect" @@ -68,9 +105,9 @@ service Echo { }; } - // 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. + // This method, upon receiving a request on the stream, will pass the same + // content 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 @@ -82,8 +119,30 @@ service Echo { }; } - // This method will wait the requested amount of and then return. - // This method showcases how a client handles a request timing out. + // This is similar to the PagedExpand except that it uses + // max_results instead of page_size, as some legacy APIs still + // do. New APIs should NOT use this pattern. + rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacy" + body: "*" + }; + } + + // This method returns a map containing lists of words that appear in the input, keyed by their + // initial character. The only words returned are the ones included in the current page, + // as determined by page_token and page_size, which both refer to the word indices in the + // input. This paging result consisting of a map of lists is a pattern used by some legacy + // APIs. New APIs should NOT use this pattern. + rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacyMapped" + body: "*" + }; + } + + // This method will wait for the requested amount of time and then return. + // This method showcases how a client handles a request timeout. rpc Wait(WaitRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1beta1/echo:wait" @@ -95,7 +154,7 @@ service Echo { }; } - // This method will block (wait) for the requested amount of time + // This method will block (wait) for the requested amount of time // and then return the response or error. // This method showcases how a client handles delays or retries. rpc Block(BlockRequest) returns (BlockResponse) { @@ -106,9 +165,19 @@ service Echo { }; } -// 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. +// A severity enum used to test enum capabilities in GAPIC surfaces. +enum Severity { + UNNECESSARY = 0; + NECESSARY = 1; + URGENT = 2; + CRITICAL = 3; +} + + +// The request message used for the Echo, Collect and Chat methods. +// If content or opt are 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. @@ -117,12 +186,24 @@ message EchoRequest { // The error to be thrown by the server. google.rpc.Status error = 2; } + + // The severity to be echoed by the server. + Severity severity = 3; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string header = 4; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string other_header = 5; } // The response message for the Echo methods. message EchoResponse { // The content specified in the request. string content = 1; + + // The severity specified in the request. + Severity severity = 2; } // The request message for the Expand method. @@ -139,13 +220,29 @@ message PagedExpandRequest { // The string to expand. string content = 1 [(google.api.field_behavior) = REQUIRED]; - // The amount of words to returned in each page. + // The number of words to returned in each page. int32 page_size = 2; // The position of the page to be returned. string page_token = 3; } +// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New +// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to +// aip.dev/158. +message PagedExpandLegacyRequest { + // The string to expand. + string content = 1 [(google.api.field_behavior) = REQUIRED]; + + // The number of words to returned in each page. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + // violates aip.dev/158. Ordinarily, this should be page_size. --) + int32 max_results = 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. @@ -155,6 +252,21 @@ message PagedExpandResponse { string next_page_token = 2; } +// A list of words. +message PagedExpandResponseList { + repeated string words = 1; +} + +message PagedExpandLegacyMappedResponse { + // The words that were expanded, indexed by their initial character. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates + // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) + map alphabetized = 1; + + // The next page token. + string next_page_token = 2; +} + // The request for Wait method. message WaitRequest { oneof end { diff --git a/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline b/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline index 7558c1d4c..569c604d7 100644 --- a/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline +++ b/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline @@ -27,6 +27,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A simple identity service. service Identity { @@ -41,7 +42,8 @@ service Identity { body: "*" }; option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; + option (google.api.method_signature) = + "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; } // Retrieves the User with the given uri. @@ -56,7 +58,7 @@ service Identity { rpc UpdateUser(UpdateUserRequest) returns (User) { option (google.api.http) = { patch: "/v1beta1/{user.name=users/*}" - body: "*" + body: "user" }; } @@ -80,7 +82,7 @@ service Identity { message User { option (google.api.resource) = { type: "showcase.googleapis.com/User" - pattern: "users/{user_id}" + pattern: "users/{user}" }; // The resource name of the user. @@ -93,16 +95,14 @@ message User { string email = 3 [(google.api.field_behavior) = REQUIRED]; // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // The age of the use in years. + // The age of the user in years. optional int32 age = 6; // The height of the user in feet. @@ -117,7 +117,7 @@ message User { // Enables the receiving of notifications. The default is true if unset. // // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) + // Ordinarily, the default for a `bool` field should be false. --) optional bool enable_notifications = 9; } @@ -144,7 +144,7 @@ message UpdateUserRequest { // The user to update. User user = 1; - // The field mask to determine wich fields are to be updated. If empty, the + // The field mask to determine which fields are to be updated. If empty, the // server will assume all fields are to be updated. google.protobuf.FieldMask update_mask = 2; } diff --git a/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline b/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline index fb3bf51c5..62196dfce 100644 --- a/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline +++ b/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline @@ -29,6 +29,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A simple messaging service that implements chat rooms and profile posts. // @@ -60,7 +61,7 @@ service Messaging { rpc UpdateRoom(UpdateRoomRequest) returns (Room) { option (google.api.http) = { patch: "/v1beta1/{room.name=rooms/*}" - body: "*" + body: "room" }; } @@ -99,9 +100,7 @@ service Messaging { rpc GetBlurb(GetBlurbRequest) returns (Blurb) { option (google.api.http) = { get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - get: "/v1beta1/{name=users/*/profile/blurbs/*}" - } + additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } }; option (google.api.method_signature) = "name"; } @@ -110,10 +109,10 @@ service Messaging { rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { option (google.api.http) = { patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "*" + body: "blurb" additional_bindings: { patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "*" + body: "blurb" } }; } @@ -134,9 +133,7 @@ service Messaging { rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { option (google.api.http) = { get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { - get: "/v1beta1/{parent=users/*/profile}/blurbs" - } + additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } }; option (google.api.method_signature) = "parent"; } @@ -146,17 +143,17 @@ service Messaging { // contain an exact match of a queried word will be returned. rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { - post: "/v1beta1/{parent=rooms/-}/blurbs:search" + post: "/v1beta1/{parent=rooms/*}/blurbs:search" body: "*" additional_bindings: { - post: "/v1beta1/{parent=users/-/profile}/blurbs:search" + post: "/v1beta1/{parent=users/*/profile}/blurbs:search" } }; option (google.longrunning.operation_info) = { response_type: "SearchBlurbsResponse" metadata_type: "SearchBlurbsMetadata" }; - option (google.api.method_signature) = "query"; + option (google.api.method_signature) = "parent,query"; } // This returns a stream that emits the blurbs that are created for a @@ -196,7 +193,7 @@ service Messaging { message Room { option (google.api.resource) = { type: "showcase.googleapis.com/Room" - pattern: "rooms/{room_id}" + pattern: "rooms/{room}" }; // The resource name of the chat room. @@ -209,14 +206,12 @@ message Room { string description = 3; // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request message for the google.showcase.v1beta1.Messaging\CreateRoom @@ -242,7 +237,7 @@ message UpdateRoomRequest { // The room to update. Room room = 1; - // The field mask to determine wich fields are to be updated. If empty, the + // The field mask to determine which fields are to be updated. If empty, the // server will assume all fields are to be updated. google.protobuf.FieldMask update_mask = 2; } @@ -278,8 +273,8 @@ message ListRoomsResponse { // A token to retrieve next page of results. // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve the - // next page of results. + // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve + // the next page of results. string next_page_token = 2; } @@ -288,11 +283,10 @@ message ListRoomsResponse { message Blurb { option (google.api.resource) = { type: "showcase.googleapis.com/Blurb" - pattern: "rooms/{room_id}/blurbs/{blurb_id}" - pattern: "rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}" - pattern: "user/{user_id}/profile/blurbs/{blurb_id}" - pattern: "user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}" - + pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" + pattern: "users/{user}/profile/blurbs/{blurb}" + pattern: "rooms/{room}/blurbs/{blurb}" + pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" }; // The resource name of the chat room. @@ -301,7 +295,8 @@ message Blurb { // The resource name of the blurb's author. string user = 2 [ (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED]; + (google.api.field_behavior) = REQUIRED + ]; oneof content { // The textual content of this blurb. @@ -312,24 +307,25 @@ message Blurb { } // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. --) + // resource patterns. Ordinarily, non-slash separators are discouraged. + // --) oneof legacy_id { // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern `rooms/{room_id}/blurbs/{legacy_room_id}.{blurb_id}` + // the use of the compound resource pattern + // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` string legacy_room_id = 7; // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern `rooms/{room_id}/blurbs/{legacy_user_id}~{blurb_id}` + // the use of the compound resource pattern + // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` string legacy_user_id = 8; } } @@ -340,7 +336,8 @@ message CreateBlurbRequest { // The resource name of the chat room or user profile that this blurb will // be tied to. string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; @@ -384,11 +381,11 @@ message DeleteBlurbRequest { message ListBlurbsRequest { // The resource name of the requested room or profile whos blurbs to list. string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; - // The maximum number of blurbs to return. Server may return fewer // blurbs than requested. If unspecified, server will pick an appropriate // default. @@ -422,8 +419,8 @@ message SearchBlurbsRequest { // The rooms or profiles to search. If unset, `SearchBlurbs` will search all // rooms and all profiles. - string parent = 2 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb"]; + string parent = 2 [(google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb"]; // The maximum number of blurbs return. Server may return fewer // blurbs than requested. If unspecified, server will pick an appropriate @@ -462,14 +459,14 @@ message SearchBlurbsResponse { message StreamBlurbsRequest { // The resource name of a chat room or user profile whose blurbs to stream. string name = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 [ - (google.api.field_behavior) = REQUIRED - ]; + google.protobuf.Timestamp expire_time = 2 + [(google.api.field_behavior) = REQUIRED]; } // The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs @@ -508,8 +505,8 @@ message SendBlurbsResponse { message ConnectRequest { message ConnectConfig { // The room or profile to follow and create messages for. - string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb"]; + string parent = 1 [(google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb"]; } oneof request { diff --git a/baselines/disable-packing-test/protos/google/showcase/v1beta1/sequence.proto.baseline b/baselines/disable-packing-test/protos/google/showcase/v1beta1/sequence.proto.baseline new file mode 100644 index 000000000..26158fdd8 --- /dev/null +++ b/baselines/disable-packing-test/protos/google/showcase/v1beta1/sequence.proto.baseline @@ -0,0 +1,136 @@ +// Copyright 2020 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/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.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; +option ruby_package = "Google::Showcase::V1beta1"; + +service SequenceService { + // This service is meant to only run locally on the port 7469 (keypad digits + // for "show"). + option (google.api.default_host) = "localhost:7469"; + + // Creates a sequence. + rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { + option (google.api.http) = { + post: "/v1beta1/sequences" + body: "sequence" + }; + option (google.api.method_signature) = "sequence"; + }; + + // Retrieves a sequence. + rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { + option (google.api.http) = { + get: "/v1beta1/{name=sequences/*/sequenceReport}" + }; + option (google.api.method_signature) = "name"; + }; + + // Attempts a sequence. + rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1beta1/{name=sequences/*}" + body: "*" + }; + option (google.api.method_signature) = "name"; + }; +} + +message Sequence { + option (google.api.resource) = { + type: "showcase.googleapis.com/Sequence" + pattern: "sequences/{sequence}" + }; + + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A server response to an RPC Attempt in a sequence. + message Response { + // The status to return for an individual attempt. + google.rpc.Status status = 1; + + // The amount of time to delay sending the response. + google.protobuf.Duration delay = 2; + } + + // Sequence of responses to return in order for each attempt. If empty, the + // default response is an immediate OK. + repeated Response responses = 2; +} + +message SequenceReport { + option (google.api.resource) = { + type: "showcase.googleapis.com/SequenceReport" + pattern: "sequences/{sequence}/sequenceReport" + }; + + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Contains metrics on individual RPC Attempts in a sequence. + message Attempt { + // The attempt number - starting at 0. + int32 attempt_number = 1; + + // The deadline dictated by the attempt to the server. + google.protobuf.Timestamp attempt_deadline = 2; + + // The time that the server responded to the RPC attempt. Used for + // calculating attempt_delay. + google.protobuf.Timestamp response_time = 3; + + // The server perceived delay between sending the last response and + // receiving this attempt. Used for validating attempt delay backoff. + google.protobuf.Duration attempt_delay = 4; + + // The status returned to the attempt. + google.rpc.Status status = 5; + } + + // The set of RPC attempts received by the server for a Sequence. + repeated Attempt attempts = 2; +} + +message CreateSequenceRequest { + Sequence sequence = 1; +} + +message AttemptSequenceRequest { + string name = 1 [ + (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", + (google.api.field_behavior) = REQUIRED + ]; +} + +message GetSequenceReportRequest { + string name = 1 [ + (google.api.resource_reference).type = + "showcase.googleapis.com/SequenceReport", + (google.api.field_behavior) = REQUIRED + ]; +} diff --git a/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline b/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline index b5d9d7283..56e85e97e 100644 --- a/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline +++ b/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline @@ -24,6 +24,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A service to facilitate running discrete sets of tests // against Showcase. diff --git a/baselines/disable-packing-test/src/index.ts.baseline b/baselines/disable-packing-test/src/index.ts.baseline index 2fb6dad96..4679513de 100644 --- a/baselines/disable-packing-test/src/index.ts.baseline +++ b/baselines/disable-packing-test/src/index.ts.baseline @@ -17,15 +17,19 @@ // ** All changes to this file may be overwritten. ** import * as v1beta1 from './v1beta1'; +const ComplianceClient = v1beta1.ComplianceClient; +type ComplianceClient = v1beta1.ComplianceClient; const EchoClient = v1beta1.EchoClient; type EchoClient = v1beta1.EchoClient; const IdentityClient = v1beta1.IdentityClient; type IdentityClient = v1beta1.IdentityClient; const MessagingClient = v1beta1.MessagingClient; type MessagingClient = v1beta1.MessagingClient; +const SequenceServiceClient = v1beta1.SequenceServiceClient; +type SequenceServiceClient = v1beta1.SequenceServiceClient; const TestingClient = v1beta1.TestingClient; type TestingClient = v1beta1.TestingClient; -export {v1beta1, EchoClient, IdentityClient, MessagingClient, TestingClient}; -export default {v1beta1, EchoClient, IdentityClient, MessagingClient, TestingClient}; +export {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; +export default {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; import * as protos from '../protos/protos'; export {protos} diff --git a/baselines/disable-packing-test/src/v1beta1/compliance_client.ts.baseline b/baselines/disable-packing-test/src/v1beta1/compliance_client.ts.baseline new file mode 100644 index 000000000..d3d5f4c2e --- /dev/null +++ b/baselines/disable-packing-test/src/v1beta1/compliance_client.ts.baseline @@ -0,0 +1,1521 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/compliance_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './compliance_client_config.json'; +const version = require('../../../package.json').version; + +/** + * This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format + * correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped + * correctly. + * @class + * @memberof v1beta1 + */ +export class ComplianceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + complianceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ComplianceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ComplianceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ComplianceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + blueprintPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}/blueprints/{blueprint}' + ), + roomPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}' + ), + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' + ), + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' + ), + sessionPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}' + ), + testPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}' + ), + userPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}' + ), + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' + ), + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.showcase.v1beta1.Compliance', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.complianceStub) { + return this.complianceStub; + } + + // Put together the "service stub" for + // google.showcase.v1beta1.Compliance. + this.complianceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Compliance') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.showcase.v1beta1.Compliance, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const complianceStubMethods = + ['repeatDataBody', 'repeatDataBodyInfo', 'repeatDataQuery', 'repeatDataSimplePath', 'repeatDataPathResource', 'repeatDataPathTrailingResource', 'repeatDataBodyPut', 'repeatDataBodyPatch', 'getEnum', 'verifyEnum']; + for (const methodName of complianceStubMethods) { + const callPromise = this.complianceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.complianceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'localhost'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'localhost'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 7469; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * This method echoes the ComplianceData request. This method exercises + * sending the entire request object in the REST body. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBody_async + */ + repeatDataBody( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBody( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBody( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBody( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBody(request, options, callback); + } +/** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body_info.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyInfo_async + */ + repeatDataBodyInfo( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBodyInfo( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyInfo( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyInfo( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBodyInfo(request, options, callback); + } +/** + * This method echoes the ComplianceData request. This method exercises + * sending all request fields as query parameters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_query.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataQuery_async + */ + repeatDataQuery( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataQuery( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataQuery( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataQuery( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataQuery(request, options, callback); + } +/** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_simple_path.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataSimplePath_async + */ + repeatDataSimplePath( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataSimplePath( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataSimplePath( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataSimplePath( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'info.f_string': request.info!.fString || '', + 'info.f_int32': request.info!.fInt32 || '', + 'info.f_double': request.info!.fDouble || '', + 'info.f_bool': request.info!.fBool || '', + 'info.f_kingdom': request.info!.fKingdom || '', + }); + this.initialize(); + return this.innerApiCalls.repeatDataSimplePath(request, options, callback); + } +/** + * Same as RepeatDataSimplePath, but with a path resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_path_resource.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathResource_async + */ + repeatDataPathResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataPathResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'info.f_string': request.info!.fString || '', + 'info.f_child.f_string': request.info!.fChild!.fString || '', + 'info.f_bool': request.info!.fBool || '', + }); + this.initialize(); + return this.innerApiCalls.repeatDataPathResource(request, options, callback); + } +/** + * Same as RepeatDataSimplePath, but with a trailing resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_path_trailing_resource.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathTrailingResource_async + */ + repeatDataPathTrailingResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataPathTrailingResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathTrailingResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathTrailingResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'info.f_string': request.info!.fString || '', + 'info.f_child.f_string': request.info!.fChild!.fString || '', + }); + this.initialize(); + return this.innerApiCalls.repeatDataPathTrailingResource(request, options, callback); + } +/** + * This method echoes the ComplianceData request, using the HTTP PUT method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body_put.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPut_async + */ + repeatDataBodyPut( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBodyPut( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPut( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPut( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBodyPut(request, options, callback); + } +/** + * This method echoes the ComplianceData request, using the HTTP PATCH method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body_patch.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPatch_async + */ + repeatDataBodyPatch( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBodyPatch( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPatch( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPatch( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBodyPatch(request, options, callback); + } +/** + * This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the + * .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the + * response from this RPC as the request to VerifyEnum() + * + * The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for + * VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. + * + * @param {Object} request + * The request object that will be sent. + * @param {boolean} request.unknownEnum + * Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EnumResponse]{@link google.showcase.v1beta1.EnumResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.get_enum.js + * region_tag:localhost_v1beta1_generated_Compliance_GetEnum_async + */ + getEnum( + request?: protos.google.showcase.v1beta1.IEnumRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined + ]>; + getEnum( + request: protos.google.showcase.v1beta1.IEnumRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>): void; + getEnum( + request: protos.google.showcase.v1beta1.IEnumRequest, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>): void; + getEnum( + request?: protos.google.showcase.v1beta1.IEnumRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.getEnum(request, options, callback); + } +/** + * This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() + * verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds + * with the same EnumResponse; otherwise, the RPC errors. + * + * This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, + * although they are not guaranteed to be the same across separate Showcase server runs. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.showcase.v1beta1.EnumRequest} request.request + * The original request for a known or unknown enum from the server. + * @param {google.showcase.v1beta1.Continent} request.continent + * The actual enum the server provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EnumResponse]{@link google.showcase.v1beta1.EnumResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.verify_enum.js + * region_tag:localhost_v1beta1_generated_Compliance_VerifyEnum_async + */ + verifyEnum( + request?: protos.google.showcase.v1beta1.IEnumResponse, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined + ]>; + verifyEnum( + request: protos.google.showcase.v1beta1.IEnumResponse, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>): void; + verifyEnum( + request: protos.google.showcase.v1beta1.IEnumResponse, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>): void; + verifyEnum( + request?: protos.google.showcase.v1beta1.IEnumResponse, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.verifyEnum(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified blueprint resource name string. + * + * @param {string} session + * @param {string} test + * @param {string} blueprint + * @returns {string} Resource name string. + */ + blueprintPath(session:string,test:string,blueprint:string) { + return this.pathTemplates.blueprintPathTemplate.render({ + session: session, + test: test, + blueprint: blueprint, + }); + } + + /** + * Parse the session from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the session. + */ + matchSessionFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; + } + + /** + * Parse the test from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the test. + */ + matchTestFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; + } + + /** + * Parse the blueprint from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the blueprint. + */ + matchBlueprintFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; + } + + /** + * Return a fully-qualified room resource name string. + * + * @param {string} room + * @returns {string} Resource name string. + */ + roomPath(room:string) { + return this.pathTemplates.roomPathTemplate.render({ + room: room, + }); + } + + /** + * Parse the room from Room resource. + * + * @param {string} roomName + * A fully-qualified path representing Room resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; + } + + /** + * Parse the blurb from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. + */ + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; + } + + /** + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from SequenceReport resource. + * + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; + } + + /** + * Return a fully-qualified session resource name string. + * + * @param {string} session + * @returns {string} Resource name string. + */ + sessionPath(session:string) { + return this.pathTemplates.sessionPathTemplate.render({ + session: session, + }); + } + + /** + * Parse the session from Session resource. + * + * @param {string} sessionName + * A fully-qualified path representing Session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromSessionName(sessionName: string) { + return this.pathTemplates.sessionPathTemplate.match(sessionName).session; + } + + /** + * Return a fully-qualified test resource name string. + * + * @param {string} session + * @param {string} test + * @returns {string} Resource name string. + */ + testPath(session:string,test:string) { + return this.pathTemplates.testPathTemplate.render({ + session: session, + test: test, + }); + } + + /** + * Parse the session from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the session. + */ + matchSessionFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).session; + } + + /** + * Parse the test from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the test. + */ + matchTestFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).test; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user:string) { + return this.pathTemplates.userPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * Return a fully-qualified userProfileBlurb resource name string. + * + * @param {string} user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; + } + + /** + * Parse the blurb from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; + } + + /** + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. + * + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; + } + + /** + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. + */ + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; + } + + /** + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.complianceStub && !this._terminated) { + return this.complianceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/baselines/disable-packing-test/src/v1beta1/compliance_client_config.json.baseline b/baselines/disable-packing-test/src/v1beta1/compliance_client_config.json.baseline new file mode 100644 index 000000000..43582a4ff --- /dev/null +++ b/baselines/disable-packing-test/src/v1beta1/compliance_client_config.json.baseline @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.showcase.v1beta1.Compliance": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "RepeatDataBody": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataBodyInfo": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataQuery": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataSimplePath": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataPathResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataPathTrailingResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataBodyPut": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataBodyPatch": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetEnum": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "VerifyEnum": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/baselines/disable-packing-test/src/v1beta1/compliance_proto_list.json.baseline b/baselines/disable-packing-test/src/v1beta1/compliance_proto_list.json.baseline new file mode 100644 index 000000000..987b27b7e --- /dev/null +++ b/baselines/disable-packing-test/src/v1beta1/compliance_proto_list.json.baseline @@ -0,0 +1,8 @@ +[ + "../../protos/google/showcase/v1beta1/compliance.proto", + "../../protos/google/showcase/v1beta1/echo.proto", + "../../protos/google/showcase/v1beta1/identity.proto", + "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", + "../../protos/google/showcase/v1beta1/testing.proto" +] diff --git a/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline b/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline index df6b7de47..63a73963a 100644 --- a/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline +++ b/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline @@ -35,7 +35,9 @@ const version = require('../../../package.json').version; * side streaming, client side streaming, and bidirectional streaming. This * service also exposes methods that explicitly implement server delay, and * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. + * to have the values echoed in the response trailers. Set the + * 'x-goog-request-params' metadata key on any method to have the values + * echoed in the response headers. * @class * @memberof v1beta1 */ @@ -172,13 +174,19 @@ export class EchoClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -187,13 +195,13 @@ export class EchoClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -281,7 +289,7 @@ export class EchoClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const echoStubMethods = - ['echo', 'expand', 'collect', 'chat', 'pagedExpand', 'wait', 'block']; + ['echo', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; for (const methodName of echoStubMethods) { const callPromise = this.echoStub.then( stub => (...args: Array<{}>) => { @@ -379,6 +387,12 @@ export class EchoClient { * The content to be echoed by the server. * @param {google.rpc.Status} request.error * The error to be thrown by the server. + * @param {google.showcase.v1beta1.Severity} request.severity + * The severity to be echoed by the server. + * @param {string} request.header + * Optional. This field can be set to test the routing annotation on the Echo method. + * @param {string} request.otherHeader + * Optional. This field can be set to test the routing annotation on the Echo method. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -435,9 +449,169 @@ export class EchoClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?
.*)')); + if (match) { + const parameterValue = match.groups?.['header'] ?? fieldValue; + Object.assign(routingParameter, { header: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); + if (match) { + const parameterValue = match.groups?.['routing_id'] ?? fieldValue; + Object.assign(routingParameter, { routing_id: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); + if (match) { + const parameterValue = match.groups?.['table_name'] ?? fieldValue; + Object.assign(routingParameter, { table_name: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['super_id'] ?? fieldValue; + Object.assign(routingParameter, { super_id: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); + if (match) { + const parameterValue = match.groups?.['table_name'] ?? fieldValue; + Object.assign(routingParameter, { table_name: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['instance_id'] ?? fieldValue; + Object.assign(routingParameter, { instance_id: parameterValue }); + } + } + } + { + const fieldValue = request.otherHeader; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); + if (match) { + const parameterValue = match.groups?.['baz'] ?? fieldValue; + Object.assign(routingParameter, { baz: parameterValue }); + } + } + } + { + const fieldValue = request.otherHeader; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['qux'] ?? fieldValue; + Object.assign(routingParameter, { qux: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); this.initialize(); return this.innerApiCalls.echo(request, options, callback); } +/** + * This is similar to the PagedExpand except that it uses + * max_results instead of page_size, as some legacy APIs still + * do. New APIs should NOT use this pattern. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.content + * The string to expand. + * @param {number} request.maxResults + * The number of words to returned in each page. + * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + * violates aip.dev/158. Ordinarily, this should be page_size. --) + * @param {string} request.pageToken + * The position of the page to be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PagedExpandResponse]{@link google.showcase.v1beta1.PagedExpandResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js + * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async + */ + pagedExpandLegacy( + request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined + ]>; + pagedExpandLegacy( + request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): void; + pagedExpandLegacy( + request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + callback: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): void; + pagedExpandLegacy( + request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.pagedExpandLegacy(request, options, callback); + } /** * This method will block (wait) for the requested amount of time * and then return the response or error. @@ -513,8 +687,8 @@ export class EchoClient { } /** - * This method split the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming rpcs. + * This method splits the given content into words and will pass each word back + * through the stream. This method showcases server-side streaming RPCs. * * @param {Object} request * The request object that will be sent. @@ -547,7 +721,7 @@ export class EchoClient { /** * 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. + * passed to it. This method showcases client-side streaming RPCs. * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -592,9 +766,9 @@ export class EchoClient { } /** - * 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. + * This method, upon receiving a request on the stream, will pass the same + * content back on the stream. This method showcases bidirectional + * streaming RPCs. * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -616,8 +790,8 @@ export class EchoClient { } /** - * This method will wait the requested amount of and then return. - * This method showcases how a client handles a request timing out. + * This method will wait for the requested amount of time and then return. + * This method showcases how a client handles a request timeout. * * @param {Object} request * The request object that will be sent. @@ -718,7 +892,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -793,7 +967,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -835,7 +1009,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -924,109 +1098,155 @@ export class EchoClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Return a fully-qualified roomBlurb resource name string. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the blurb from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -1091,109 +1311,109 @@ export class EchoClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline b/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline index c30d10733..57bd509e9 100644 --- a/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline +++ b/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline @@ -40,6 +40,14 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "PagedExpandLegacy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PagedExpandLegacyMapped": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "Wait": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline b/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline +++ b/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline b/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline index 3fe26d990..f3ae58c89 100644 --- a/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline +++ b/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline @@ -167,13 +167,19 @@ export class IdentityClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -182,13 +188,13 @@ export class IdentityClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -470,7 +476,7 @@ export class IdentityClient { * @param {google.showcase.v1beta1.User} request.user * The user to update. * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the + * The field mask to determine which fields are to be updated. If empty, the * server will assume all fields are to be updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -825,109 +831,155 @@ export class IdentityClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Parse the blurb from RoomBlurb resource. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from Sequence resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Return a fully-qualified sequenceReport resource name string. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} sequence + * @returns {string} Resource name string. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -992,109 +1044,109 @@ export class IdentityClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline b/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline +++ b/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/disable-packing-test/src/v1beta1/index.ts.baseline b/baselines/disable-packing-test/src/v1beta1/index.ts.baseline index 2bbe1b17c..fe53c41ac 100644 --- a/baselines/disable-packing-test/src/v1beta1/index.ts.baseline +++ b/baselines/disable-packing-test/src/v1beta1/index.ts.baseline @@ -16,7 +16,9 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +export {ComplianceClient} from './compliance_client'; export {EchoClient} from './echo_client'; export {IdentityClient} from './identity_client'; export {MessagingClient} from './messaging_client'; +export {SequenceServiceClient} from './sequence_service_client'; export {TestingClient} from './testing_client'; diff --git a/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline b/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline index 74e8b2769..6e43a0b81 100644 --- a/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline +++ b/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline @@ -171,13 +171,19 @@ export class MessagingClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -186,13 +192,13 @@ export class MessagingClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -518,7 +524,7 @@ export class MessagingClient { * @param {google.showcase.v1beta1.Room} request.room * The room to update. * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the + * The field mask to determine which fields are to be updated. If empty, the * server will assume all fields are to be updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1565,109 +1571,155 @@ export class MessagingClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Return a fully-qualified roomBlurb resource name string. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the blurb from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -1732,109 +1784,109 @@ export class MessagingClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline b/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline +++ b/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/disable-packing-test/src/v1beta1/sequence_service_client.ts.baseline b/baselines/disable-packing-test/src/v1beta1/sequence_service_client.ts.baseline new file mode 100644 index 000000000..36d65d353 --- /dev/null +++ b/baselines/disable-packing-test/src/v1beta1/sequence_service_client.ts.baseline @@ -0,0 +1,919 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/sequence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sequence_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta1 + */ +export class SequenceServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sequenceServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SequenceServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SequenceServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SequenceServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + blueprintPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}/blueprints/{blueprint}' + ), + roomPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}' + ), + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' + ), + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' + ), + sessionPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}' + ), + testPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}' + ), + userPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}' + ), + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' + ), + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.showcase.v1beta1.SequenceService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sequenceServiceStub) { + return this.sequenceServiceStub; + } + + // Put together the "service stub" for + // google.showcase.v1beta1.SequenceService. + this.sequenceServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.SequenceService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.showcase.v1beta1.SequenceService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sequenceServiceStubMethods = + ['createSequence', 'getSequenceReport', 'attemptSequence']; + for (const methodName of sequenceServiceStubMethods) { + const callPromise = this.sequenceServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sequenceServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'localhost'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'localhost'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 7469; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a sequence. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.showcase.v1beta1.Sequence} request.sequence + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Sequence]{@link google.showcase.v1beta1.Sequence}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/sequence_service.create_sequence.js + * region_tag:localhost_v1beta1_generated_SequenceService_CreateSequence_async + */ + createSequence( + request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined + ]>; + createSequence( + request: protos.google.showcase.v1beta1.ICreateSequenceRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>): void; + createSequence( + request: protos.google.showcase.v1beta1.ICreateSequenceRequest, + callback: Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>): void; + createSequence( + request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.createSequence(request, options, callback); + } +/** + * Retrieves a sequence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SequenceReport]{@link google.showcase.v1beta1.SequenceReport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/sequence_service.get_sequence_report.js + * region_tag:localhost_v1beta1_generated_SequenceService_GetSequenceReport_async + */ + getSequenceReport( + request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined + ]>; + getSequenceReport( + request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>): void; + getSequenceReport( + request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + callback: Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>): void; + getSequenceReport( + request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSequenceReport(request, options, callback); + } +/** + * Attempts a sequence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/sequence_service.attempt_sequence.js + * region_tag:localhost_v1beta1_generated_SequenceService_AttemptSequence_async + */ + attemptSequence( + request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined + ]>; + attemptSequence( + request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>): void; + attemptSequence( + request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>): void; + attemptSequence( + request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.attemptSequence(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified blueprint resource name string. + * + * @param {string} session + * @param {string} test + * @param {string} blueprint + * @returns {string} Resource name string. + */ + blueprintPath(session:string,test:string,blueprint:string) { + return this.pathTemplates.blueprintPathTemplate.render({ + session: session, + test: test, + blueprint: blueprint, + }); + } + + /** + * Parse the session from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the session. + */ + matchSessionFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; + } + + /** + * Parse the test from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the test. + */ + matchTestFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; + } + + /** + * Parse the blueprint from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the blueprint. + */ + matchBlueprintFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; + } + + /** + * Return a fully-qualified room resource name string. + * + * @param {string} room + * @returns {string} Resource name string. + */ + roomPath(room:string) { + return this.pathTemplates.roomPathTemplate.render({ + room: room, + }); + } + + /** + * Parse the room from Room resource. + * + * @param {string} roomName + * A fully-qualified path representing Room resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; + } + + /** + * Parse the blurb from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. + */ + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; + } + + /** + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from SequenceReport resource. + * + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; + } + + /** + * Return a fully-qualified session resource name string. + * + * @param {string} session + * @returns {string} Resource name string. + */ + sessionPath(session:string) { + return this.pathTemplates.sessionPathTemplate.render({ + session: session, + }); + } + + /** + * Parse the session from Session resource. + * + * @param {string} sessionName + * A fully-qualified path representing Session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromSessionName(sessionName: string) { + return this.pathTemplates.sessionPathTemplate.match(sessionName).session; + } + + /** + * Return a fully-qualified test resource name string. + * + * @param {string} session + * @param {string} test + * @returns {string} Resource name string. + */ + testPath(session:string,test:string) { + return this.pathTemplates.testPathTemplate.render({ + session: session, + test: test, + }); + } + + /** + * Parse the session from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the session. + */ + matchSessionFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).session; + } + + /** + * Parse the test from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the test. + */ + matchTestFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).test; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user:string) { + return this.pathTemplates.userPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * Return a fully-qualified userProfileBlurb resource name string. + * + * @param {string} user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; + } + + /** + * Parse the blurb from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; + } + + /** + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. + * + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; + } + + /** + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. + */ + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; + } + + /** + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sequenceServiceStub && !this._terminated) { + return this.sequenceServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/baselines/disable-packing-test/src/v1beta1/sequence_service_client_config.json.baseline b/baselines/disable-packing-test/src/v1beta1/sequence_service_client_config.json.baseline new file mode 100644 index 000000000..77c80d32a --- /dev/null +++ b/baselines/disable-packing-test/src/v1beta1/sequence_service_client_config.json.baseline @@ -0,0 +1,38 @@ +{ + "interfaces": { + "google.showcase.v1beta1.SequenceService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateSequence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSequenceReport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AttemptSequence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/baselines/disable-packing-test/src/v1beta1/sequence_service_proto_list.json.baseline b/baselines/disable-packing-test/src/v1beta1/sequence_service_proto_list.json.baseline new file mode 100644 index 000000000..987b27b7e --- /dev/null +++ b/baselines/disable-packing-test/src/v1beta1/sequence_service_proto_list.json.baseline @@ -0,0 +1,8 @@ +[ + "../../protos/google/showcase/v1beta1/compliance.proto", + "../../protos/google/showcase/v1beta1/echo.proto", + "../../protos/google/showcase/v1beta1/identity.proto", + "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", + "../../protos/google/showcase/v1beta1/testing.proto" +] diff --git a/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline b/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline index d1ce0f1f0..305f6fcf9 100644 --- a/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline +++ b/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline @@ -168,13 +168,19 @@ export class TestingClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -183,13 +189,13 @@ export class TestingClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -1147,109 +1153,155 @@ export class TestingClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Parse the blurb from RoomBlurb resource. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from Sequence resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Return a fully-qualified sequenceReport resource name string. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} sequence + * @returns {string} Resource name string. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -1314,109 +1366,109 @@ export class TestingClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline b/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline +++ b/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/disable-packing-test/test/gapic_compliance_v1beta1.ts.baseline b/baselines/disable-packing-test/test/gapic_compliance_v1beta1.ts.baseline new file mode 100644 index 000000000..07090b939 --- /dev/null +++ b/baselines/disable-packing-test/test/gapic_compliance_v1beta1.ts.baseline @@ -0,0 +1,1413 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as complianceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1beta1.ComplianceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = complianceModule.v1beta1.ComplianceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = complianceModule.v1beta1.ComplianceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = complianceModule.v1beta1.ComplianceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new complianceModule.v1beta1.ComplianceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.complianceStub, undefined); + await client.initialize(); + assert(client.complianceStub); + }); + + it('has close method for the initialized client', done => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.complianceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.complianceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('repeatDataBody', () => { + it('invokes repeatDataBody without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBody = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBody(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBody as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBody without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBody = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBody( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBody as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBody with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBody = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBody(request), expectedError); + assert((client.innerApiCalls.repeatDataBody as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBody with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBody(request), expectedError); + }); + }); + + describe('repeatDataBodyInfo', () => { + it('invokes repeatDataBodyInfo without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBodyInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyInfo without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyInfo = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBodyInfo( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBodyInfo with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBodyInfo(request), expectedError); + assert((client.innerApiCalls.repeatDataBodyInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyInfo with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBodyInfo(request), expectedError); + }); + }); + + describe('repeatDataQuery', () => { + it('invokes repeatDataQuery without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataQuery = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataQuery without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataQuery( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataQuery with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataQuery(request), expectedError); + assert((client.innerApiCalls.repeatDataQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataQuery with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataQuery(request), expectedError); + }); + }); + + describe('repeatDataSimplePath', () => { + it('invokes repeatDataSimplePath without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_int32=&info.f_double=&info.f_bool=&info.f_kingdom="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataSimplePath(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataSimplePath as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataSimplePath without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_int32=&info.f_double=&info.f_bool=&info.f_kingdom="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataSimplePath = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataSimplePath( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataSimplePath as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataSimplePath with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_int32=&info.f_double=&info.f_bool=&info.f_kingdom="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataSimplePath(request), expectedError); + assert((client.innerApiCalls.repeatDataSimplePath as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataSimplePath with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataSimplePath(request), expectedError); + }); + }); + + describe('repeatDataPathResource', () => { + it('invokes repeatDataPathResource without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string=&info.f_bool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathResource = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataPathResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathResource without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string=&info.f_bool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataPathResource( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataPathResource with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string=&info.f_bool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataPathResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataPathResource(request), expectedError); + assert((client.innerApiCalls.repeatDataPathResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathResource with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataPathResource(request), expectedError); + }); + }); + + describe('repeatDataPathTrailingResource', () => { + it('invokes repeatDataPathTrailingResource without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataPathTrailingResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathTrailingResource without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataPathTrailingResource( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataPathTrailingResource with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); + assert((client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathTrailingResource with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); + }); + }); + + describe('repeatDataBodyPut', () => { + it('invokes repeatDataBodyPut without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBodyPut(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPut as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPut without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPut = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBodyPut( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPut as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBodyPut with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBodyPut(request), expectedError); + assert((client.innerApiCalls.repeatDataBodyPut as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPut with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBodyPut(request), expectedError); + }); + }); + + describe('repeatDataBodyPatch', () => { + it('invokes repeatDataBodyPatch without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBodyPatch(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPatch as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPatch without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPatch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBodyPatch( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPatch as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBodyPatch with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBodyPatch(request), expectedError); + assert((client.innerApiCalls.repeatDataBodyPatch as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPatch with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBodyPatch(request), expectedError); + }); + }); + + describe('getEnum', () => { + it('invokes getEnum without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.getEnum = stubSimpleCall(expectedResponse); + const [response] = await client.getEnum(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnum without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.getEnum = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnum( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnum with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnum = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnum(request), expectedError); + assert((client.innerApiCalls.getEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnum with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEnum(request), expectedError); + }); + }); + + describe('verifyEnum', () => { + it('invokes verifyEnum without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.verifyEnum = stubSimpleCall(expectedResponse); + const [response] = await client.verifyEnum(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.verifyEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes verifyEnum without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.verifyEnum = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyEnum( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.verifyEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes verifyEnum with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyEnum = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.verifyEnum(request), expectedError); + assert((client.innerApiCalls.verifyEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes verifyEnum with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.verifyEnum(request), expectedError); + }); + }); + + describe('Path templates', () => { + + describe('blueprint', () => { + const fakePath = "/rendered/path/blueprint"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + blueprint: "blueprintValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.blueprintPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.blueprintPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('blueprintPath', () => { + const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromBlueprintName', () => { + const result = client.matchSessionFromBlueprintName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromBlueprintName', () => { + const result = client.matchTestFromBlueprintName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlueprintFromBlueprintName', () => { + const result = client.matchBlueprintFromBlueprintName(fakePath); + assert.strictEqual(result, "blueprintValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('room', () => { + const fakePath = "/rendered/path/room"; + const expectedParameters = { + room: "roomValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomPath', () => { + const result = client.roomPath("roomValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; + const expectedParameters = { + room: "roomValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; + const expectedParameters = { + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('session', () => { + const fakePath = "/rendered/path/session"; + const expectedParameters = { + session: "sessionValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sessionPath', () => { + const result = client.sessionPath("sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromSessionName', () => { + const result = client.matchSessionFromSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('test', () => { + const fakePath = "/rendered/path/test"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.testPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.testPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('testPath', () => { + const result = client.testPath("sessionValue", "testValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.testPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromTestName', () => { + const result = client.matchSessionFromTestName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromTestName', () => { + const result = client.matchTestFromTestName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('user', () => { + const fakePath = "/rendered/path/user"; + const expectedParameters = { + user: "userValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userPath', () => { + const result = client.userPath("userValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; + const expectedParameters = { + user: "userValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; + const expectedParameters = { + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline b/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline index dc06f8e91..4afccac2c 100644 --- a/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline +++ b/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline @@ -239,7 +239,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()); client.innerApiCalls.echo = stubSimpleCall(expectedResponse); const [response] = await client.echo(request); @@ -255,7 +287,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()); client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { @@ -282,7 +346,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); await assert.rejects(client.echo(request), expectedError); @@ -297,12 +393,100 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); + // path template is empty + request.header = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + // path template: {baz=**} + request.otherHeader = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.echo(request), expectedError); }); }); + describe('pagedExpandLegacy', () => { + it('invokes pagedExpandLegacy without error', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandResponse()); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); + const [response] = await client.pagedExpandLegacy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pagedExpandLegacy without error using callback', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandResponse()); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pagedExpandLegacy( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pagedExpandLegacy with error', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pagedExpandLegacy(request), expectedError); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pagedExpandLegacy with closed client', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pagedExpandLegacy(request), expectedError); + }); + }); + describe('block', () => { it('invokes block without error', async () => { const client = new echoModule.v1beta1.EchoClient({ @@ -845,6 +1029,7 @@ describe('v1beta1.EchoClient', () => { }); }); + describe('Path templates', () => { describe('blueprint', () => { @@ -896,7 +1081,7 @@ describe('v1beta1.EchoClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -909,100 +1094,160 @@ describe('v1beta1.EchoClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -1078,7 +1323,7 @@ describe('v1beta1.EchoClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1091,100 +1336,100 @@ describe('v1beta1.EchoClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline b/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline index e2ae464e2..0735959a6 100644 --- a/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline +++ b/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline @@ -771,7 +771,7 @@ describe('v1beta1.IdentityClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -784,100 +784,160 @@ describe('v1beta1.IdentityClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new identityModule.v1beta1.IdentityClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new identityModule.v1beta1.IdentityClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -953,7 +1013,7 @@ describe('v1beta1.IdentityClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -966,100 +1026,100 @@ describe('v1beta1.IdentityClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline b/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline index 0d80fd43b..75cf34dd6 100644 --- a/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline +++ b/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline @@ -1783,7 +1783,7 @@ describe('v1beta1.MessagingClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1796,100 +1796,160 @@ describe('v1beta1.MessagingClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new messagingModule.v1beta1.MessagingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new messagingModule.v1beta1.MessagingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -1965,7 +2025,7 @@ describe('v1beta1.MessagingClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1978,100 +2038,100 @@ describe('v1beta1.MessagingClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/disable-packing-test/test/gapic_sequence_service_v1beta1.ts.baseline b/baselines/disable-packing-test/test/gapic_sequence_service_v1beta1.ts.baseline new file mode 100644 index 000000000..e9e981bfc --- /dev/null +++ b/baselines/disable-packing-test/test/gapic_sequence_service_v1beta1.ts.baseline @@ -0,0 +1,808 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as sequenceserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1beta1.SequenceServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = sequenceserviceModule.v1beta1.SequenceServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sequenceserviceModule.v1beta1.SequenceServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sequenceserviceModule.v1beta1.SequenceServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sequenceServiceStub, undefined); + await client.initialize(); + assert(client.sequenceServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sequenceServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sequenceServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSequence', () => { + it('invokes createSequence without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.Sequence()); + client.innerApiCalls.createSequence = stubSimpleCall(expectedResponse); + const [response] = await client.createSequence(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSequence without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.Sequence()); + client.innerApiCalls.createSequence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSequence( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSequence with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.createSequence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSequence(request), expectedError); + assert((client.innerApiCalls.createSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSequence with closed client', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSequence(request), expectedError); + }); + }); + + describe('getSequenceReport', () => { + it('invokes getSequenceReport without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.SequenceReport()); + client.innerApiCalls.getSequenceReport = stubSimpleCall(expectedResponse); + const [response] = await client.getSequenceReport(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSequenceReport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSequenceReport without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.SequenceReport()); + client.innerApiCalls.getSequenceReport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSequenceReport( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequenceReport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSequenceReport as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSequenceReport with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSequenceReport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSequenceReport(request), expectedError); + assert((client.innerApiCalls.getSequenceReport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSequenceReport with closed client', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSequenceReport(request), expectedError); + }); + }); + + describe('attemptSequence', () => { + it('invokes attemptSequence without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.attemptSequence = stubSimpleCall(expectedResponse); + const [response] = await client.attemptSequence(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attemptSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attemptSequence without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.attemptSequence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.attemptSequence( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attemptSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes attemptSequence with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.attemptSequence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.attemptSequence(request), expectedError); + assert((client.innerApiCalls.attemptSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attemptSequence with closed client', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.attemptSequence(request), expectedError); + }); + }); + + describe('Path templates', () => { + + describe('blueprint', () => { + const fakePath = "/rendered/path/blueprint"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + blueprint: "blueprintValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.blueprintPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.blueprintPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('blueprintPath', () => { + const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromBlueprintName', () => { + const result = client.matchSessionFromBlueprintName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromBlueprintName', () => { + const result = client.matchTestFromBlueprintName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlueprintFromBlueprintName', () => { + const result = client.matchBlueprintFromBlueprintName(fakePath); + assert.strictEqual(result, "blueprintValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('room', () => { + const fakePath = "/rendered/path/room"; + const expectedParameters = { + room: "roomValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomPath', () => { + const result = client.roomPath("roomValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; + const expectedParameters = { + room: "roomValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; + const expectedParameters = { + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('session', () => { + const fakePath = "/rendered/path/session"; + const expectedParameters = { + session: "sessionValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sessionPath', () => { + const result = client.sessionPath("sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromSessionName', () => { + const result = client.matchSessionFromSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('test', () => { + const fakePath = "/rendered/path/test"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.testPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.testPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('testPath', () => { + const result = client.testPath("sessionValue", "testValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.testPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromTestName', () => { + const result = client.matchSessionFromTestName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromTestName', () => { + const result = client.matchTestFromTestName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('user', () => { + const fakePath = "/rendered/path/user"; + const expectedParameters = { + user: "userValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userPath', () => { + const result = client.userPath("userValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; + const expectedParameters = { + user: "userValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; + const expectedParameters = { + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline b/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline index b0e78ca48..0fed35bc8 100644 --- a/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline +++ b/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline @@ -1184,7 +1184,7 @@ describe('v1beta1.TestingClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1197,100 +1197,160 @@ describe('v1beta1.TestingClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new testingModule.v1beta1.TestingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new testingModule.v1beta1.TestingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -1366,7 +1426,7 @@ describe('v1beta1.TestingClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1379,100 +1439,100 @@ describe('v1beta1.TestingClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline b/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline index 6e9d78a37..1b1b160f0 100644 --- a/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline +++ b/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline @@ -17,6 +17,7 @@ syntax = "proto3"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/routing.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -27,27 +28,63 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // 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. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. +// to have the values echoed in the response trailers. Set the +// 'x-goog-request-params' metadata key on any method to have the values +// echoed in the response headers. 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. + // This method simply echoes the request. This method showcases unary RPCs. rpc Echo(EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:echo" body: "*" }; + option (google.api.routing) = { + routing_parameters{ + field: "header" + } + routing_parameters{ + field: "header" + path_template: "{routing_id=**}" + } + routing_parameters{ + field: "header" + path_template: "{table_name=regions/*/zones/*/**}" + } + routing_parameters{ + field: "header" + path_template: "{super_id=projects/*}/**" + } + routing_parameters{ + field: "header" + path_template: "{table_name=projects/*/instances/*/**}" + } + routing_parameters{ + field: "header" + path_template: "projects/*/{instance_id=instances/*}/**" + } + routing_parameters{ + field: "other_header" + path_template: "{baz=**}" + } + routing_parameters{ + field: "other_header" + path_template: "{qux=projects/*}/**" + } + }; } - // This method split the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming rpcs. + // This method splits 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" @@ -60,7 +97,7 @@ service Echo { // 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. + // passed to it. This method showcases client-side streaming RPCs. rpc Collect(stream EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:collect" @@ -68,9 +105,9 @@ service Echo { }; } - // 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. + // This method, upon receiving a request on the stream, will pass the same + // content 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 @@ -82,8 +119,30 @@ service Echo { }; } - // This method will wait the requested amount of and then return. - // This method showcases how a client handles a request timing out. + // This is similar to the PagedExpand except that it uses + // max_results instead of page_size, as some legacy APIs still + // do. New APIs should NOT use this pattern. + rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacy" + body: "*" + }; + } + + // This method returns a map containing lists of words that appear in the input, keyed by their + // initial character. The only words returned are the ones included in the current page, + // as determined by page_token and page_size, which both refer to the word indices in the + // input. This paging result consisting of a map of lists is a pattern used by some legacy + // APIs. New APIs should NOT use this pattern. + rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacyMapped" + body: "*" + }; + } + + // This method will wait for the requested amount of time and then return. + // This method showcases how a client handles a request timeout. rpc Wait(WaitRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1beta1/echo:wait" @@ -95,7 +154,7 @@ service Echo { }; } - // This method will block (wait) for the requested amount of time + // This method will block (wait) for the requested amount of time // and then return the response or error. // This method showcases how a client handles delays or retries. rpc Block(BlockRequest) returns (BlockResponse) { @@ -106,9 +165,19 @@ service Echo { }; } -// 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. +// A severity enum used to test enum capabilities in GAPIC surfaces. +enum Severity { + UNNECESSARY = 0; + NECESSARY = 1; + URGENT = 2; + CRITICAL = 3; +} + + +// The request message used for the Echo, Collect and Chat methods. +// If content or opt are 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. @@ -117,12 +186,24 @@ message EchoRequest { // The error to be thrown by the server. google.rpc.Status error = 2; } + + // The severity to be echoed by the server. + Severity severity = 3; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string header = 4; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string other_header = 5; } // The response message for the Echo methods. message EchoResponse { // The content specified in the request. string content = 1; + + // The severity specified in the request. + Severity severity = 2; } // The request message for the Expand method. @@ -139,13 +220,29 @@ message PagedExpandRequest { // The string to expand. string content = 1 [(google.api.field_behavior) = REQUIRED]; - // The amount of words to returned in each page. + // The number of words to returned in each page. int32 page_size = 2; // The position of the page to be returned. string page_token = 3; } +// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New +// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to +// aip.dev/158. +message PagedExpandLegacyRequest { + // The string to expand. + string content = 1 [(google.api.field_behavior) = REQUIRED]; + + // The number of words to returned in each page. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + // violates aip.dev/158. Ordinarily, this should be page_size. --) + int32 max_results = 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. @@ -155,6 +252,21 @@ message PagedExpandResponse { string next_page_token = 2; } +// A list of words. +message PagedExpandResponseList { + repeated string words = 1; +} + +message PagedExpandLegacyMappedResponse { + // The words that were expanded, indexed by their initial character. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates + // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) + map alphabetized = 1; + + // The next page token. + string next_page_token = 2; +} + // The request for Wait method. message WaitRequest { oneof end { diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline index 13ac958ac..cfea8697e 100644 --- a/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline +++ b/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline @@ -36,6 +36,18 @@ function main() { * The error to be thrown by the server. */ // const error = {} + /** + * The severity to be echoed by the server. + */ + // const severity = {} + /** + * Optional. This field can be set to test the routing annotation on the Echo method. + */ + // const header = 'abc123' + /** + * Optional. This field can be set to test the routing annotation on the Echo method. + */ + // const otherHeader = 'abc123' // Imports the Showcase library const {EchoClient} = require('showcase').v1beta1; diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline index 21c54f5c4..17427bc88 100644 --- a/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline +++ b/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline @@ -36,6 +36,18 @@ function main() { * The error to be thrown by the server. */ // const error = {} + /** + * The severity to be echoed by the server. + */ + // const severity = {} + /** + * Optional. This field can be set to test the routing annotation on the Echo method. + */ + // const header = 'abc123' + /** + * Optional. This field can be set to test the routing annotation on the Echo method. + */ + // const otherHeader = 'abc123' // Imports the Showcase library const {EchoClient} = require('showcase').v1beta1; diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline index 0eae153b5..0d85a5373 100644 --- a/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline +++ b/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline @@ -36,6 +36,18 @@ function main() { * The error to be thrown by the server. */ // const error = {} + /** + * The severity to be echoed by the server. + */ + // const severity = {} + /** + * Optional. This field can be set to test the routing annotation on the Echo method. + */ + // const header = 'abc123' + /** + * Optional. This field can be set to test the routing annotation on the Echo method. + */ + // const otherHeader = 'abc123' // Imports the Showcase library const {EchoClient} = require('showcase').v1beta1; diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline index 21d6140d7..9d38f3004 100644 --- a/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline +++ b/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline @@ -33,7 +33,7 @@ function main(content) { */ // const content = 'abc123' /** - * The amount of words to returned in each page. + * The number of words to returned in each page. */ // const pageSize = 1234 /** diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline new file mode 100644 index 000000000..336011979 --- /dev/null +++ b/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline @@ -0,0 +1,71 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(content) { + // [START localhost_v1beta1_generated_Echo_PagedExpandLegacy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The string to expand. + */ + // const content = 'abc123' + /** + * The number of words to returned in each page. + * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + * violates aip.dev/158. Ordinarily, this should be page_size. --) + */ + // const maxResults = 1234 + /** + * The position of the page to be returned. + */ + // const pageToken = 'abc123' + + // Imports the Showcase library + const {EchoClient} = require('showcase').v1beta1; + + // Instantiates a client + const showcaseClient = new EchoClient(); + + async function callPagedExpandLegacy() { + // Construct request + const request = { + content, + }; + + // Run request + const response = await showcaseClient.pagedExpandLegacy(request); + console.log(response); + } + + callPagedExpandLegacy(); + // [END localhost_v1beta1_generated_Echo_PagedExpandLegacy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline new file mode 100644 index 000000000..84aaf832a --- /dev/null +++ b/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline @@ -0,0 +1,71 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(content) { + // [START localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The string to expand. + */ + // const content = 'abc123' + /** + * The number of words to returned in each page. + */ + // const pageSize = 1234 + /** + * The position of the page to be returned. + */ + // const pageToken = 'abc123' + + // Imports the Showcase library + const {EchoClient} = require('showcase').v1beta1; + + // Instantiates a client + const showcaseClient = new EchoClient(); + + async function callPagedExpandLegacyMapped() { + // Construct request + const request = { + content, + }; + + // Run request + const iterable = await showcaseClient.pagedExpandLegacyMappedAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callPagedExpandLegacyMapped(); + // [END localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata.google.showcase.v1beta1.json.baseline b/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata.google.showcase.v1beta1.json.baseline index ca9e5f794..b632872dd 100644 --- a/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata.google.showcase.v1beta1.json.baseline +++ b/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata.google.showcase.v1beta1.json.baseline @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 68, "type": "FULL" } ], @@ -38,6 +38,18 @@ { "name": "error", "type": ".google.rpc.Status" + }, + { + "name": "severity", + "type": ".google.showcase.v1beta1.Severity" + }, + { + "name": "header", + "type": "TYPE_STRING" + }, + { + "name": "other_header", + "type": "TYPE_STRING" } ], "resultType": ".google.showcase.v1beta1.EchoResponse", @@ -59,7 +71,7 @@ "regionTag": "localhost_v1beta1_generated_Echo_Expand_async", "title": "ShowcaseService expand Sample", "origin": "API_DEFINITION", - "description": " This method split the given content into words and will pass each word back through the stream. This method showcases server-side streaming rpcs.", + "description": " This method splits the given content into words and will pass each word back through the stream. This method showcases server-side streaming RPCs.", "canonical": true, "file": "echo.expand.js", "language": "JAVASCRIPT", @@ -103,14 +115,14 @@ "regionTag": "localhost_v1beta1_generated_Echo_Collect_async", "title": "ShowcaseService collect Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " 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.", "canonical": true, "file": "echo.collect.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 57, + "end": 69, "type": "FULL" } ], @@ -126,6 +138,18 @@ { "name": "error", "type": ".google.rpc.Status" + }, + { + "name": "severity", + "type": ".google.showcase.v1beta1.Severity" + }, + { + "name": "header", + "type": "TYPE_STRING" + }, + { + "name": "other_header", + "type": "TYPE_STRING" } ], "resultType": ".google.showcase.v1beta1.EchoResponse", @@ -147,14 +171,14 @@ "regionTag": "localhost_v1beta1_generated_Echo_Chat_async", "title": "ShowcaseService chat Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " This method, upon receiving a request on the stream, will pass the same content back on the stream. This method showcases bidirectional streaming RPCs.", "canonical": true, "file": "echo.chat.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 60, + "end": 72, "type": "FULL" } ], @@ -170,6 +194,18 @@ { "name": "error", "type": ".google.rpc.Status" + }, + { + "name": "severity", + "type": ".google.showcase.v1beta1.Severity" + }, + { + "name": "header", + "type": "TYPE_STRING" + }, + { + "name": "other_header", + "type": "TYPE_STRING" } ], "resultType": ".google.showcase.v1beta1.EchoResponse", @@ -235,11 +271,107 @@ } } }, + { + "regionTag": "localhost_v1beta1_generated_Echo_PagedExpandLegacy_async", + "title": "ShowcaseService pagedExpandLegacy Sample", + "origin": "API_DEFINITION", + "description": " This is similar to the PagedExpand except that it uses max_results instead of page_size, as some legacy APIs still do. New APIs should NOT use this pattern.", + "canonical": true, + "file": "echo.paged_expand_legacy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PagedExpandLegacy", + "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacy", + "async": true, + "parameters": [ + { + "name": "content", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.showcase.v1beta1.PagedExpandResponse", + "client": { + "shortName": "EchoClient", + "fullName": "google.showcase.v1beta1.EchoClient" + }, + "method": { + "shortName": "PagedExpandLegacy", + "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacy", + "service": { + "shortName": "Echo", + "fullName": "google.showcase.v1beta1.Echo" + } + } + } + }, + { + "regionTag": "localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async", + "title": "ShowcaseService pagedExpandLegacyMapped Sample", + "origin": "API_DEFINITION", + "description": " This method returns a map containing lists of words that appear in the input, keyed by their initial character. The only words returned are the ones included in the current page, as determined by page_token and page_size, which both refer to the word indices in the input. This paging result consisting of a map of lists is a pattern used by some legacy APIs. New APIs should NOT use this pattern.", + "canonical": true, + "file": "echo.paged_expand_legacy_mapped.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PagedExpandLegacyMapped", + "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacyMapped", + "async": true, + "parameters": [ + { + "name": "content", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.showcase.v1beta1.PagedExpandLegacyMappedResponse", + "client": { + "shortName": "EchoClient", + "fullName": "google.showcase.v1beta1.EchoClient" + }, + "method": { + "shortName": "PagedExpandLegacyMapped", + "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacyMapped", + "service": { + "shortName": "Echo", + "fullName": "google.showcase.v1beta1.Echo" + } + } + } + }, { "regionTag": "localhost_v1beta1_generated_Echo_Wait_async", "title": "ShowcaseService wait Sample", "origin": "API_DEFINITION", - "description": " This method will wait the requested amount of and then return. This method showcases how a client handles a request timing out.", + "description": " This method will wait for the requested amount of time and then return. This method showcases how a client handles a request timeout.", "canonical": true, "file": "echo.wait.js", "language": "JAVASCRIPT", @@ -291,7 +423,7 @@ "regionTag": "localhost_v1beta1_generated_Echo_Block_async", "title": "ShowcaseService block Sample", "origin": "API_DEFINITION", - "description": " This method will block (wait) for the requested amount of time and then return the response or error. This method showcases how a client handles delays or retries.", + "description": " This method will block (wait) for the requested amount of time and then return the response or error. This method showcases how a client handles delays or retries.", "canonical": true, "file": "echo.block.js", "language": "JAVASCRIPT", diff --git a/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline b/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline index 27dbf37c8..d6cd17eab 100644 --- a/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline +++ b/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline @@ -34,7 +34,9 @@ const version = require('../../../package.json').version; * side streaming, client side streaming, and bidirectional streaming. This * service also exposes methods that explicitly implement server delay, and * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. + * to have the values echoed in the response trailers. Set the + * 'x-goog-request-params' metadata key on any method to have the values + * echoed in the response headers. * @class * @memberof v1beta1 */ @@ -225,7 +227,7 @@ export class EchoClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const echoStubMethods = - ['echo', 'expand', 'collect', 'chat', 'pagedExpand', 'wait', 'block']; + ['echo', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; for (const methodName of echoStubMethods) { const callPromise = this.echoStub.then( stub => (...args: Array<{}>) => { @@ -323,6 +325,12 @@ export class EchoClient { * The content to be echoed by the server. * @param {google.rpc.Status} request.error * The error to be thrown by the server. + * @param {google.showcase.v1beta1.Severity} request.severity + * The severity to be echoed by the server. + * @param {string} request.header + * Optional. This field can be set to test the routing annotation on the Echo method. + * @param {string} request.otherHeader + * Optional. This field can be set to test the routing annotation on the Echo method. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -379,9 +387,169 @@ export class EchoClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?
.*)')); + if (match) { + const parameterValue = match.groups?.['header'] ?? fieldValue; + Object.assign(routingParameter, { header: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); + if (match) { + const parameterValue = match.groups?.['routing_id'] ?? fieldValue; + Object.assign(routingParameter, { routing_id: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); + if (match) { + const parameterValue = match.groups?.['table_name'] ?? fieldValue; + Object.assign(routingParameter, { table_name: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['super_id'] ?? fieldValue; + Object.assign(routingParameter, { super_id: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); + if (match) { + const parameterValue = match.groups?.['table_name'] ?? fieldValue; + Object.assign(routingParameter, { table_name: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['instance_id'] ?? fieldValue; + Object.assign(routingParameter, { instance_id: parameterValue }); + } + } + } + { + const fieldValue = request.otherHeader; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); + if (match) { + const parameterValue = match.groups?.['baz'] ?? fieldValue; + Object.assign(routingParameter, { baz: parameterValue }); + } + } + } + { + const fieldValue = request.otherHeader; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['qux'] ?? fieldValue; + Object.assign(routingParameter, { qux: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); this.initialize(); return this.innerApiCalls.echo(request, options, callback); } +/** + * This is similar to the PagedExpand except that it uses + * max_results instead of page_size, as some legacy APIs still + * do. New APIs should NOT use this pattern. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.content + * The string to expand. + * @param {number} request.maxResults + * The number of words to returned in each page. + * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + * violates aip.dev/158. Ordinarily, this should be page_size. --) + * @param {string} request.pageToken + * The position of the page to be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PagedExpandResponse]{@link google.showcase.v1beta1.PagedExpandResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js + * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async + */ + pagedExpandLegacy( + request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined + ]>; + pagedExpandLegacy( + request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): void; + pagedExpandLegacy( + request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + callback: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): void; + pagedExpandLegacy( + request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.pagedExpandLegacy(request, options, callback); + } /** * This method will block (wait) for the requested amount of time * and then return the response or error. @@ -457,8 +625,8 @@ export class EchoClient { } /** - * This method split the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming rpcs. + * This method splits the given content into words and will pass each word back + * through the stream. This method showcases server-side streaming RPCs. * * @param {Object} request * The request object that will be sent. @@ -491,7 +659,7 @@ export class EchoClient { /** * 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. + * passed to it. This method showcases client-side streaming RPCs. * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -536,9 +704,9 @@ export class EchoClient { } /** - * 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. + * This method, upon receiving a request on the stream, will pass the same + * content back on the stream. This method showcases bidirectional + * streaming RPCs. * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -560,8 +728,8 @@ export class EchoClient { } /** - * This method will wait the requested amount of and then return. - * This method showcases how a client handles a request timing out. + * This method will wait for the requested amount of time and then return. + * This method showcases how a client handles a request timeout. * * @param {Object} request * The request object that will be sent. @@ -662,7 +830,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -737,7 +905,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -779,7 +947,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] diff --git a/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline b/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline index c30d10733..57bd509e9 100644 --- a/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline +++ b/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline @@ -40,6 +40,14 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "PagedExpandLegacy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PagedExpandLegacyMapped": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "Wait": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline b/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline index be9e3211e..16db33dad 100644 --- a/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline +++ b/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline @@ -232,7 +232,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()); client.innerApiCalls.echo = stubSimpleCall(expectedResponse); const [response] = await client.echo(request); @@ -248,7 +280,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()); client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { @@ -275,7 +339,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); await assert.rejects(client.echo(request), expectedError); @@ -290,12 +386,100 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); + // path template is empty + request.header = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + // path template: {baz=**} + request.otherHeader = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.echo(request), expectedError); }); }); + describe('pagedExpandLegacy', () => { + it('invokes pagedExpandLegacy without error', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandResponse()); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); + const [response] = await client.pagedExpandLegacy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pagedExpandLegacy without error using callback', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandResponse()); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pagedExpandLegacy( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pagedExpandLegacy with error', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pagedExpandLegacy(request), expectedError); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pagedExpandLegacy with closed client', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pagedExpandLegacy(request), expectedError); + }); + }); + describe('block', () => { it('invokes block without error', async () => { const client = new echoModule.v1beta1.EchoClient({ @@ -837,4 +1021,5 @@ describe('v1beta1.EchoClient', () => { .getCall(0).args[1], request); }); }); + }); diff --git a/baselines/showcase/package.json b/baselines/showcase/package.json index baa79ac72..972a9e397 100644 --- a/baselines/showcase/package.json +++ b/baselines/showcase/package.json @@ -21,9 +21,11 @@ "cloud", "google showcase", "showcase", + "compliance", "echo", "identity", "messaging", + "sequence service", "testing" ], "scripts": { diff --git a/baselines/showcase/protos/google/showcase/v1beta1/compliance.proto.baseline b/baselines/showcase/protos/google/showcase/v1beta1/compliance.proto.baseline new file mode 100644 index 000000000..9b6c0b7d7 --- /dev/null +++ b/baselines/showcase/protos/google/showcase/v1beta1/compliance.proto.baseline @@ -0,0 +1,269 @@ +// 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 +// +// 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"; + +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; +option ruby_package = "Google::Showcase::V1beta1"; + +// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format +// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped +// correctly. +service Compliance { + // 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 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: "/v1beta1/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: "/v1beta1/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: "/v1beta1/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: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" + }; + } + + // Same as RepeatDataSimplePath, but with a path resource. + rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" + additional_bindings { + get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" + } + }; + } + + // Same as RepeatDataSimplePath, but with a trailing resource. + rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" + }; + } + + // This method echoes the ComplianceData request, using the HTTP PUT method. + rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + put: "/v1beta1/repeat:bodyput" + body: "*" + }; + } + + // This method echoes the ComplianceData request, using the HTTP PATCH method. + rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + patch: "/v1beta1/repeat:bodypatch" + body: "*" + }; + } + + // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the + // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the + // response from this RPC as the request to VerifyEnum() + // + // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for + // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. + rpc GetEnum(EnumRequest) returns (EnumResponse) { + option (google.api.http) = { + get: "/v1beta1/compliance/enum" + }; + } + + // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() + // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds + // with the same EnumResponse; otherwise, the RPC errors. + // + // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, + // although they are not guaranteed to be the same across separate Showcase server runs. + rpc VerifyEnum(EnumResponse) returns (EnumResponse) { + option (google.api.http) = { + post: "/v1beta1/compliance/enum" + }; + } + +} + +message RepeatRequest { + string name = 1; + ComplianceData info = 2; + + // If true, the server will verify that the received request matches + // the request with the same name in the compliance test suite. + bool server_verify = 3; + + // The URI template this request is expected to be bound to server-side. + optional string intended_binding_uri = 10; + + // Some top level fields, to test that these are encoded correctly + // in query params. + int32 f_int32 = 4; + int64 f_int64 = 5; + double f_double = 6; + + optional int32 p_int32 = 7; + optional int64 p_int64 = 8; + optional double p_double = 9; +} + +message RepeatResponse { + RepeatRequest request = 1; + + // The URI template the request was bound to server-side. + string binding_uri = 2; +} + +// ComplianceSuite contains a set of requests that microgenerators should issue +// over REST to the Compliance service to test their gRPC-to-REST transcoding +// implementation. +message ComplianceSuite { + repeated ComplianceGroup group = 1; +} + +// ComplianceGroups encapsulates a group of RPC requests to the Compliance +// server: one request for each combination of elements of `rpcs` and of +// `requests`. +message ComplianceGroup { + string name = 1; + repeated string rpcs = 2; + repeated RepeatRequest requests = 3; +} + +// ComplianceData is a message used for testing REST transcoding of +// different data types. +message ComplianceData { + enum LifeKingdom { + LIFE_KINGDOM_UNSPECIFIED = 0; + ARCHAEBACTERIA = 1; + EUBACTERIA = 2; + PROTISTA = 3; + FUNGI = 4; + PLANTAE = 5; + ANIMALIA = 6; +} + // scalar types + + 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; + + LifeKingdom f_kingdom = 22; + + ComplianceDataChild f_child = 16; + + // optional fields + + optional string p_string = 17; + optional int32 p_int32 = 18; + optional double p_double = 19; + optional bool p_bool = 20; + optional LifeKingdom p_kingdom = 23; + optional ComplianceDataChild p_child = 21; +} + +message ComplianceDataChild { + string f_string = 1; + float f_float = 2; + double f_double = 3; + bool f_bool = 4; + Continent f_continent = 11; + ComplianceDataGrandchild f_child = 5; + + optional string p_string = 6; + optional float p_float = 7; + optional double p_double = 8; + optional bool p_bool = 9; + Continent p_continent = 12; + optional ComplianceDataGrandchild p_child = 10; +} + +message ComplianceDataGrandchild { + string f_string = 1; + double f_double = 2; + bool f_bool = 3; +} + +enum Continent { + CONTINENT_UNSPECIFIED = 0; + AFRICA = 1; + AMERICA = 2; + ANTARTICA = 3; + AUSTRALIA = 4; + EUROPE = 5; +} + + +message EnumRequest { + // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. + bool unknown_enum = 1; +} + +message EnumResponse { + // The original request for a known or unknown enum from the server. + EnumRequest request = 1; + + // The actual enum the server provided. + Continent continent = 2; +} diff --git a/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline b/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline index 6e9d78a37..1b1b160f0 100644 --- a/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline +++ b/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline @@ -17,6 +17,7 @@ syntax = "proto3"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/routing.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -27,27 +28,63 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // 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. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. +// to have the values echoed in the response trailers. Set the +// 'x-goog-request-params' metadata key on any method to have the values +// echoed in the response headers. 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. + // This method simply echoes the request. This method showcases unary RPCs. rpc Echo(EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:echo" body: "*" }; + option (google.api.routing) = { + routing_parameters{ + field: "header" + } + routing_parameters{ + field: "header" + path_template: "{routing_id=**}" + } + routing_parameters{ + field: "header" + path_template: "{table_name=regions/*/zones/*/**}" + } + routing_parameters{ + field: "header" + path_template: "{super_id=projects/*}/**" + } + routing_parameters{ + field: "header" + path_template: "{table_name=projects/*/instances/*/**}" + } + routing_parameters{ + field: "header" + path_template: "projects/*/{instance_id=instances/*}/**" + } + routing_parameters{ + field: "other_header" + path_template: "{baz=**}" + } + routing_parameters{ + field: "other_header" + path_template: "{qux=projects/*}/**" + } + }; } - // This method split the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming rpcs. + // This method splits 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" @@ -60,7 +97,7 @@ service Echo { // 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. + // passed to it. This method showcases client-side streaming RPCs. rpc Collect(stream EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:collect" @@ -68,9 +105,9 @@ service Echo { }; } - // 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. + // This method, upon receiving a request on the stream, will pass the same + // content 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 @@ -82,8 +119,30 @@ service Echo { }; } - // This method will wait the requested amount of and then return. - // This method showcases how a client handles a request timing out. + // This is similar to the PagedExpand except that it uses + // max_results instead of page_size, as some legacy APIs still + // do. New APIs should NOT use this pattern. + rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacy" + body: "*" + }; + } + + // This method returns a map containing lists of words that appear in the input, keyed by their + // initial character. The only words returned are the ones included in the current page, + // as determined by page_token and page_size, which both refer to the word indices in the + // input. This paging result consisting of a map of lists is a pattern used by some legacy + // APIs. New APIs should NOT use this pattern. + rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacyMapped" + body: "*" + }; + } + + // This method will wait for the requested amount of time and then return. + // This method showcases how a client handles a request timeout. rpc Wait(WaitRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1beta1/echo:wait" @@ -95,7 +154,7 @@ service Echo { }; } - // This method will block (wait) for the requested amount of time + // This method will block (wait) for the requested amount of time // and then return the response or error. // This method showcases how a client handles delays or retries. rpc Block(BlockRequest) returns (BlockResponse) { @@ -106,9 +165,19 @@ service Echo { }; } -// 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. +// A severity enum used to test enum capabilities in GAPIC surfaces. +enum Severity { + UNNECESSARY = 0; + NECESSARY = 1; + URGENT = 2; + CRITICAL = 3; +} + + +// The request message used for the Echo, Collect and Chat methods. +// If content or opt are 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. @@ -117,12 +186,24 @@ message EchoRequest { // The error to be thrown by the server. google.rpc.Status error = 2; } + + // The severity to be echoed by the server. + Severity severity = 3; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string header = 4; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string other_header = 5; } // The response message for the Echo methods. message EchoResponse { // The content specified in the request. string content = 1; + + // The severity specified in the request. + Severity severity = 2; } // The request message for the Expand method. @@ -139,13 +220,29 @@ message PagedExpandRequest { // The string to expand. string content = 1 [(google.api.field_behavior) = REQUIRED]; - // The amount of words to returned in each page. + // The number of words to returned in each page. int32 page_size = 2; // The position of the page to be returned. string page_token = 3; } +// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New +// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to +// aip.dev/158. +message PagedExpandLegacyRequest { + // The string to expand. + string content = 1 [(google.api.field_behavior) = REQUIRED]; + + // The number of words to returned in each page. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + // violates aip.dev/158. Ordinarily, this should be page_size. --) + int32 max_results = 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. @@ -155,6 +252,21 @@ message PagedExpandResponse { string next_page_token = 2; } +// A list of words. +message PagedExpandResponseList { + repeated string words = 1; +} + +message PagedExpandLegacyMappedResponse { + // The words that were expanded, indexed by their initial character. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates + // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) + map alphabetized = 1; + + // The next page token. + string next_page_token = 2; +} + // The request for Wait method. message WaitRequest { oneof end { diff --git a/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline b/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline index 7558c1d4c..569c604d7 100644 --- a/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline +++ b/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline @@ -27,6 +27,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A simple identity service. service Identity { @@ -41,7 +42,8 @@ service Identity { body: "*" }; option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; + option (google.api.method_signature) = + "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; } // Retrieves the User with the given uri. @@ -56,7 +58,7 @@ service Identity { rpc UpdateUser(UpdateUserRequest) returns (User) { option (google.api.http) = { patch: "/v1beta1/{user.name=users/*}" - body: "*" + body: "user" }; } @@ -80,7 +82,7 @@ service Identity { message User { option (google.api.resource) = { type: "showcase.googleapis.com/User" - pattern: "users/{user_id}" + pattern: "users/{user}" }; // The resource name of the user. @@ -93,16 +95,14 @@ message User { string email = 3 [(google.api.field_behavior) = REQUIRED]; // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // The age of the use in years. + // The age of the user in years. optional int32 age = 6; // The height of the user in feet. @@ -117,7 +117,7 @@ message User { // Enables the receiving of notifications. The default is true if unset. // // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) + // Ordinarily, the default for a `bool` field should be false. --) optional bool enable_notifications = 9; } @@ -144,7 +144,7 @@ message UpdateUserRequest { // The user to update. User user = 1; - // The field mask to determine wich fields are to be updated. If empty, the + // The field mask to determine which fields are to be updated. If empty, the // server will assume all fields are to be updated. google.protobuf.FieldMask update_mask = 2; } diff --git a/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline b/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline index fb3bf51c5..62196dfce 100644 --- a/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline +++ b/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline @@ -29,6 +29,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A simple messaging service that implements chat rooms and profile posts. // @@ -60,7 +61,7 @@ service Messaging { rpc UpdateRoom(UpdateRoomRequest) returns (Room) { option (google.api.http) = { patch: "/v1beta1/{room.name=rooms/*}" - body: "*" + body: "room" }; } @@ -99,9 +100,7 @@ service Messaging { rpc GetBlurb(GetBlurbRequest) returns (Blurb) { option (google.api.http) = { get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - get: "/v1beta1/{name=users/*/profile/blurbs/*}" - } + additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } }; option (google.api.method_signature) = "name"; } @@ -110,10 +109,10 @@ service Messaging { rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { option (google.api.http) = { patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "*" + body: "blurb" additional_bindings: { patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "*" + body: "blurb" } }; } @@ -134,9 +133,7 @@ service Messaging { rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { option (google.api.http) = { get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { - get: "/v1beta1/{parent=users/*/profile}/blurbs" - } + additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } }; option (google.api.method_signature) = "parent"; } @@ -146,17 +143,17 @@ service Messaging { // contain an exact match of a queried word will be returned. rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { - post: "/v1beta1/{parent=rooms/-}/blurbs:search" + post: "/v1beta1/{parent=rooms/*}/blurbs:search" body: "*" additional_bindings: { - post: "/v1beta1/{parent=users/-/profile}/blurbs:search" + post: "/v1beta1/{parent=users/*/profile}/blurbs:search" } }; option (google.longrunning.operation_info) = { response_type: "SearchBlurbsResponse" metadata_type: "SearchBlurbsMetadata" }; - option (google.api.method_signature) = "query"; + option (google.api.method_signature) = "parent,query"; } // This returns a stream that emits the blurbs that are created for a @@ -196,7 +193,7 @@ service Messaging { message Room { option (google.api.resource) = { type: "showcase.googleapis.com/Room" - pattern: "rooms/{room_id}" + pattern: "rooms/{room}" }; // The resource name of the chat room. @@ -209,14 +206,12 @@ message Room { string description = 3; // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request message for the google.showcase.v1beta1.Messaging\CreateRoom @@ -242,7 +237,7 @@ message UpdateRoomRequest { // The room to update. Room room = 1; - // The field mask to determine wich fields are to be updated. If empty, the + // The field mask to determine which fields are to be updated. If empty, the // server will assume all fields are to be updated. google.protobuf.FieldMask update_mask = 2; } @@ -278,8 +273,8 @@ message ListRoomsResponse { // A token to retrieve next page of results. // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve the - // next page of results. + // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve + // the next page of results. string next_page_token = 2; } @@ -288,11 +283,10 @@ message ListRoomsResponse { message Blurb { option (google.api.resource) = { type: "showcase.googleapis.com/Blurb" - pattern: "rooms/{room_id}/blurbs/{blurb_id}" - pattern: "rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}" - pattern: "user/{user_id}/profile/blurbs/{blurb_id}" - pattern: "user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}" - + pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" + pattern: "users/{user}/profile/blurbs/{blurb}" + pattern: "rooms/{room}/blurbs/{blurb}" + pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" }; // The resource name of the chat room. @@ -301,7 +295,8 @@ message Blurb { // The resource name of the blurb's author. string user = 2 [ (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED]; + (google.api.field_behavior) = REQUIRED + ]; oneof content { // The textual content of this blurb. @@ -312,24 +307,25 @@ message Blurb { } // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. --) + // resource patterns. Ordinarily, non-slash separators are discouraged. + // --) oneof legacy_id { // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern `rooms/{room_id}/blurbs/{legacy_room_id}.{blurb_id}` + // the use of the compound resource pattern + // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` string legacy_room_id = 7; // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern `rooms/{room_id}/blurbs/{legacy_user_id}~{blurb_id}` + // the use of the compound resource pattern + // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` string legacy_user_id = 8; } } @@ -340,7 +336,8 @@ message CreateBlurbRequest { // The resource name of the chat room or user profile that this blurb will // be tied to. string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; @@ -384,11 +381,11 @@ message DeleteBlurbRequest { message ListBlurbsRequest { // The resource name of the requested room or profile whos blurbs to list. string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; - // The maximum number of blurbs to return. Server may return fewer // blurbs than requested. If unspecified, server will pick an appropriate // default. @@ -422,8 +419,8 @@ message SearchBlurbsRequest { // The rooms or profiles to search. If unset, `SearchBlurbs` will search all // rooms and all profiles. - string parent = 2 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb"]; + string parent = 2 [(google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb"]; // The maximum number of blurbs return. Server may return fewer // blurbs than requested. If unspecified, server will pick an appropriate @@ -462,14 +459,14 @@ message SearchBlurbsResponse { message StreamBlurbsRequest { // The resource name of a chat room or user profile whose blurbs to stream. string name = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 [ - (google.api.field_behavior) = REQUIRED - ]; + google.protobuf.Timestamp expire_time = 2 + [(google.api.field_behavior) = REQUIRED]; } // The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs @@ -508,8 +505,8 @@ message SendBlurbsResponse { message ConnectRequest { message ConnectConfig { // The room or profile to follow and create messages for. - string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb"]; + string parent = 1 [(google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb"]; } oneof request { diff --git a/baselines/showcase/protos/google/showcase/v1beta1/sequence.proto.baseline b/baselines/showcase/protos/google/showcase/v1beta1/sequence.proto.baseline new file mode 100644 index 000000000..26158fdd8 --- /dev/null +++ b/baselines/showcase/protos/google/showcase/v1beta1/sequence.proto.baseline @@ -0,0 +1,136 @@ +// Copyright 2020 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/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.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; +option ruby_package = "Google::Showcase::V1beta1"; + +service SequenceService { + // This service is meant to only run locally on the port 7469 (keypad digits + // for "show"). + option (google.api.default_host) = "localhost:7469"; + + // Creates a sequence. + rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { + option (google.api.http) = { + post: "/v1beta1/sequences" + body: "sequence" + }; + option (google.api.method_signature) = "sequence"; + }; + + // Retrieves a sequence. + rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { + option (google.api.http) = { + get: "/v1beta1/{name=sequences/*/sequenceReport}" + }; + option (google.api.method_signature) = "name"; + }; + + // Attempts a sequence. + rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1beta1/{name=sequences/*}" + body: "*" + }; + option (google.api.method_signature) = "name"; + }; +} + +message Sequence { + option (google.api.resource) = { + type: "showcase.googleapis.com/Sequence" + pattern: "sequences/{sequence}" + }; + + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A server response to an RPC Attempt in a sequence. + message Response { + // The status to return for an individual attempt. + google.rpc.Status status = 1; + + // The amount of time to delay sending the response. + google.protobuf.Duration delay = 2; + } + + // Sequence of responses to return in order for each attempt. If empty, the + // default response is an immediate OK. + repeated Response responses = 2; +} + +message SequenceReport { + option (google.api.resource) = { + type: "showcase.googleapis.com/SequenceReport" + pattern: "sequences/{sequence}/sequenceReport" + }; + + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Contains metrics on individual RPC Attempts in a sequence. + message Attempt { + // The attempt number - starting at 0. + int32 attempt_number = 1; + + // The deadline dictated by the attempt to the server. + google.protobuf.Timestamp attempt_deadline = 2; + + // The time that the server responded to the RPC attempt. Used for + // calculating attempt_delay. + google.protobuf.Timestamp response_time = 3; + + // The server perceived delay between sending the last response and + // receiving this attempt. Used for validating attempt delay backoff. + google.protobuf.Duration attempt_delay = 4; + + // The status returned to the attempt. + google.rpc.Status status = 5; + } + + // The set of RPC attempts received by the server for a Sequence. + repeated Attempt attempts = 2; +} + +message CreateSequenceRequest { + Sequence sequence = 1; +} + +message AttemptSequenceRequest { + string name = 1 [ + (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", + (google.api.field_behavior) = REQUIRED + ]; +} + +message GetSequenceReportRequest { + string name = 1 [ + (google.api.resource_reference).type = + "showcase.googleapis.com/SequenceReport", + (google.api.field_behavior) = REQUIRED + ]; +} diff --git a/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline b/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline index b5d9d7283..56e85e97e 100644 --- a/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline +++ b/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline @@ -24,6 +24,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A service to facilitate running discrete sets of tests // against Showcase. diff --git a/baselines/showcase/src/index.ts.baseline b/baselines/showcase/src/index.ts.baseline index 2fb6dad96..4679513de 100644 --- a/baselines/showcase/src/index.ts.baseline +++ b/baselines/showcase/src/index.ts.baseline @@ -17,15 +17,19 @@ // ** All changes to this file may be overwritten. ** import * as v1beta1 from './v1beta1'; +const ComplianceClient = v1beta1.ComplianceClient; +type ComplianceClient = v1beta1.ComplianceClient; const EchoClient = v1beta1.EchoClient; type EchoClient = v1beta1.EchoClient; const IdentityClient = v1beta1.IdentityClient; type IdentityClient = v1beta1.IdentityClient; const MessagingClient = v1beta1.MessagingClient; type MessagingClient = v1beta1.MessagingClient; +const SequenceServiceClient = v1beta1.SequenceServiceClient; +type SequenceServiceClient = v1beta1.SequenceServiceClient; const TestingClient = v1beta1.TestingClient; type TestingClient = v1beta1.TestingClient; -export {v1beta1, EchoClient, IdentityClient, MessagingClient, TestingClient}; -export default {v1beta1, EchoClient, IdentityClient, MessagingClient, TestingClient}; +export {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; +export default {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; import * as protos from '../protos/protos'; export {protos} diff --git a/baselines/showcase/src/v1beta1/compliance_client.ts.baseline b/baselines/showcase/src/v1beta1/compliance_client.ts.baseline new file mode 100644 index 000000000..d91fb9ff6 --- /dev/null +++ b/baselines/showcase/src/v1beta1/compliance_client.ts.baseline @@ -0,0 +1,1951 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/compliance_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './compliance_client_config.json'; +const version = require('../../../package.json').version; + +/** + * This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format + * correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped + * correctly. + * @class + * @memberof v1beta1 + */ +export class ComplianceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + complianceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ComplianceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ComplianceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ComplianceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + blueprintPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}/blueprints/{blueprint}' + ), + roomPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}' + ), + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' + ), + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' + ), + sessionPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}' + ), + testPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}' + ), + userPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}' + ), + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' + ), + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=users/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=sequences/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=users/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=rooms/*}:getIamPolicy',},{get: '/v1beta1/{resource=rooms/*/blurbs/*}:getIamPolicy',},{get: '/v1beta1/{resource=sequences/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=users/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=sequences/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=operations/**}:cancel',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + + this.descriptors.longrunning = { + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.showcase.v1beta1.Compliance', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.complianceStub) { + return this.complianceStub; + } + + // Put together the "service stub" for + // google.showcase.v1beta1.Compliance. + this.complianceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Compliance') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.showcase.v1beta1.Compliance, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const complianceStubMethods = + ['repeatDataBody', 'repeatDataBodyInfo', 'repeatDataQuery', 'repeatDataSimplePath', 'repeatDataPathResource', 'repeatDataPathTrailingResource', 'repeatDataBodyPut', 'repeatDataBodyPatch', 'getEnum', 'verifyEnum']; + for (const methodName of complianceStubMethods) { + const callPromise = this.complianceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.complianceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'localhost'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'localhost'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 7469; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * This method echoes the ComplianceData request. This method exercises + * sending the entire request object in the REST body. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBody_async + */ + repeatDataBody( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBody( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBody( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBody( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBody(request, options, callback); + } +/** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body_info.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyInfo_async + */ + repeatDataBodyInfo( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBodyInfo( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyInfo( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyInfo( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBodyInfo(request, options, callback); + } +/** + * This method echoes the ComplianceData request. This method exercises + * sending all request fields as query parameters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_query.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataQuery_async + */ + repeatDataQuery( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataQuery( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataQuery( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataQuery( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataQuery(request, options, callback); + } +/** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_simple_path.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataSimplePath_async + */ + repeatDataSimplePath( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataSimplePath( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataSimplePath( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataSimplePath( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'info.f_string': request.info!.fString || '', + 'info.f_int32': request.info!.fInt32 || '', + 'info.f_double': request.info!.fDouble || '', + 'info.f_bool': request.info!.fBool || '', + 'info.f_kingdom': request.info!.fKingdom || '', + }); + this.initialize(); + return this.innerApiCalls.repeatDataSimplePath(request, options, callback); + } +/** + * Same as RepeatDataSimplePath, but with a path resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_path_resource.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathResource_async + */ + repeatDataPathResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataPathResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'info.f_string': request.info!.fString || '', + 'info.f_child.f_string': request.info!.fChild!.fString || '', + 'info.f_bool': request.info!.fBool || '', + }); + this.initialize(); + return this.innerApiCalls.repeatDataPathResource(request, options, callback); + } +/** + * Same as RepeatDataSimplePath, but with a trailing resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_path_trailing_resource.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathTrailingResource_async + */ + repeatDataPathTrailingResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataPathTrailingResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathTrailingResource( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataPathTrailingResource( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'info.f_string': request.info!.fString || '', + 'info.f_child.f_string': request.info!.fChild!.fString || '', + }); + this.initialize(); + return this.innerApiCalls.repeatDataPathTrailingResource(request, options, callback); + } +/** + * This method echoes the ComplianceData request, using the HTTP PUT method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body_put.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPut_async + */ + repeatDataBodyPut( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBodyPut( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPut( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPut( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBodyPut(request, options, callback); + } +/** + * This method echoes the ComplianceData request, using the HTTP PATCH method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {google.showcase.v1beta1.ComplianceData} request.info + * @param {boolean} request.serverVerify + * If true, the server will verify that the received request matches + * the request with the same name in the compliance test suite. + * @param {string} request.intendedBindingUri + * The URI template this request is expected to be bound to server-side. + * @param {number} request.fInt32 + * Some top level fields, to test that these are encoded correctly + * in query params. + * @param {number} request.fInt64 + * @param {number} request.fDouble + * @param {number} request.pInt32 + * @param {number} request.pInt64 + * @param {number} request.pDouble + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RepeatResponse]{@link google.showcase.v1beta1.RepeatResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.repeat_data_body_patch.js + * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPatch_async + */ + repeatDataBodyPatch( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>; + repeatDataBodyPatch( + request: protos.google.showcase.v1beta1.IRepeatRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPatch( + request: protos.google.showcase.v1beta1.IRepeatRequest, + callback: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): void; + repeatDataBodyPatch( + request?: protos.google.showcase.v1beta1.IRepeatRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IRepeatResponse, + protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.repeatDataBodyPatch(request, options, callback); + } +/** + * This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the + * .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the + * response from this RPC as the request to VerifyEnum() + * + * The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for + * VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. + * + * @param {Object} request + * The request object that will be sent. + * @param {boolean} request.unknownEnum + * Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EnumResponse]{@link google.showcase.v1beta1.EnumResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.get_enum.js + * region_tag:localhost_v1beta1_generated_Compliance_GetEnum_async + */ + getEnum( + request?: protos.google.showcase.v1beta1.IEnumRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined + ]>; + getEnum( + request: protos.google.showcase.v1beta1.IEnumRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>): void; + getEnum( + request: protos.google.showcase.v1beta1.IEnumRequest, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>): void; + getEnum( + request?: protos.google.showcase.v1beta1.IEnumRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.getEnum(request, options, callback); + } +/** + * This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() + * verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds + * with the same EnumResponse; otherwise, the RPC errors. + * + * This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, + * although they are not guaranteed to be the same across separate Showcase server runs. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.showcase.v1beta1.EnumRequest} request.request + * The original request for a known or unknown enum from the server. + * @param {google.showcase.v1beta1.Continent} request.continent + * The actual enum the server provided. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EnumResponse]{@link google.showcase.v1beta1.EnumResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/compliance.verify_enum.js + * region_tag:localhost_v1beta1_generated_Compliance_VerifyEnum_async + */ + verifyEnum( + request?: protos.google.showcase.v1beta1.IEnumResponse, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined + ]>; + verifyEnum( + request: protos.google.showcase.v1beta1.IEnumResponse, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>): void; + verifyEnum( + request: protos.google.showcase.v1beta1.IEnumResponse, + callback: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>): void; + verifyEnum( + request?: protos.google.showcase.v1beta1.IEnumResponse, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IEnumResponse, + protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.verifyEnum(request, options, callback); + } + +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified blueprint resource name string. + * + * @param {string} session + * @param {string} test + * @param {string} blueprint + * @returns {string} Resource name string. + */ + blueprintPath(session:string,test:string,blueprint:string) { + return this.pathTemplates.blueprintPathTemplate.render({ + session: session, + test: test, + blueprint: blueprint, + }); + } + + /** + * Parse the session from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the session. + */ + matchSessionFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; + } + + /** + * Parse the test from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the test. + */ + matchTestFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; + } + + /** + * Parse the blueprint from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the blueprint. + */ + matchBlueprintFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; + } + + /** + * Return a fully-qualified room resource name string. + * + * @param {string} room + * @returns {string} Resource name string. + */ + roomPath(room:string) { + return this.pathTemplates.roomPathTemplate.render({ + room: room, + }); + } + + /** + * Parse the room from Room resource. + * + * @param {string} roomName + * A fully-qualified path representing Room resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; + } + + /** + * Parse the blurb from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. + */ + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; + } + + /** + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from SequenceReport resource. + * + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; + } + + /** + * Return a fully-qualified session resource name string. + * + * @param {string} session + * @returns {string} Resource name string. + */ + sessionPath(session:string) { + return this.pathTemplates.sessionPathTemplate.render({ + session: session, + }); + } + + /** + * Parse the session from Session resource. + * + * @param {string} sessionName + * A fully-qualified path representing Session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromSessionName(sessionName: string) { + return this.pathTemplates.sessionPathTemplate.match(sessionName).session; + } + + /** + * Return a fully-qualified test resource name string. + * + * @param {string} session + * @param {string} test + * @returns {string} Resource name string. + */ + testPath(session:string,test:string) { + return this.pathTemplates.testPathTemplate.render({ + session: session, + test: test, + }); + } + + /** + * Parse the session from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the session. + */ + matchSessionFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).session; + } + + /** + * Parse the test from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the test. + */ + matchTestFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).test; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user:string) { + return this.pathTemplates.userPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * Return a fully-qualified userProfileBlurb resource name string. + * + * @param {string} user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; + } + + /** + * Parse the blurb from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; + } + + /** + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. + * + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; + } + + /** + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. + */ + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; + } + + /** + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.complianceStub && !this._terminated) { + return this.complianceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/baselines/showcase/src/v1beta1/compliance_client_config.json.baseline b/baselines/showcase/src/v1beta1/compliance_client_config.json.baseline new file mode 100644 index 000000000..43582a4ff --- /dev/null +++ b/baselines/showcase/src/v1beta1/compliance_client_config.json.baseline @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.showcase.v1beta1.Compliance": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "RepeatDataBody": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataBodyInfo": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataQuery": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataSimplePath": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataPathResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataPathTrailingResource": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataBodyPut": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RepeatDataBodyPatch": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetEnum": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "VerifyEnum": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/baselines/showcase/src/v1beta1/compliance_proto_list.json.baseline b/baselines/showcase/src/v1beta1/compliance_proto_list.json.baseline new file mode 100644 index 000000000..987b27b7e --- /dev/null +++ b/baselines/showcase/src/v1beta1/compliance_proto_list.json.baseline @@ -0,0 +1,8 @@ +[ + "../../protos/google/showcase/v1beta1/compliance.proto", + "../../protos/google/showcase/v1beta1/echo.proto", + "../../protos/google/showcase/v1beta1/identity.proto", + "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", + "../../protos/google/showcase/v1beta1/testing.proto" +] diff --git a/baselines/showcase/src/v1beta1/echo_client.ts.baseline b/baselines/showcase/src/v1beta1/echo_client.ts.baseline index d83d8ba64..d14d08389 100644 --- a/baselines/showcase/src/v1beta1/echo_client.ts.baseline +++ b/baselines/showcase/src/v1beta1/echo_client.ts.baseline @@ -35,7 +35,9 @@ const version = require('../../../package.json').version; * side streaming, client side streaming, and bidirectional streaming. This * service also exposes methods that explicitly implement server delay, and * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. + * to have the values echoed in the response trailers. Set the + * 'x-goog-request-params' metadata key on any method to have the values + * echoed in the response headers. * @class * @memberof v1beta1 */ @@ -181,13 +183,19 @@ export class EchoClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -196,13 +204,13 @@ export class EchoClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -293,7 +301,7 @@ export class EchoClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const echoStubMethods = - ['echo', 'expand', 'collect', 'chat', 'pagedExpand', 'wait', 'block']; + ['echo', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; for (const methodName of echoStubMethods) { const callPromise = this.echoStub.then( stub => (...args: Array<{}>) => { @@ -391,6 +399,12 @@ export class EchoClient { * The content to be echoed by the server. * @param {google.rpc.Status} request.error * The error to be thrown by the server. + * @param {google.showcase.v1beta1.Severity} request.severity + * The severity to be echoed by the server. + * @param {string} request.header + * Optional. This field can be set to test the routing annotation on the Echo method. + * @param {string} request.otherHeader + * Optional. This field can be set to test the routing annotation on the Echo method. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -447,9 +461,169 @@ export class EchoClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; + let routingParameter = {}; + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?
.*)')); + if (match) { + const parameterValue = match.groups?.['header'] ?? fieldValue; + Object.assign(routingParameter, { header: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); + if (match) { + const parameterValue = match.groups?.['routing_id'] ?? fieldValue; + Object.assign(routingParameter, { routing_id: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); + if (match) { + const parameterValue = match.groups?.['table_name'] ?? fieldValue; + Object.assign(routingParameter, { table_name: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['super_id'] ?? fieldValue; + Object.assign(routingParameter, { super_id: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); + if (match) { + const parameterValue = match.groups?.['table_name'] ?? fieldValue; + Object.assign(routingParameter, { table_name: parameterValue }); + } + } + } + { + const fieldValue = request.header; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['instance_id'] ?? fieldValue; + Object.assign(routingParameter, { instance_id: parameterValue }); + } + } + } + { + const fieldValue = request.otherHeader; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); + if (match) { + const parameterValue = match.groups?.['baz'] ?? fieldValue; + Object.assign(routingParameter, { baz: parameterValue }); + } + } + } + { + const fieldValue = request.otherHeader; + if (fieldValue !== undefined && fieldValue !== null) { + const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); + if (match) { + const parameterValue = match.groups?.['qux'] ?? fieldValue; + Object.assign(routingParameter, { qux: parameterValue }); + } + } + } + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams( + routingParameter + ); this.initialize(); return this.innerApiCalls.echo(request, options, callback); } +/** + * This is similar to the PagedExpand except that it uses + * max_results instead of page_size, as some legacy APIs still + * do. New APIs should NOT use this pattern. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.content + * The string to expand. + * @param {number} request.maxResults + * The number of words to returned in each page. + * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + * violates aip.dev/158. Ordinarily, this should be page_size. --) + * @param {string} request.pageToken + * The position of the page to be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PagedExpandResponse]{@link google.showcase.v1beta1.PagedExpandResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js + * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async + */ + pagedExpandLegacy( + request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined + ]>; + pagedExpandLegacy( + request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): void; + pagedExpandLegacy( + request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + callback: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): void; + pagedExpandLegacy( + request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.IPagedExpandResponse, + protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.pagedExpandLegacy(request, options, callback); + } /** * This method will block (wait) for the requested amount of time * and then return the response or error. @@ -525,8 +699,8 @@ export class EchoClient { } /** - * This method split the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming rpcs. + * This method splits the given content into words and will pass each word back + * through the stream. This method showcases server-side streaming RPCs. * * @param {Object} request * The request object that will be sent. @@ -559,7 +733,7 @@ export class EchoClient { /** * 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. + * passed to it. This method showcases client-side streaming RPCs. * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -604,9 +778,9 @@ export class EchoClient { } /** - * 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. + * This method, upon receiving a request on the stream, will pass the same + * content back on the stream. This method showcases bidirectional + * streaming RPCs. * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -628,8 +802,8 @@ export class EchoClient { } /** - * This method will wait the requested amount of and then return. - * This method showcases how a client handles a request timing out. + * This method will wait for the requested amount of time and then return. + * This method showcases how a client handles a request timeout. * * @param {Object} request * The request object that will be sent. @@ -730,7 +904,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -805,7 +979,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -847,7 +1021,7 @@ export class EchoClient { * @param {string} request.content * The string to expand. * @param {number} request.pageSize - * The amount of words to returned in each page. + * The number of words to returned in each page. * @param {string} request.pageToken * The position of the page to be returned. * @param {object} [options] @@ -1333,109 +1507,155 @@ export class EchoClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Return a fully-qualified roomBlurb resource name string. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the blurb from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -1500,109 +1720,109 @@ export class EchoClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/showcase/src/v1beta1/echo_client_config.json.baseline b/baselines/showcase/src/v1beta1/echo_client_config.json.baseline index c30d10733..57bd509e9 100644 --- a/baselines/showcase/src/v1beta1/echo_client_config.json.baseline +++ b/baselines/showcase/src/v1beta1/echo_client_config.json.baseline @@ -40,6 +40,14 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "PagedExpandLegacy": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PagedExpandLegacyMapped": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "Wait": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline b/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline +++ b/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline b/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline index be692cccd..c3d0b9b20 100644 --- a/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline +++ b/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline @@ -5,6 +5,120 @@ "protoPackage": "google.showcase.v1beta1", "libraryPackage": "showcase", "services": { + "Compliance": { + "clients": { + "grpc": { + "libraryClient": "ComplianceClient", + "rpcs": { + "RepeatDataBody": { + "methods": [ + "repeatDataBody" + ] + }, + "RepeatDataBodyInfo": { + "methods": [ + "repeatDataBodyInfo" + ] + }, + "RepeatDataQuery": { + "methods": [ + "repeatDataQuery" + ] + }, + "RepeatDataSimplePath": { + "methods": [ + "repeatDataSimplePath" + ] + }, + "RepeatDataPathResource": { + "methods": [ + "repeatDataPathResource" + ] + }, + "RepeatDataPathTrailingResource": { + "methods": [ + "repeatDataPathTrailingResource" + ] + }, + "RepeatDataBodyPut": { + "methods": [ + "repeatDataBodyPut" + ] + }, + "RepeatDataBodyPatch": { + "methods": [ + "repeatDataBodyPatch" + ] + }, + "GetEnum": { + "methods": [ + "getEnum" + ] + }, + "VerifyEnum": { + "methods": [ + "verifyEnum" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ComplianceClient", + "rpcs": { + "RepeatDataBody": { + "methods": [ + "repeatDataBody" + ] + }, + "RepeatDataBodyInfo": { + "methods": [ + "repeatDataBodyInfo" + ] + }, + "RepeatDataQuery": { + "methods": [ + "repeatDataQuery" + ] + }, + "RepeatDataSimplePath": { + "methods": [ + "repeatDataSimplePath" + ] + }, + "RepeatDataPathResource": { + "methods": [ + "repeatDataPathResource" + ] + }, + "RepeatDataPathTrailingResource": { + "methods": [ + "repeatDataPathTrailingResource" + ] + }, + "RepeatDataBodyPut": { + "methods": [ + "repeatDataBodyPut" + ] + }, + "RepeatDataBodyPatch": { + "methods": [ + "repeatDataBodyPatch" + ] + }, + "GetEnum": { + "methods": [ + "getEnum" + ] + }, + "VerifyEnum": { + "methods": [ + "verifyEnum" + ] + } + } + } + } + }, "Echo": { "clients": { "grpc": { @@ -15,6 +129,11 @@ "echo" ] }, + "PagedExpandLegacy": { + "methods": [ + "pagedExpandLegacy" + ] + }, "Block": { "methods": [ "block" @@ -46,6 +165,13 @@ "pagedExpandStream", "pagedExpandAsync" ] + }, + "PagedExpandLegacyMapped": { + "methods": [ + "pagedExpandLegacyMapped", + "pagedExpandLegacyMappedStream", + "pagedExpandLegacyMappedAsync" + ] } } }, @@ -57,6 +183,11 @@ "echo" ] }, + "PagedExpandLegacy": { + "methods": [ + "pagedExpandLegacy" + ] + }, "Block": { "methods": [ "block" @@ -73,6 +204,13 @@ "pagedExpandStream", "pagedExpandAsync" ] + }, + "PagedExpandLegacyMapped": { + "methods": [ + "pagedExpandLegacyMapped", + "pagedExpandLegacyMappedStream", + "pagedExpandLegacyMappedAsync" + ] } } } @@ -293,6 +431,50 @@ } } }, + "SequenceService": { + "clients": { + "grpc": { + "libraryClient": "SequenceServiceClient", + "rpcs": { + "CreateSequence": { + "methods": [ + "createSequence" + ] + }, + "GetSequenceReport": { + "methods": [ + "getSequenceReport" + ] + }, + "AttemptSequence": { + "methods": [ + "attemptSequence" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SequenceServiceClient", + "rpcs": { + "CreateSequence": { + "methods": [ + "createSequence" + ] + }, + "GetSequenceReport": { + "methods": [ + "getSequenceReport" + ] + }, + "AttemptSequence": { + "methods": [ + "attemptSequence" + ] + } + } + } + } + }, "Testing": { "clients": { "grpc": { diff --git a/baselines/showcase/src/v1beta1/identity_client.ts.baseline b/baselines/showcase/src/v1beta1/identity_client.ts.baseline index c951ef267..461c51cb0 100644 --- a/baselines/showcase/src/v1beta1/identity_client.ts.baseline +++ b/baselines/showcase/src/v1beta1/identity_client.ts.baseline @@ -177,13 +177,19 @@ export class IdentityClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -192,13 +198,13 @@ export class IdentityClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -500,7 +506,7 @@ export class IdentityClient { * @param {google.showcase.v1beta1.User} request.user * The user to update. * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the + * The field mask to determine which fields are to be updated. If empty, the * server will assume all fields are to be updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1252,109 +1258,155 @@ export class IdentityClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Parse the blurb from RoomBlurb resource. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from Sequence resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Return a fully-qualified sequenceReport resource name string. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} sequence + * @returns {string} Resource name string. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -1419,109 +1471,109 @@ export class IdentityClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline b/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline +++ b/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/showcase/src/v1beta1/index.ts.baseline b/baselines/showcase/src/v1beta1/index.ts.baseline index 2bbe1b17c..fe53c41ac 100644 --- a/baselines/showcase/src/v1beta1/index.ts.baseline +++ b/baselines/showcase/src/v1beta1/index.ts.baseline @@ -16,7 +16,9 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +export {ComplianceClient} from './compliance_client'; export {EchoClient} from './echo_client'; export {IdentityClient} from './identity_client'; export {MessagingClient} from './messaging_client'; +export {SequenceServiceClient} from './sequence_service_client'; export {TestingClient} from './testing_client'; diff --git a/baselines/showcase/src/v1beta1/messaging_client.ts.baseline b/baselines/showcase/src/v1beta1/messaging_client.ts.baseline index c8369532b..3fab79d42 100644 --- a/baselines/showcase/src/v1beta1/messaging_client.ts.baseline +++ b/baselines/showcase/src/v1beta1/messaging_client.ts.baseline @@ -180,13 +180,19 @@ export class MessagingClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -195,13 +201,13 @@ export class MessagingClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -530,7 +536,7 @@ export class MessagingClient { * @param {google.showcase.v1beta1.Room} request.room * The room to update. * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the + * The field mask to determine which fields are to be updated. If empty, the * server will assume all fields are to be updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -1974,109 +1980,155 @@ export class MessagingClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Return a fully-qualified roomBlurb resource name string. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the blurb from RoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -2141,109 +2193,109 @@ export class MessagingClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline b/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline +++ b/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/showcase/src/v1beta1/sequence_service_client.ts.baseline b/baselines/showcase/src/v1beta1/sequence_service_client.ts.baseline new file mode 100644 index 000000000..abf99f680 --- /dev/null +++ b/baselines/showcase/src/v1beta1/sequence_service_client.ts.baseline @@ -0,0 +1,1349 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/sequence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sequence_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta1 + */ +export class SequenceServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + sequenceServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SequenceServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SequenceServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SequenceServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + blueprintPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}/blueprints/{blueprint}' + ), + roomPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}' + ), + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' + ), + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' + ), + sessionPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}' + ), + testPathTemplate: new this._gaxModule.PathTemplate( + 'sessions/{session}/tests/{test}' + ), + userPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}' + ), + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' + ), + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=users/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=sequences/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=users/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=rooms/*}:getIamPolicy',},{get: '/v1beta1/{resource=rooms/*/blurbs/*}:getIamPolicy',},{get: '/v1beta1/{resource=sequences/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=users/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=sequences/*}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=operations/**}:cancel',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + + this.descriptors.longrunning = { + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.showcase.v1beta1.SequenceService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sequenceServiceStub) { + return this.sequenceServiceStub; + } + + // Put together the "service stub" for + // google.showcase.v1beta1.SequenceService. + this.sequenceServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.SequenceService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.showcase.v1beta1.SequenceService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sequenceServiceStubMethods = + ['createSequence', 'getSequenceReport', 'attemptSequence']; + for (const methodName of sequenceServiceStubMethods) { + const callPromise = this.sequenceServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sequenceServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'localhost'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'localhost'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 7469; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a sequence. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.showcase.v1beta1.Sequence} request.sequence + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Sequence]{@link google.showcase.v1beta1.Sequence}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/sequence_service.create_sequence.js + * region_tag:localhost_v1beta1_generated_SequenceService_CreateSequence_async + */ + createSequence( + request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined + ]>; + createSequence( + request: protos.google.showcase.v1beta1.ICreateSequenceRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>): void; + createSequence( + request: protos.google.showcase.v1beta1.ICreateSequenceRequest, + callback: Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>): void; + createSequence( + request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.ISequence, + protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.createSequence(request, options, callback); + } +/** + * Retrieves a sequence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SequenceReport]{@link google.showcase.v1beta1.SequenceReport}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/sequence_service.get_sequence_report.js + * region_tag:localhost_v1beta1_generated_SequenceService_GetSequenceReport_async + */ + getSequenceReport( + request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + options?: CallOptions): + Promise<[ + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined + ]>; + getSequenceReport( + request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + options: CallOptions, + callback: Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>): void; + getSequenceReport( + request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + callback: Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>): void; + getSequenceReport( + request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.showcase.v1beta1.ISequenceReport, + protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSequenceReport(request, options, callback); + } +/** + * Attempts a sequence. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/sequence_service.attempt_sequence.js + * region_tag:localhost_v1beta1_generated_SequenceService_AttemptSequence_async + */ + attemptSequence( + request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined + ]>; + attemptSequence( + request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>): void; + attemptSequence( + request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>): void; + attemptSequence( + request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.attemptSequence(request, options, callback); + } + +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified blueprint resource name string. + * + * @param {string} session + * @param {string} test + * @param {string} blueprint + * @returns {string} Resource name string. + */ + blueprintPath(session:string,test:string,blueprint:string) { + return this.pathTemplates.blueprintPathTemplate.render({ + session: session, + test: test, + blueprint: blueprint, + }); + } + + /** + * Parse the session from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the session. + */ + matchSessionFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; + } + + /** + * Parse the test from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the test. + */ + matchTestFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; + } + + /** + * Parse the blueprint from Blueprint resource. + * + * @param {string} blueprintName + * A fully-qualified path representing Blueprint resource. + * @returns {string} A string representing the blueprint. + */ + matchBlueprintFromBlueprintName(blueprintName: string) { + return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; + } + + /** + * Return a fully-qualified room resource name string. + * + * @param {string} room + * @returns {string} Resource name string. + */ + roomPath(room:string) { + return this.pathTemplates.roomPathTemplate.render({ + room: room, + }); + } + + /** + * Parse the room from Room resource. + * + * @param {string} roomName + * A fully-qualified path representing Room resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; + } + + /** + * Parse the blurb from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; + } + + /** + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. + */ + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; + } + + /** + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. + * + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from Sequence resource. + * + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; + } + + /** + * Return a fully-qualified sequenceReport resource name string. + * + * @param {string} sequence + * @returns {string} Resource name string. + */ + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); + } + + /** + * Parse the sequence from SequenceReport resource. + * + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. + */ + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; + } + + /** + * Return a fully-qualified session resource name string. + * + * @param {string} session + * @returns {string} Resource name string. + */ + sessionPath(session:string) { + return this.pathTemplates.sessionPathTemplate.render({ + session: session, + }); + } + + /** + * Parse the session from Session resource. + * + * @param {string} sessionName + * A fully-qualified path representing Session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromSessionName(sessionName: string) { + return this.pathTemplates.sessionPathTemplate.match(sessionName).session; + } + + /** + * Return a fully-qualified test resource name string. + * + * @param {string} session + * @param {string} test + * @returns {string} Resource name string. + */ + testPath(session:string,test:string) { + return this.pathTemplates.testPathTemplate.render({ + session: session, + test: test, + }); + } + + /** + * Parse the session from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the session. + */ + matchSessionFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).session; + } + + /** + * Parse the test from Test resource. + * + * @param {string} testName + * A fully-qualified path representing Test resource. + * @returns {string} A string representing the test. + */ + matchTestFromTestName(testName: string) { + return this.pathTemplates.testPathTemplate.match(testName).test; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user:string) { + return this.pathTemplates.userPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * Return a fully-qualified userProfileBlurb resource name string. + * + * @param {string} user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; + } + + /** + * Parse the blurb from UserProfileBlurb resource. + * + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; + } + + /** + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. + * + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb + * @returns {string} Resource name string. + */ + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, + }); + } + + /** + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; + } + + /** + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. + */ + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; + } + + /** + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. + * + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sequenceServiceStub && !this._terminated) { + return this.sequenceServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/baselines/showcase/src/v1beta1/sequence_service_client_config.json.baseline b/baselines/showcase/src/v1beta1/sequence_service_client_config.json.baseline new file mode 100644 index 000000000..77c80d32a --- /dev/null +++ b/baselines/showcase/src/v1beta1/sequence_service_client_config.json.baseline @@ -0,0 +1,38 @@ +{ + "interfaces": { + "google.showcase.v1beta1.SequenceService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateSequence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSequenceReport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AttemptSequence": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/baselines/showcase/src/v1beta1/sequence_service_proto_list.json.baseline b/baselines/showcase/src/v1beta1/sequence_service_proto_list.json.baseline new file mode 100644 index 000000000..987b27b7e --- /dev/null +++ b/baselines/showcase/src/v1beta1/sequence_service_proto_list.json.baseline @@ -0,0 +1,8 @@ +[ + "../../protos/google/showcase/v1beta1/compliance.proto", + "../../protos/google/showcase/v1beta1/echo.proto", + "../../protos/google/showcase/v1beta1/identity.proto", + "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", + "../../protos/google/showcase/v1beta1/testing.proto" +] diff --git a/baselines/showcase/src/v1beta1/testing_client.ts.baseline b/baselines/showcase/src/v1beta1/testing_client.ts.baseline index e1a5f117b..0b1ca60f1 100644 --- a/baselines/showcase/src/v1beta1/testing_client.ts.baseline +++ b/baselines/showcase/src/v1beta1/testing_client.ts.baseline @@ -178,13 +178,19 @@ export class TestingClient { 'sessions/{session}/tests/{test}/blueprints/{blueprint}' ), roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}' + 'rooms/{room}' ), - roomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/{blurb_id}' + roomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/{blurb}' ), - roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}' + roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' + ), + sequencePathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}' + ), + sequenceReportPathTemplate: new this._gaxModule.PathTemplate( + 'sequences/{sequence}/sequenceReport' ), sessionPathTemplate: new this._gaxModule.PathTemplate( 'sessions/{session}' @@ -193,13 +199,13 @@ export class TestingClient { 'sessions/{session}/tests/{test}' ), userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user_id}' + 'users/{user}' ), - userIdProfileBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/{blurb_id}' + userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/{blurb}' ), - userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate: new this._gaxModule.PathTemplate( - 'user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}' + userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' ), }; @@ -1574,109 +1580,155 @@ export class TestingClient { /** * Return a fully-qualified room resource name string. * - * @param {string} room_id + * @param {string} room * @returns {string} Resource name string. */ - roomPath(roomId:string) { + roomPath(room:string) { return this.pathTemplates.roomPathTemplate.render({ - room_id: roomId, + room: room, }); } /** - * Parse the room_id from Room resource. + * Parse the room from Room resource. * * @param {string} roomName * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room_id. + * @returns {string} A string representing the room. + */ + matchRoomFromRoomName(roomName: string) { + return this.pathTemplates.roomPathTemplate.match(roomName).room; + } + + /** + * Return a fully-qualified roomBlurb resource name string. + * + * @param {string} room + * @param {string} blurb + * @returns {string} Resource name string. + */ + roomBlurbPath(room:string,blurb:string) { + return this.pathTemplates.roomBlurbPathTemplate.render({ + room: room, + blurb: blurb, + }); + } + + /** + * Parse the room from RoomBlurb resource. + * + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room_id; + matchRoomFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; } /** - * Return a fully-qualified roomIdBlurbId resource name string. + * Parse the blurb from RoomBlurb resource. * - * @param {string} room_id - * @param {string} blurb_id + * @param {string} roomBlurbName + * A fully-qualified path representing room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbName(roomBlurbName: string) { + return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; + } + + /** + * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. + * + * @param {string} room + * @param {string} legacy_room + * @param {string} blurb * @returns {string} Resource name string. */ - roomIdBlurbIdPath(roomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.render({ - room_id: roomId, - blurb_id: blurbId, + roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ + room: room, + legacy_room: legacyRoom, + blurb: blurb, }); } /** - * Parse the room_id from RoomIdBlurbId resource. + * Parse the room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the room. */ - matchRoomIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).room_id; + matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; } /** - * Parse the blurb_id from RoomIdBlurbId resource. + * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} roomIdBlurbIdName - * A fully-qualified path representing room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the legacy_room. */ - matchBlurbIdFromRoomIdBlurbIdName(roomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbIdPathTemplate.match(roomIdBlurbIdName).blurb_id; + matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; } /** - * Return a fully-qualified roomIdBlurbsLegacyRoomIdBlurbId resource name string. + * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. * - * @param {string} room_id - * @param {string} legacy_room_id - * @param {string} blurb_id + * @param {string} roomBlurbsLegacyRoomBlurbName + * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. + * @returns {string} A string representing the blurb. + */ + matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { + return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; + } + + /** + * Return a fully-qualified sequence resource name string. + * + * @param {string} sequence * @returns {string} Resource name string. */ - roomIdBlurbsLegacyRoomIdBlurbIdPath(roomId:string,legacyRoomId:string,blurbId:string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render({ - room_id: roomId, - legacy_room_id: legacyRoomId, - blurb_id: blurbId, + sequencePath(sequence:string) { + return this.pathTemplates.sequencePathTemplate.render({ + sequence: sequence, }); } /** - * Parse the room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from Sequence resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the room_id. + * @param {string} sequenceName + * A fully-qualified path representing Sequence resource. + * @returns {string} A string representing the sequence. */ - matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).room_id; + matchSequenceFromSequenceName(sequenceName: string) { + return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; } /** - * Parse the legacy_room_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Return a fully-qualified sequenceReport resource name string. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the legacy_room_id. + * @param {string} sequence + * @returns {string} Resource name string. */ - matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).legacy_room_id; + sequenceReportPath(sequence:string) { + return this.pathTemplates.sequenceReportPathTemplate.render({ + sequence: sequence, + }); } /** - * Parse the blurb_id from RoomIdBlurbsLegacyRoomIdBlurbId resource. + * Parse the sequence from SequenceReport resource. * - * @param {string} roomIdBlurbsLegacyRoomIdBlurbIdName - * A fully-qualified path representing room_id_blurbs_legacy_room_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} sequenceReportName + * A fully-qualified path representing SequenceReport resource. + * @returns {string} A string representing the sequence. */ - matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(roomIdBlurbsLegacyRoomIdBlurbIdName: string) { - return this.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match(roomIdBlurbsLegacyRoomIdBlurbIdName).blurb_id; + matchSequenceFromSequenceReportName(sequenceReportName: string) { + return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; } /** @@ -1741,109 +1793,109 @@ export class TestingClient { /** * Return a fully-qualified user resource name string. * - * @param {string} user_id + * @param {string} user * @returns {string} Resource name string. */ - userPath(userId:string) { + userPath(user:string) { return this.pathTemplates.userPathTemplate.render({ - user_id: userId, + user: user, }); } /** - * Parse the user_id from User resource. + * Parse the user from User resource. * * @param {string} userName * A fully-qualified path representing User resource. - * @returns {string} A string representing the user_id. + * @returns {string} A string representing the user. */ - matchUserIdFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user_id; + matchUserFromUserName(userName: string) { + return this.pathTemplates.userPathTemplate.match(userName).user; } /** - * Return a fully-qualified userIdProfileBlurbId resource name string. + * Return a fully-qualified userProfileBlurb resource name string. * - * @param {string} user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbIdPath(userId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.render({ - user_id: userId, - blurb_id: blurbId, + userProfileBlurbPath(user:string,blurb:string) { + return this.pathTemplates.userProfileBlurbPathTemplate.render({ + user: user, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbId resource. + * Parse the user from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).user_id; + matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; } /** - * Parse the blurb_id from UserIdProfileBlurbId resource. + * Parse the blurb from UserProfileBlurb resource. * - * @param {string} userIdProfileBlurbIdName - * A fully-qualified path representing user_id_profile_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbName + * A fully-qualified path representing user_profile_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbIdName(userIdProfileBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbIdPathTemplate.match(userIdProfileBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { + return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; } /** - * Return a fully-qualified userIdProfileBlurbsLegacyUserIdBlurbId resource name string. + * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. * - * @param {string} user_id - * @param {string} legacy_user_id - * @param {string} blurb_id + * @param {string} user + * @param {string} legacy_user + * @param {string} blurb * @returns {string} Resource name string. */ - userIdProfileBlurbsLegacyUserIdBlurbIdPath(userId:string,legacyUserId:string,blurbId:string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render({ - user_id: userId, - legacy_user_id: legacyUserId, - blurb_id: blurbId, + userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ + user: user, + legacy_user: legacyUser, + blurb: blurb, }); } /** - * Parse the user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the user. */ - matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).user_id; + matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; } /** - * Parse the legacy_user_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the legacy_user_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the legacy_user. */ - matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).legacy_user_id; + matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; } /** - * Parse the blurb_id from UserIdProfileBlurbsLegacyUserIdBlurbId resource. + * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. * - * @param {string} userIdProfileBlurbsLegacyUserIdBlurbIdName - * A fully-qualified path representing user_id_profile_blurbs_legacy_user_id_blurb_id resource. - * @returns {string} A string representing the blurb_id. + * @param {string} userProfileBlurbsLegacyUserBlurbName + * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. + * @returns {string} A string representing the blurb. */ - matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(userIdProfileBlurbsLegacyUserIdBlurbIdName: string) { - return this.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match(userIdProfileBlurbsLegacyUserIdBlurbIdName).blurb_id; + matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { + return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; } /** diff --git a/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline b/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline index fc1a54a70..987b27b7e 100644 --- a/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline +++ b/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline @@ -1,6 +1,8 @@ [ + "../../protos/google/showcase/v1beta1/compliance.proto", "../../protos/google/showcase/v1beta1/echo.proto", "../../protos/google/showcase/v1beta1/identity.proto", "../../protos/google/showcase/v1beta1/messaging.proto", + "../../protos/google/showcase/v1beta1/sequence.proto", "../../protos/google/showcase/v1beta1/testing.proto" ] diff --git a/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline b/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline index 18e59fb40..0ca92ab92 100644 --- a/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline +++ b/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline @@ -21,9 +21,11 @@ const showcase = require('showcase'); function main() { + const complianceClient = new showcase.ComplianceClient(); const echoClient = new showcase.EchoClient(); const identityClient = new showcase.IdentityClient(); const messagingClient = new showcase.MessagingClient(); + const sequenceServiceClient = new showcase.SequenceServiceClient(); const testingClient = new showcase.TestingClient(); } diff --git a/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline b/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline index d5eca8ea6..acf2f6bd6 100644 --- a/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline +++ b/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline @@ -16,9 +16,12 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {EchoClient, IdentityClient, MessagingClient, TestingClient} from 'showcase'; +import {ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient} from 'showcase'; // check that the client class type name can be used +function doStuffWithComplianceClient(client: ComplianceClient) { + client.close(); +} function doStuffWithEchoClient(client: EchoClient) { client.close(); } @@ -28,11 +31,17 @@ function doStuffWithIdentityClient(client: IdentityClient) { function doStuffWithMessagingClient(client: MessagingClient) { client.close(); } +function doStuffWithSequenceServiceClient(client: SequenceServiceClient) { + client.close(); +} function doStuffWithTestingClient(client: TestingClient) { client.close(); } function main() { + // check that the client instance can be created + const complianceClient = new ComplianceClient(); + doStuffWithComplianceClient(complianceClient); // check that the client instance can be created const echoClient = new EchoClient(); doStuffWithEchoClient(echoClient); @@ -43,6 +52,9 @@ function main() { const messagingClient = new MessagingClient(); doStuffWithMessagingClient(messagingClient); // check that the client instance can be created + const sequenceServiceClient = new SequenceServiceClient(); + doStuffWithSequenceServiceClient(sequenceServiceClient); + // check that the client instance can be created const testingClient = new TestingClient(); doStuffWithTestingClient(testingClient); } diff --git a/baselines/showcase/test/gapic_compliance_v1beta1.ts.baseline b/baselines/showcase/test/gapic_compliance_v1beta1.ts.baseline new file mode 100644 index 000000000..825ff46bb --- /dev/null +++ b/baselines/showcase/test/gapic_compliance_v1beta1.ts.baseline @@ -0,0 +1,2128 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as complianceModule from '../src'; + +import {protobuf, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.ComplianceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = complianceModule.v1beta1.ComplianceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = complianceModule.v1beta1.ComplianceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = complianceModule.v1beta1.ComplianceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new complianceModule.v1beta1.ComplianceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.complianceStub, undefined); + await client.initialize(); + assert(client.complianceStub); + }); + + it('has close method for the initialized client', done => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.complianceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.complianceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('repeatDataBody', () => { + it('invokes repeatDataBody without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBody = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBody(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBody as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBody without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBody = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBody( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBody as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBody with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBody = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBody(request), expectedError); + assert((client.innerApiCalls.repeatDataBody as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBody with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBody(request), expectedError); + }); + }); + + describe('repeatDataBodyInfo', () => { + it('invokes repeatDataBodyInfo without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBodyInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyInfo without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyInfo = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBodyInfo( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBodyInfo with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBodyInfo(request), expectedError); + assert((client.innerApiCalls.repeatDataBodyInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyInfo with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBodyInfo(request), expectedError); + }); + }); + + describe('repeatDataQuery', () => { + it('invokes repeatDataQuery without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataQuery = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataQuery(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataQuery without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataQuery( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataQuery with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataQuery(request), expectedError); + assert((client.innerApiCalls.repeatDataQuery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataQuery with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataQuery(request), expectedError); + }); + }); + + describe('repeatDataSimplePath', () => { + it('invokes repeatDataSimplePath without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_int32=&info.f_double=&info.f_bool=&info.f_kingdom="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataSimplePath(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataSimplePath as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataSimplePath without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_int32=&info.f_double=&info.f_bool=&info.f_kingdom="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataSimplePath = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataSimplePath( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataSimplePath as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataSimplePath with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_int32=&info.f_double=&info.f_bool=&info.f_kingdom="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataSimplePath(request), expectedError); + assert((client.innerApiCalls.repeatDataSimplePath as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataSimplePath with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fInt32 = ''; + request.info = {}; + request.info.fDouble = ''; + request.info = {}; + request.info.fBool = ''; + request.info = {}; + request.info.fKingdom = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataSimplePath(request), expectedError); + }); + }); + + describe('repeatDataPathResource', () => { + it('invokes repeatDataPathResource without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string=&info.f_bool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathResource = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataPathResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathResource without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string=&info.f_bool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataPathResource( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataPathResource with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string=&info.f_bool="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataPathResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataPathResource(request), expectedError); + assert((client.innerApiCalls.repeatDataPathResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathResource with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + request.info = {}; + request.info.fBool = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataPathResource(request), expectedError); + }); + }); + + describe('repeatDataPathTrailingResource', () => { + it('invokes repeatDataPathTrailingResource without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataPathTrailingResource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathTrailingResource without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataPathTrailingResource( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataPathTrailingResource with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedHeaderRequestParams = "info.f_string=&info.f_child.f_string="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); + assert((client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataPathTrailingResource with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + request.info = {}; + request.info.fString = ''; + request.info = {}; + request.info.fChild = {}; + request.info.fChild.fString = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); + }); + }); + + describe('repeatDataBodyPut', () => { + it('invokes repeatDataBodyPut without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBodyPut(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPut as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPut without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPut = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBodyPut( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPut as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBodyPut with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBodyPut(request), expectedError); + assert((client.innerApiCalls.repeatDataBodyPut as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPut with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBodyPut(request), expectedError); + }); + }); + + describe('repeatDataBodyPatch', () => { + it('invokes repeatDataBodyPatch without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(expectedResponse); + const [response] = await client.repeatDataBodyPatch(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPatch as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPatch without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatResponse()); + client.innerApiCalls.repeatDataBodyPatch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repeatDataBodyPatch( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.repeatDataBodyPatch as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes repeatDataBodyPatch with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.repeatDataBodyPatch(request), expectedError); + assert((client.innerApiCalls.repeatDataBodyPatch as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes repeatDataBodyPatch with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.RepeatRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.repeatDataBodyPatch(request), expectedError); + }); + }); + + describe('getEnum', () => { + it('invokes getEnum without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.getEnum = stubSimpleCall(expectedResponse); + const [response] = await client.getEnum(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnum without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.getEnum = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnum( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getEnum with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnum = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnum(request), expectedError); + assert((client.innerApiCalls.getEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getEnum with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEnum(request), expectedError); + }); + }); + + describe('verifyEnum', () => { + it('invokes verifyEnum without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.verifyEnum = stubSimpleCall(expectedResponse); + const [response] = await client.verifyEnum(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.verifyEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes verifyEnum without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + client.innerApiCalls.verifyEnum = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyEnum( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.verifyEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes verifyEnum with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyEnum = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.verifyEnum(request), expectedError); + assert((client.innerApiCalls.verifyEnum as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes verifyEnum with closed client', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.EnumResponse()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.verifyEnum(request), expectedError); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('blueprint', () => { + const fakePath = "/rendered/path/blueprint"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + blueprint: "blueprintValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.blueprintPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.blueprintPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('blueprintPath', () => { + const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromBlueprintName', () => { + const result = client.matchSessionFromBlueprintName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromBlueprintName', () => { + const result = client.matchTestFromBlueprintName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlueprintFromBlueprintName', () => { + const result = client.matchBlueprintFromBlueprintName(fakePath); + assert.strictEqual(result, "blueprintValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('room', () => { + const fakePath = "/rendered/path/room"; + const expectedParameters = { + room: "roomValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomPath', () => { + const result = client.roomPath("roomValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; + const expectedParameters = { + room: "roomValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; + const expectedParameters = { + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('session', () => { + const fakePath = "/rendered/path/session"; + const expectedParameters = { + session: "sessionValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sessionPath', () => { + const result = client.sessionPath("sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromSessionName', () => { + const result = client.matchSessionFromSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('test', () => { + const fakePath = "/rendered/path/test"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.testPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.testPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('testPath', () => { + const result = client.testPath("sessionValue", "testValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.testPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromTestName', () => { + const result = client.matchSessionFromTestName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromTestName', () => { + const result = client.matchTestFromTestName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('user', () => { + const fakePath = "/rendered/path/user"; + const expectedParameters = { + user: "userValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userPath', () => { + const result = client.userPath("userValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; + const expectedParameters = { + user: "userValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; + const expectedParameters = { + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", + }; + const client = new complianceModule.v1beta1.ComplianceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline b/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline index cb708ebe4..36c846fb2 100644 --- a/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline +++ b/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline @@ -239,7 +239,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()); client.innerApiCalls.echo = stubSimpleCall(expectedResponse); const [response] = await client.echo(request); @@ -255,7 +287,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()); client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { @@ -282,7 +346,39 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); - const expectedOptions = {otherArgs: {headers: {}}};; + const expectedHeaderRequestParamsObj: {[key: string]: string} = {}; + // path template is empty + request.header = 'value'; + expectedHeaderRequestParamsObj['header'] = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + expectedHeaderRequestParamsObj['routing_id'] = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'regions%2Fvalue%2Fzones%2Fvalue%2Fvalue'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + expectedHeaderRequestParamsObj['super_id'] = 'projects%2Fvalue'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['table_name'] = 'projects%2Fvalue%2Finstances%2Fvalue%2Fvalue'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + expectedHeaderRequestParamsObj['instance_id'] = 'instances%2Fvalue'; + // path template: {baz=**} + request.otherHeader = 'value'; + expectedHeaderRequestParamsObj['baz'] = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; + expectedHeaderRequestParamsObj['qux'] = 'projects%2Fvalue'; + const expectedHeaderRequestParams = Object.entries(expectedHeaderRequestParamsObj).map(([key, value]) => `${key}=${value}`).join('&'); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); await assert.rejects(client.echo(request), expectedError); @@ -297,12 +393,100 @@ describe('v1beta1.EchoClient', () => { }); client.initialize(); const request = generateSampleMessage(new protos.google.showcase.v1beta1.EchoRequest()); + // path template is empty + request.header = 'value'; + // path template: {routing_id=**} + request.header = 'value'; + // path template: {table_name=regions/*/zones/*/**} + request.header = 'regions/value/zones/value/value'; + // path template: {super_id=projects/*}/** + request.header = 'projects/value/value'; + // path template: {table_name=projects/*/instances/*/**} + request.header = 'projects/value/instances/value/value'; + // path template: projects/*/{instance_id=instances/*}/** + request.header = 'projects/value/instances/value/value'; + // path template: {baz=**} + request.otherHeader = 'value'; + // path template: {qux=projects/*}/** + request.otherHeader = 'projects/value/value'; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.echo(request), expectedError); }); }); + describe('pagedExpandLegacy', () => { + it('invokes pagedExpandLegacy without error', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandResponse()); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); + const [response] = await client.pagedExpandLegacy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pagedExpandLegacy without error using callback', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandResponse()); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pagedExpandLegacy( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes pagedExpandLegacy with error', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.pagedExpandLegacy(request), expectedError); + assert((client.innerApiCalls.pagedExpandLegacy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes pagedExpandLegacy with closed client', async () => { + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandLegacyRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.pagedExpandLegacy(request), expectedError); + }); + }); + describe('block', () => { it('invokes block without error', async () => { const client = new echoModule.v1beta1.EchoClient({ @@ -844,6 +1028,7 @@ describe('v1beta1.EchoClient', () => { .getCall(0).args[1], request); }); }); + describe('getIamPolicy', () => { it('invokes getIamPolicy without error', async () => { const client = new echoModule.v1beta1.EchoClient({ @@ -1591,7 +1776,7 @@ describe('v1beta1.EchoClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1604,100 +1789,160 @@ describe('v1beta1.EchoClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new echoModule.v1beta1.EchoClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -1773,7 +2018,7 @@ describe('v1beta1.EchoClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1786,100 +2031,100 @@ describe('v1beta1.EchoClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline b/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline index 789c7281e..b4de1ff1b 100644 --- a/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline +++ b/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline @@ -1466,7 +1466,7 @@ describe('v1beta1.IdentityClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1479,100 +1479,160 @@ describe('v1beta1.IdentityClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new identityModule.v1beta1.IdentityClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new identityModule.v1beta1.IdentityClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -1648,7 +1708,7 @@ describe('v1beta1.IdentityClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1661,100 +1721,100 @@ describe('v1beta1.IdentityClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new identityModule.v1beta1.IdentityClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline b/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline index d1a3aa2ab..c5a79c722 100644 --- a/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline +++ b/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline @@ -2478,7 +2478,7 @@ describe('v1beta1.MessagingClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -2491,100 +2491,160 @@ describe('v1beta1.MessagingClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new messagingModule.v1beta1.MessagingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new messagingModule.v1beta1.MessagingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -2660,7 +2720,7 @@ describe('v1beta1.MessagingClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -2673,100 +2733,100 @@ describe('v1beta1.MessagingClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new messagingModule.v1beta1.MessagingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/baselines/showcase/test/gapic_sequence_service_v1beta1.ts.baseline b/baselines/showcase/test/gapic_sequence_service_v1beta1.ts.baseline new file mode 100644 index 000000000..b0cec832f --- /dev/null +++ b/baselines/showcase/test/gapic_sequence_service_v1beta1.ts.baseline @@ -0,0 +1,1523 @@ +// Copyright 2022 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as sequenceserviceModule from '../src'; + +import {protobuf, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.SequenceServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = sequenceserviceModule.v1beta1.SequenceServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sequenceserviceModule.v1beta1.SequenceServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sequenceserviceModule.v1beta1.SequenceServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sequenceServiceStub, undefined); + await client.initialize(); + assert(client.sequenceServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sequenceServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sequenceServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSequence', () => { + it('invokes createSequence without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.Sequence()); + client.innerApiCalls.createSequence = stubSimpleCall(expectedResponse); + const [response] = await client.createSequence(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSequence without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.Sequence()); + client.innerApiCalls.createSequence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSequence( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequence|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSequence with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedOptions = {otherArgs: {headers: {}}};; + const expectedError = new Error('expected'); + client.innerApiCalls.createSequence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSequence(request), expectedError); + assert((client.innerApiCalls.createSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSequence with closed client', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.CreateSequenceRequest()); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSequence(request), expectedError); + }); + }); + + describe('getSequenceReport', () => { + it('invokes getSequenceReport without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.SequenceReport()); + client.innerApiCalls.getSequenceReport = stubSimpleCall(expectedResponse); + const [response] = await client.getSequenceReport(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSequenceReport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSequenceReport without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.showcase.v1beta1.SequenceReport()); + client.innerApiCalls.getSequenceReport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSequenceReport( + request, + (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequenceReport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSequenceReport as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSequenceReport with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSequenceReport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSequenceReport(request), expectedError); + assert((client.innerApiCalls.getSequenceReport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSequenceReport with closed client', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.GetSequenceReportRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSequenceReport(request), expectedError); + }); + }); + + describe('attemptSequence', () => { + it('invokes attemptSequence without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.attemptSequence = stubSimpleCall(expectedResponse); + const [response] = await client.attemptSequence(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attemptSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attemptSequence without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.attemptSequence = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.attemptSequence( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.attemptSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes attemptSequence with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.attemptSequence = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.attemptSequence(request), expectedError); + assert((client.innerApiCalls.attemptSequence as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes attemptSequence with closed client', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.showcase.v1beta1.AttemptSequenceRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.attemptSequence(request), expectedError); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('blueprint', () => { + const fakePath = "/rendered/path/blueprint"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + blueprint: "blueprintValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.blueprintPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.blueprintPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('blueprintPath', () => { + const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromBlueprintName', () => { + const result = client.matchSessionFromBlueprintName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromBlueprintName', () => { + const result = client.matchTestFromBlueprintName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlueprintFromBlueprintName', () => { + const result = client.matchBlueprintFromBlueprintName(fakePath); + assert.strictEqual(result, "blueprintValue"); + assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('room', () => { + const fakePath = "/rendered/path/room"; + const expectedParameters = { + room: "roomValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomPath', () => { + const result = client.roomPath("roomValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; + const expectedParameters = { + room: "roomValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; + const expectedParameters = { + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('session', () => { + const fakePath = "/rendered/path/session"; + const expectedParameters = { + session: "sessionValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sessionPath', () => { + const result = client.sessionPath("sessionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromSessionName', () => { + const result = client.matchSessionFromSessionName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('test', () => { + const fakePath = "/rendered/path/test"; + const expectedParameters = { + session: "sessionValue", + test: "testValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.testPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.testPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('testPath', () => { + const result = client.testPath("sessionValue", "testValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.testPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSessionFromTestName', () => { + const result = client.matchSessionFromTestName(fakePath); + assert.strictEqual(result, "sessionValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTestFromTestName', () => { + const result = client.matchTestFromTestName(fakePath); + assert.strictEqual(result, "testValue"); + assert((client.pathTemplates.testPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('user', () => { + const fakePath = "/rendered/path/user"; + const expectedParameters = { + user: "userValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userPath', () => { + const result = client.userPath("userValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; + const expectedParameters = { + user: "userValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; + const expectedParameters = { + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", + }; + const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline b/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline index 6fb15ed29..39abe7181 100644 --- a/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline +++ b/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline @@ -1879,7 +1879,7 @@ describe('v1beta1.TestingClient', () => { describe('room', () => { const fakePath = "/rendered/path/room"; const expectedParameters = { - room_id: "roomIdValue", + room: "roomValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -1892,100 +1892,160 @@ describe('v1beta1.TestingClient', () => { sinon.stub().returns(expectedParameters); it('roomPath', () => { - const result = client.roomPath("roomIdValue"); + const result = client.roomPath("roomValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.roomPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomName', () => { - const result = client.matchRoomIdFromRoomName(fakePath); - assert.strictEqual(result, "roomIdValue"); + it('matchRoomFromRoomName', () => { + const result = client.matchRoomFromRoomName(fakePath); + assert.strictEqual(result, "roomValue"); assert((client.pathTemplates.roomPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbId"; + describe('roomBlurb', () => { + const fakePath = "/rendered/path/roomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbIdPath', () => { - const result = client.roomIdBlurbIdPath("roomIdValue", "blurbIdValue"); + it('roomBlurbPath', () => { + const result = client.roomBlurbPath("roomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('roomIdBlurbsLegacyRoomIdBlurbId', () => { - const fakePath = "/rendered/path/roomIdBlurbsLegacyRoomIdBlurbId"; + describe('roomBlurbsLegacyRoomBlurb', () => { + const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; const expectedParameters = { - room_id: "roomIdValue", - legacy_room_id: "legacyRoomIdValue", - blurb_id: "blurbIdValue", + room: "roomValue", + legacy_room: "legacyRoomValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match = + client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('roomIdBlurbsLegacyRoomIdBlurbIdPath', () => { - const result = client.roomIdBlurbsLegacyRoomIdBlurbIdPath("roomIdValue", "legacyRoomIdValue", "blurbIdValue"); + it('roomBlurbsLegacyRoomBlurbPath', () => { + const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "roomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "roomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchLegacyRoomIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyRoomIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "legacyRoomValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName', () => { - const result = client.matchBlurbIdFromRoomIdBlurbsLegacyRoomIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.roomIdBlurbsLegacyRoomIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { + const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequence', () => { + const fakePath = "/rendered/path/sequence"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new testingModule.v1beta1.TestingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequencePath', () => { + const result = client.sequencePath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceName', () => { + const result = client.matchSequenceFromSequenceName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sequenceReport', () => { + const fakePath = "/rendered/path/sequenceReport"; + const expectedParameters = { + sequence: "sequenceValue", + }; + const client = new testingModule.v1beta1.TestingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sequenceReportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sequenceReportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sequenceReportPath', () => { + const result = client.sequenceReportPath("sequenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchSequenceFromSequenceReportName', () => { + const result = client.matchSequenceFromSequenceReportName(fakePath); + assert.strictEqual(result, "sequenceValue"); + assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); @@ -2061,7 +2121,7 @@ describe('v1beta1.TestingClient', () => { describe('user', () => { const fakePath = "/rendered/path/user"; const expectedParameters = { - user_id: "userIdValue", + user: "userValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -2074,100 +2134,100 @@ describe('v1beta1.TestingClient', () => { sinon.stub().returns(expectedParameters); it('userPath', () => { - const result = client.userPath("userIdValue"); + const result = client.userPath("userValue"); assert.strictEqual(result, fakePath); assert((client.pathTemplates.userPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserName', () => { - const result = client.matchUserIdFromUserName(fakePath); - assert.strictEqual(result, "userIdValue"); + it('matchUserFromUserName', () => { + const result = client.matchUserFromUserName(fakePath); + assert.strictEqual(result, "userValue"); assert((client.pathTemplates.userPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbId"; + describe('userProfileBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurb"; const expectedParameters = { - user_id: "userIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbIdPath', () => { - const result = client.userIdProfileBlurbIdPath("userIdValue", "blurbIdValue"); + it('userProfileBlurbPath', () => { + const result = client.userProfileBlurbPath("userValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); - describe('userIdProfileBlurbsLegacyUserIdBlurbId', () => { - const fakePath = "/rendered/path/userIdProfileBlurbsLegacyUserIdBlurbId"; + describe('userProfileBlurbsLegacyUserBlurb', () => { + const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; const expectedParameters = { - user_id: "userIdValue", - legacy_user_id: "legacyUserIdValue", - blurb_id: "blurbIdValue", + user: "userValue", + legacy_user: "legacyUserValue", + blurb: "blurbValue", }; const client = new testingModule.v1beta1.TestingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = sinon.stub().returns(fakePath); - client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match = + client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = sinon.stub().returns(expectedParameters); - it('userIdProfileBlurbsLegacyUserIdBlurbIdPath', () => { - const result = client.userIdProfileBlurbsLegacyUserIdBlurbIdPath("userIdValue", "legacyUserIdValue", "blurbIdValue"); + it('userProfileBlurbsLegacyUserBlurbPath', () => { + const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.render as SinonStub) + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) .getCall(-1).calledWith(expectedParameters)); }); - it('matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "userIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchLegacyUserIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "legacyUserIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "legacyUserValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); - it('matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName', () => { - const result = client.matchBlurbIdFromUserIdProfileBlurbsLegacyUserIdBlurbIdName(fakePath); - assert.strictEqual(result, "blurbIdValue"); - assert((client.pathTemplates.userIdProfileBlurbsLegacyUserIdBlurbIdPathTemplate.match as SinonStub) + it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { + const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); + assert.strictEqual(result, "blurbValue"); + assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) .getCall(-1).calledWith(fakePath)); }); }); diff --git a/test-fixtures/protos/google/showcase/v1beta1/compliance.proto b/test-fixtures/protos/google/showcase/v1beta1/compliance.proto new file mode 100644 index 000000000..9b6c0b7d7 --- /dev/null +++ b/test-fixtures/protos/google/showcase/v1beta1/compliance.proto @@ -0,0 +1,269 @@ +// 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 +// +// 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"; + +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; +option ruby_package = "Google::Showcase::V1beta1"; + +// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format +// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped +// correctly. +service Compliance { + // 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 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: "/v1beta1/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: "/v1beta1/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: "/v1beta1/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: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" + }; + } + + // Same as RepeatDataSimplePath, but with a path resource. + rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" + additional_bindings { + get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" + } + }; + } + + // Same as RepeatDataSimplePath, but with a trailing resource. + rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" + }; + } + + // This method echoes the ComplianceData request, using the HTTP PUT method. + rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + put: "/v1beta1/repeat:bodyput" + body: "*" + }; + } + + // This method echoes the ComplianceData request, using the HTTP PATCH method. + rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { + option (google.api.http) = { + patch: "/v1beta1/repeat:bodypatch" + body: "*" + }; + } + + // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the + // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the + // response from this RPC as the request to VerifyEnum() + // + // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for + // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. + rpc GetEnum(EnumRequest) returns (EnumResponse) { + option (google.api.http) = { + get: "/v1beta1/compliance/enum" + }; + } + + // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() + // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds + // with the same EnumResponse; otherwise, the RPC errors. + // + // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, + // although they are not guaranteed to be the same across separate Showcase server runs. + rpc VerifyEnum(EnumResponse) returns (EnumResponse) { + option (google.api.http) = { + post: "/v1beta1/compliance/enum" + }; + } + +} + +message RepeatRequest { + string name = 1; + ComplianceData info = 2; + + // If true, the server will verify that the received request matches + // the request with the same name in the compliance test suite. + bool server_verify = 3; + + // The URI template this request is expected to be bound to server-side. + optional string intended_binding_uri = 10; + + // Some top level fields, to test that these are encoded correctly + // in query params. + int32 f_int32 = 4; + int64 f_int64 = 5; + double f_double = 6; + + optional int32 p_int32 = 7; + optional int64 p_int64 = 8; + optional double p_double = 9; +} + +message RepeatResponse { + RepeatRequest request = 1; + + // The URI template the request was bound to server-side. + string binding_uri = 2; +} + +// ComplianceSuite contains a set of requests that microgenerators should issue +// over REST to the Compliance service to test their gRPC-to-REST transcoding +// implementation. +message ComplianceSuite { + repeated ComplianceGroup group = 1; +} + +// ComplianceGroups encapsulates a group of RPC requests to the Compliance +// server: one request for each combination of elements of `rpcs` and of +// `requests`. +message ComplianceGroup { + string name = 1; + repeated string rpcs = 2; + repeated RepeatRequest requests = 3; +} + +// ComplianceData is a message used for testing REST transcoding of +// different data types. +message ComplianceData { + enum LifeKingdom { + LIFE_KINGDOM_UNSPECIFIED = 0; + ARCHAEBACTERIA = 1; + EUBACTERIA = 2; + PROTISTA = 3; + FUNGI = 4; + PLANTAE = 5; + ANIMALIA = 6; +} + // scalar types + + 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; + + LifeKingdom f_kingdom = 22; + + ComplianceDataChild f_child = 16; + + // optional fields + + optional string p_string = 17; + optional int32 p_int32 = 18; + optional double p_double = 19; + optional bool p_bool = 20; + optional LifeKingdom p_kingdom = 23; + optional ComplianceDataChild p_child = 21; +} + +message ComplianceDataChild { + string f_string = 1; + float f_float = 2; + double f_double = 3; + bool f_bool = 4; + Continent f_continent = 11; + ComplianceDataGrandchild f_child = 5; + + optional string p_string = 6; + optional float p_float = 7; + optional double p_double = 8; + optional bool p_bool = 9; + Continent p_continent = 12; + optional ComplianceDataGrandchild p_child = 10; +} + +message ComplianceDataGrandchild { + string f_string = 1; + double f_double = 2; + bool f_bool = 3; +} + +enum Continent { + CONTINENT_UNSPECIFIED = 0; + AFRICA = 1; + AMERICA = 2; + ANTARTICA = 3; + AUSTRALIA = 4; + EUROPE = 5; +} + + +message EnumRequest { + // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. + bool unknown_enum = 1; +} + +message EnumResponse { + // The original request for a known or unknown enum from the server. + EnumRequest request = 1; + + // The actual enum the server provided. + Continent continent = 2; +} diff --git a/test-fixtures/protos/google/showcase/v1beta1/echo.proto b/test-fixtures/protos/google/showcase/v1beta1/echo.proto index 6e9d78a37..1b1b160f0 100644 --- a/test-fixtures/protos/google/showcase/v1beta1/echo.proto +++ b/test-fixtures/protos/google/showcase/v1beta1/echo.proto @@ -17,6 +17,7 @@ syntax = "proto3"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/routing.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -27,27 +28,63 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // 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. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. +// to have the values echoed in the response trailers. Set the +// 'x-goog-request-params' metadata key on any method to have the values +// echoed in the response headers. 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. + // This method simply echoes the request. This method showcases unary RPCs. rpc Echo(EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:echo" body: "*" }; + option (google.api.routing) = { + routing_parameters{ + field: "header" + } + routing_parameters{ + field: "header" + path_template: "{routing_id=**}" + } + routing_parameters{ + field: "header" + path_template: "{table_name=regions/*/zones/*/**}" + } + routing_parameters{ + field: "header" + path_template: "{super_id=projects/*}/**" + } + routing_parameters{ + field: "header" + path_template: "{table_name=projects/*/instances/*/**}" + } + routing_parameters{ + field: "header" + path_template: "projects/*/{instance_id=instances/*}/**" + } + routing_parameters{ + field: "other_header" + path_template: "{baz=**}" + } + routing_parameters{ + field: "other_header" + path_template: "{qux=projects/*}/**" + } + }; } - // This method split the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming rpcs. + // This method splits 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" @@ -60,7 +97,7 @@ service Echo { // 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. + // passed to it. This method showcases client-side streaming RPCs. rpc Collect(stream EchoRequest) returns (EchoResponse) { option (google.api.http) = { post: "/v1beta1/echo:collect" @@ -68,9 +105,9 @@ service Echo { }; } - // 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. + // This method, upon receiving a request on the stream, will pass the same + // content 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 @@ -82,8 +119,30 @@ service Echo { }; } - // This method will wait the requested amount of and then return. - // This method showcases how a client handles a request timing out. + // This is similar to the PagedExpand except that it uses + // max_results instead of page_size, as some legacy APIs still + // do. New APIs should NOT use this pattern. + rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacy" + body: "*" + }; + } + + // This method returns a map containing lists of words that appear in the input, keyed by their + // initial character. The only words returned are the ones included in the current page, + // as determined by page_token and page_size, which both refer to the word indices in the + // input. This paging result consisting of a map of lists is a pattern used by some legacy + // APIs. New APIs should NOT use this pattern. + rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { + option (google.api.http) = { + post: "/v1beta1/echo:pagedExpandLegacyMapped" + body: "*" + }; + } + + // This method will wait for the requested amount of time and then return. + // This method showcases how a client handles a request timeout. rpc Wait(WaitRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1beta1/echo:wait" @@ -95,7 +154,7 @@ service Echo { }; } - // This method will block (wait) for the requested amount of time + // This method will block (wait) for the requested amount of time // and then return the response or error. // This method showcases how a client handles delays or retries. rpc Block(BlockRequest) returns (BlockResponse) { @@ -106,9 +165,19 @@ service Echo { }; } -// 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. +// A severity enum used to test enum capabilities in GAPIC surfaces. +enum Severity { + UNNECESSARY = 0; + NECESSARY = 1; + URGENT = 2; + CRITICAL = 3; +} + + +// The request message used for the Echo, Collect and Chat methods. +// If content or opt are 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. @@ -117,12 +186,24 @@ message EchoRequest { // The error to be thrown by the server. google.rpc.Status error = 2; } + + // The severity to be echoed by the server. + Severity severity = 3; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string header = 4; + + // Optional. This field can be set to test the routing annotation on the Echo method. + string other_header = 5; } // The response message for the Echo methods. message EchoResponse { // The content specified in the request. string content = 1; + + // The severity specified in the request. + Severity severity = 2; } // The request message for the Expand method. @@ -139,13 +220,29 @@ message PagedExpandRequest { // The string to expand. string content = 1 [(google.api.field_behavior) = REQUIRED]; - // The amount of words to returned in each page. + // The number of words to returned in each page. int32 page_size = 2; // The position of the page to be returned. string page_token = 3; } +// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New +// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to +// aip.dev/158. +message PagedExpandLegacyRequest { + // The string to expand. + string content = 1 [(google.api.field_behavior) = REQUIRED]; + + // The number of words to returned in each page. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that + // violates aip.dev/158. Ordinarily, this should be page_size. --) + int32 max_results = 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. @@ -155,6 +252,21 @@ message PagedExpandResponse { string next_page_token = 2; } +// A list of words. +message PagedExpandResponseList { + repeated string words = 1; +} + +message PagedExpandLegacyMappedResponse { + // The words that were expanded, indexed by their initial character. + // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates + // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) + map alphabetized = 1; + + // The next page token. + string next_page_token = 2; +} + // The request for Wait method. message WaitRequest { oneof end { diff --git a/test-fixtures/protos/google/showcase/v1beta1/identity.proto b/test-fixtures/protos/google/showcase/v1beta1/identity.proto index 7558c1d4c..569c604d7 100644 --- a/test-fixtures/protos/google/showcase/v1beta1/identity.proto +++ b/test-fixtures/protos/google/showcase/v1beta1/identity.proto @@ -27,6 +27,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A simple identity service. service Identity { @@ -41,7 +42,8 @@ service Identity { body: "*" }; option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; + option (google.api.method_signature) = + "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; } // Retrieves the User with the given uri. @@ -56,7 +58,7 @@ service Identity { rpc UpdateUser(UpdateUserRequest) returns (User) { option (google.api.http) = { patch: "/v1beta1/{user.name=users/*}" - body: "*" + body: "user" }; } @@ -80,7 +82,7 @@ service Identity { message User { option (google.api.resource) = { type: "showcase.googleapis.com/User" - pattern: "users/{user_id}" + pattern: "users/{user}" }; // The resource name of the user. @@ -93,16 +95,14 @@ message User { string email = 3 [(google.api.field_behavior) = REQUIRED]; // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // The age of the use in years. + // The age of the user in years. optional int32 age = 6; // The height of the user in feet. @@ -117,7 +117,7 @@ message User { // Enables the receiving of notifications. The default is true if unset. // // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) + // Ordinarily, the default for a `bool` field should be false. --) optional bool enable_notifications = 9; } @@ -144,7 +144,7 @@ message UpdateUserRequest { // The user to update. User user = 1; - // The field mask to determine wich fields are to be updated. If empty, the + // The field mask to determine which fields are to be updated. If empty, the // server will assume all fields are to be updated. google.protobuf.FieldMask update_mask = 2; } diff --git a/test-fixtures/protos/google/showcase/v1beta1/messaging.proto b/test-fixtures/protos/google/showcase/v1beta1/messaging.proto index fb3bf51c5..62196dfce 100644 --- a/test-fixtures/protos/google/showcase/v1beta1/messaging.proto +++ b/test-fixtures/protos/google/showcase/v1beta1/messaging.proto @@ -29,6 +29,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A simple messaging service that implements chat rooms and profile posts. // @@ -60,7 +61,7 @@ service Messaging { rpc UpdateRoom(UpdateRoomRequest) returns (Room) { option (google.api.http) = { patch: "/v1beta1/{room.name=rooms/*}" - body: "*" + body: "room" }; } @@ -99,9 +100,7 @@ service Messaging { rpc GetBlurb(GetBlurbRequest) returns (Blurb) { option (google.api.http) = { get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - get: "/v1beta1/{name=users/*/profile/blurbs/*}" - } + additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } }; option (google.api.method_signature) = "name"; } @@ -110,10 +109,10 @@ service Messaging { rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { option (google.api.http) = { patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "*" + body: "blurb" additional_bindings: { patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "*" + body: "blurb" } }; } @@ -134,9 +133,7 @@ service Messaging { rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { option (google.api.http) = { get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { - get: "/v1beta1/{parent=users/*/profile}/blurbs" - } + additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } }; option (google.api.method_signature) = "parent"; } @@ -146,17 +143,17 @@ service Messaging { // contain an exact match of a queried word will be returned. rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { - post: "/v1beta1/{parent=rooms/-}/blurbs:search" + post: "/v1beta1/{parent=rooms/*}/blurbs:search" body: "*" additional_bindings: { - post: "/v1beta1/{parent=users/-/profile}/blurbs:search" + post: "/v1beta1/{parent=users/*/profile}/blurbs:search" } }; option (google.longrunning.operation_info) = { response_type: "SearchBlurbsResponse" metadata_type: "SearchBlurbsMetadata" }; - option (google.api.method_signature) = "query"; + option (google.api.method_signature) = "parent,query"; } // This returns a stream that emits the blurbs that are created for a @@ -196,7 +193,7 @@ service Messaging { message Room { option (google.api.resource) = { type: "showcase.googleapis.com/Room" - pattern: "rooms/{room_id}" + pattern: "rooms/{room}" }; // The resource name of the chat room. @@ -209,14 +206,12 @@ message Room { string description = 3; // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request message for the google.showcase.v1beta1.Messaging\CreateRoom @@ -242,7 +237,7 @@ message UpdateRoomRequest { // The room to update. Room room = 1; - // The field mask to determine wich fields are to be updated. If empty, the + // The field mask to determine which fields are to be updated. If empty, the // server will assume all fields are to be updated. google.protobuf.FieldMask update_mask = 2; } @@ -278,8 +273,8 @@ message ListRoomsResponse { // A token to retrieve next page of results. // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve the - // next page of results. + // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve + // the next page of results. string next_page_token = 2; } @@ -288,11 +283,10 @@ message ListRoomsResponse { message Blurb { option (google.api.resource) = { type: "showcase.googleapis.com/Blurb" - pattern: "rooms/{room_id}/blurbs/{blurb_id}" - pattern: "rooms/{room_id}/blurbs/legacy/{legacy_room_id}.{blurb_id}" - pattern: "user/{user_id}/profile/blurbs/{blurb_id}" - pattern: "user/{user_id}/profile/blurbs/legacy/{legacy_user_id}~{blurb_id}" - + pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" + pattern: "users/{user}/profile/blurbs/{blurb}" + pattern: "rooms/{room}/blurbs/{blurb}" + pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" }; // The resource name of the chat room. @@ -301,7 +295,8 @@ message Blurb { // The resource name of the blurb's author. string user = 2 [ (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED]; + (google.api.field_behavior) = REQUIRED + ]; oneof content { // The textual content of this blurb. @@ -312,24 +307,25 @@ message Blurb { } // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY - ]; + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. --) + // resource patterns. Ordinarily, non-slash separators are discouraged. + // --) oneof legacy_id { // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern `rooms/{room_id}/blurbs/{legacy_room_id}.{blurb_id}` + // the use of the compound resource pattern + // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` string legacy_room_id = 7; // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern `rooms/{room_id}/blurbs/{legacy_user_id}~{blurb_id}` + // the use of the compound resource pattern + // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` string legacy_user_id = 8; } } @@ -340,7 +336,8 @@ message CreateBlurbRequest { // The resource name of the chat room or user profile that this blurb will // be tied to. string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; @@ -384,11 +381,11 @@ message DeleteBlurbRequest { message ListBlurbsRequest { // The resource name of the requested room or profile whos blurbs to list. string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; - // The maximum number of blurbs to return. Server may return fewer // blurbs than requested. If unspecified, server will pick an appropriate // default. @@ -422,8 +419,8 @@ message SearchBlurbsRequest { // The rooms or profiles to search. If unset, `SearchBlurbs` will search all // rooms and all profiles. - string parent = 2 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb"]; + string parent = 2 [(google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb"]; // The maximum number of blurbs return. Server may return fewer // blurbs than requested. If unspecified, server will pick an appropriate @@ -462,14 +459,14 @@ message SearchBlurbsResponse { message StreamBlurbsRequest { // The resource name of a chat room or user profile whose blurbs to stream. string name = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb", + (google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb", (google.api.field_behavior) = REQUIRED ]; // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 [ - (google.api.field_behavior) = REQUIRED - ]; + google.protobuf.Timestamp expire_time = 2 + [(google.api.field_behavior) = REQUIRED]; } // The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs @@ -508,8 +505,8 @@ message SendBlurbsResponse { message ConnectRequest { message ConnectConfig { // The room or profile to follow and create messages for. - string parent = 1 [ - (google.api.resource_reference).child_type = "showcase.googleapis.com/Blurb"]; + string parent = 1 [(google.api.resource_reference).child_type = + "showcase.googleapis.com/Blurb"]; } oneof request { diff --git a/test-fixtures/protos/google/showcase/v1beta1/sequence.proto b/test-fixtures/protos/google/showcase/v1beta1/sequence.proto new file mode 100644 index 000000000..26158fdd8 --- /dev/null +++ b/test-fixtures/protos/google/showcase/v1beta1/sequence.proto @@ -0,0 +1,136 @@ +// Copyright 2020 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/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.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; +option ruby_package = "Google::Showcase::V1beta1"; + +service SequenceService { + // This service is meant to only run locally on the port 7469 (keypad digits + // for "show"). + option (google.api.default_host) = "localhost:7469"; + + // Creates a sequence. + rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { + option (google.api.http) = { + post: "/v1beta1/sequences" + body: "sequence" + }; + option (google.api.method_signature) = "sequence"; + }; + + // Retrieves a sequence. + rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { + option (google.api.http) = { + get: "/v1beta1/{name=sequences/*/sequenceReport}" + }; + option (google.api.method_signature) = "name"; + }; + + // Attempts a sequence. + rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1beta1/{name=sequences/*}" + body: "*" + }; + option (google.api.method_signature) = "name"; + }; +} + +message Sequence { + option (google.api.resource) = { + type: "showcase.googleapis.com/Sequence" + pattern: "sequences/{sequence}" + }; + + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A server response to an RPC Attempt in a sequence. + message Response { + // The status to return for an individual attempt. + google.rpc.Status status = 1; + + // The amount of time to delay sending the response. + google.protobuf.Duration delay = 2; + } + + // Sequence of responses to return in order for each attempt. If empty, the + // default response is an immediate OK. + repeated Response responses = 2; +} + +message SequenceReport { + option (google.api.resource) = { + type: "showcase.googleapis.com/SequenceReport" + pattern: "sequences/{sequence}/sequenceReport" + }; + + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Contains metrics on individual RPC Attempts in a sequence. + message Attempt { + // The attempt number - starting at 0. + int32 attempt_number = 1; + + // The deadline dictated by the attempt to the server. + google.protobuf.Timestamp attempt_deadline = 2; + + // The time that the server responded to the RPC attempt. Used for + // calculating attempt_delay. + google.protobuf.Timestamp response_time = 3; + + // The server perceived delay between sending the last response and + // receiving this attempt. Used for validating attempt delay backoff. + google.protobuf.Duration attempt_delay = 4; + + // The status returned to the attempt. + google.rpc.Status status = 5; + } + + // The set of RPC attempts received by the server for a Sequence. + repeated Attempt attempts = 2; +} + +message CreateSequenceRequest { + Sequence sequence = 1; +} + +message AttemptSequenceRequest { + string name = 1 [ + (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", + (google.api.field_behavior) = REQUIRED + ]; +} + +message GetSequenceReportRequest { + string name = 1 [ + (google.api.resource_reference).type = + "showcase.googleapis.com/SequenceReport", + (google.api.field_behavior) = REQUIRED + ]; +} diff --git a/test-fixtures/protos/google/showcase/v1beta1/testing.proto b/test-fixtures/protos/google/showcase/v1beta1/testing.proto index b5d9d7283..56e85e97e 100644 --- a/test-fixtures/protos/google/showcase/v1beta1/testing.proto +++ b/test-fixtures/protos/google/showcase/v1beta1/testing.proto @@ -24,6 +24,7 @@ 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; +option ruby_package = "Google::Showcase::V1beta1"; // A service to facilitate running discrete sets of tests // against Showcase.