From 2369c8b3691f5be9771718307493918daf08ea17 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 20 Apr 2020 13:59:43 -0700 Subject: [PATCH] build: use codecov's action, now that it's authless (#584) --- .../cloud/speech/v1p1beta1/cloud_speech.proto | 75 +- .../cloud/speech/v1p1beta1/resource.proto | 129 + .../google-cloud-speech/protos/protos.d.ts | 745 ++++ packages/google-cloud-speech/protos/protos.js | 3047 +++++++++++++---- .../google-cloud-speech/protos/protos.json | 184 +- .../src/v1p1beta1/speech_client.ts | 120 + .../src/v1p1beta1/speech_proto_list.json | 3 +- packages/google-cloud-speech/synth.metadata | 19 +- .../system-test/install.ts | 4 +- .../test/gapic_speech_v1p1beta1.ts | 130 + 10 files changed, 3836 insertions(+), 620 deletions(-) create mode 100644 packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/resource.proto diff --git a/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto b/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto index 7718b0eb3cf..7bb12866b63 100644 --- a/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto +++ b/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/cloud_speech.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// 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. @@ -11,7 +11,6 @@ // 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"; @@ -20,6 +19,8 @@ package google.cloud.speech.v1p1beta1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/speech/v1p1beta1/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; @@ -36,7 +37,8 @@ option objc_class_prefix = "GCS"; // Service that implements Google Cloud Speech API. service Speech { option (google.api.default_host) = "speech.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Performs synchronous speech recognition: receive results after all audio // has been sent and processed. @@ -54,7 +56,8 @@ service Speech { // a `LongRunningRecognizeResponse` message. // For more information on asynchronous speech recognition, see the // [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). - rpc LongRunningRecognize(LongRunningRecognizeRequest) returns (google.longrunning.Operation) { + rpc LongRunningRecognize(LongRunningRecognizeRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1p1beta1/speech:longrunningrecognize" body: "*" @@ -68,8 +71,8 @@ service Speech { // Performs bidirectional streaming speech recognition: receive results while // sending audio. This method is only available via the gRPC API (not REST). - rpc StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse) { - } + rpc StreamingRecognize(stream StreamingRecognizeRequest) + returns (stream StreamingRecognizeResponse) {} } // The top-level message sent by the client for the `Recognize` method. @@ -169,7 +172,8 @@ message RecognitionConfig { // an `AudioEncoding` when you send send `FLAC` or `WAV` audio, the // encoding configuration must match the encoding described in the audio // header; otherwise the request returns an - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error code. + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error + // code. enum AudioEncoding { // Not specified. ENCODING_UNSPECIFIED = 0; @@ -215,14 +219,15 @@ message RecognitionConfig { SPEEX_WITH_HEADER_BYTE = 7; // MP3 audio. Support all standard MP3 bitrates (which range from 32-320 - // kbps). When using this encoding, `sample_rate_hertz` can be optionally - // unset if not known. + // kbps). When using this encoding, `sample_rate_hertz` has to match the + // sample rate of the file being used. MP3 = 8; } // Encoding of audio data sent in all `RecognitionAudio` messages. // This field is optional for `FLAC` and `WAV` audio files and required - // for all other audio formats. For details, see [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. + // for all other audio formats. For details, see + // [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. AudioEncoding encoding = 1; // Sample rate in Hertz of the audio data sent in all @@ -231,7 +236,8 @@ message RecognitionConfig { // source to 16000 Hz. If that's not possible, use the native sample rate of // the audio source (instead of re-sampling). // This field is optional for FLAC and WAV audio files, but is - // required for all other audio formats. For details, see [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. + // required for all other audio formats. For details, see + // [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. int32 sample_rate_hertz = 2; // The number of channels in the input audio data. @@ -289,6 +295,13 @@ message RecognitionConfig { // won't be filtered out. bool profanity_filter = 5; + // Speech adaptation configuration improves the accuracy of speech + // recognition. When speech adaptation is set it supersedes the + // `speech_contexts` field. For more information, see the [speech + // adaptation](https://cloud.google.com/speech-to-text/docs/context-strength) + // documentation. + SpeechAdaptation adaptation = 20; + // Array of [SpeechContext][google.cloud.speech.v1p1beta1.SpeechContext]. // A means to provide context to assist the speech recognition. For more // information, see @@ -311,9 +324,6 @@ message RecognitionConfig { // This feature is only available in select languages. Setting this for // requests in other languages has no effect at all. // The default 'false' value does not add punctuation to result hypotheses. - // Note: This is currently offered as an experimental service, complimentary - // to all users. In the future this may be exclusively available as a - // premium feature. bool enable_automatic_punctuation = 11; // If 'true', enables speaker detection for each recognized word in @@ -401,6 +411,10 @@ message SpeakerDiarizationConfig { // flexibility by allowing the system to automatically determine the correct // number of speakers. If not set, the default value is 6. int32 max_speaker_count = 3; + + // Output only. Unused. + int32 speaker_tag = 5 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; } // Description of audio data to be recognized. @@ -564,8 +578,8 @@ message SpeechContext { // Contains audio data in the encoding specified in the `RecognitionConfig`. // Either `content` or `uri` must be supplied. Supplying both or neither -// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See -// [content limits](https://cloud.google.com/speech-to-text/quotas#content). +// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. +// See [content limits](https://cloud.google.com/speech-to-text/quotas#content). message RecognitionAudio { // The audio source, which is either inline content or a Google Cloud // Storage uri. @@ -580,8 +594,9 @@ message RecognitionAudio { // Currently, only Google Cloud Storage URIs are // supported, which must be specified in the following format: // `gs://bucket_name/object_name` (other URI formats return - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - // [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). + // For more information, see [Request + // URIs](https://cloud.google.com/storage/docs/reference-uris). string uri = 2; } } @@ -619,6 +634,10 @@ message LongRunningRecognizeMetadata { // Time of the most recent processing update. google.protobuf.Timestamp last_update_time = 3; + + // The URI of the audio file being transcribed. Empty if the audio was sent + // as byte content. + string uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; } // `StreamingRecognizeResponse` is the only message returned to the client by @@ -732,10 +751,10 @@ message StreamingRecognitionResult { // For audio_channel_count = N, its output values can range from '1' to 'N'. int32 channel_tag = 5; - // The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag - // of the language in this result. This language code was detected to have - // the most likelihood of being spoken in the audio. - string language_code = 6; + // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag of the language in this result. This language code was + // detected to have the most likelihood of being spoken in the audio. + string language_code = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; } // A speech recognition result corresponding to a portion of the audio. @@ -751,10 +770,10 @@ message SpeechRecognitionResult { // For audio_channel_count = N, its output values can range from '1' to 'N'. int32 channel_tag = 2; - // The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag - // of the language in this result. This language code was detected to have - // the most likelihood of being spoken in the audio. - string language_code = 5; + // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag of the language in this result. This language code was + // detected to have the most likelihood of being spoken in the audio. + string language_code = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Alternative hypotheses (a.k.a. n-best list). @@ -807,10 +826,10 @@ message WordInfo { // The default of 0.0 is a sentinel value indicating `confidence` was not set. float confidence = 4; - // A distinct integer value is assigned for every speaker within + // Output only. A distinct integer value is assigned for every speaker within // the audio. This field specifies which one of those speakers was detected to // have spoken this word. Value ranges from '1' to diarization_speaker_count. // speaker_tag is set if enable_speaker_diarization = 'true' and only in the // top alternative. - int32 speaker_tag = 5; + int32 speaker_tag = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/resource.proto b/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/resource.proto new file mode 100644 index 00000000000..5bb379ff150 --- /dev/null +++ b/packages/google-cloud-speech/protos/google/cloud/speech/v1p1beta1/resource.proto @@ -0,0 +1,129 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.speech.v1p1beta1; + +import "google/api/annotations.proto"; +import "google/api/resource.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech"; +option java_multiple_files = true; +option java_outer_classname = "SpeechResourceProto"; +option java_package = "com.google.cloud.speech.v1p1beta1"; +option objc_class_prefix = "GCS"; + +// A set of words or phrases that represents a common concept likely to appear +// in your audio, for example a list of passenger ship names. CustomClass items +// can be substituted into placeholders that you set in PhraseSet phrases. +message CustomClass { + option (google.api.resource) = { + type: "speech.googleapis.com/CustomClass" + pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}" + }; + + // An item of the class. + message ClassItem { + // The class item's value. + string value = 1; + } + + // The resource name of the custom class. + string name = 1; + + // If this custom class is a resource, the custom_class_id is the resource id + // of the CustomClass. + string custom_class_id = 2; + + // A collection of class items. + repeated ClassItem items = 3; +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. +message PhraseSet { + option (google.api.resource) = { + type: "speech.googleapis.com/PhraseSet" + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" + }; + + // A phrases containing words and phrase "hints" so that + // the speech recognition is more likely to recognize them. This can be used + // to improve the accuracy for specific words and phrases, for example, if + // specific commands are typically spoken by the user. This can also be used + // to add additional words to the vocabulary of the recognizer. See + // [usage limits](https://cloud.google.com/speech-to-text/quotas#content). + // + // List items can also include pre-built or custom classes containing groups + // of words that represent common concepts that occur in natural language. For + // example, rather than providing a phrase hint for every month of the + // year (e.g. "i was born in january", "i was born in febuary", ...), use the + // pre-built `$MONTH` class improves the likelihood of correctly transcribing + // audio that includes months (e.g. "i was born in $month"). + // To refer to pre-built classes, use the class' symbol prepended with `$` + // e.g. `$MONTH`. To refer to custom classes that were defined inline in the + // request, set the class's `custom_class_id` to a string unique to all class + // resources and inline classes. Then use the class' id wrapped in $`{...}` + // e.g. "${my-months}". To refer to custom classes resources, use the class' + // id wrapped in `${}` (e.g. `${my-months}`). + message Phrase { + // The phrase itself. + string value = 1; + + // Hint Boost. Overrides the boost set at the phrase set level. + // Positive value will increase the probability that a specific phrase will + // be recognized over other similar sounding phrases. The higher the boost, + // the higher the chance of false positive recognition as well. Negative + // boost values would correspond to anti-biasing. Anti-biasing is not + // enabled, so negative boost will simply be ignored. Though `boost` can + // accept a wide range of positive values, most use cases are best served + // with values between 0 and 20. We recommend using a binary search approach + // to finding the optimal value for your use case. Speech recognition + // will skip PhraseSets with a boost value of 0. + float boost = 2; + } + + // The resource name of the phrase set. + string name = 1; + + // A list of word and phrases. + repeated Phrase phrases = 2; + + // Hint Boost. Positive value will increase the probability that a specific + // phrase will be recognized over other similar sounding phrases. The higher + // the boost, the higher the chance of false positive recognition as well. + // Negative boost values would correspond to anti-biasing. Anti-biasing is not + // enabled, so negative boost will simply be ignored. Though `boost` can + // accept a wide range of positive values, most use cases are best served with + // values between 0 (exclusive) and 20. We recommend using a binary search + // approach to finding the optimal value for your use case. Speech recognition + // will skip PhraseSets with a boost value of 0. + float boost = 4; +} + +// Speech adaptation configuration. +message SpeechAdaptation { + // A collection of phrase sets. To specify the hints inline, leave the + // phrase set's `name` blank and fill in the rest of its fields. Any + // phrase set can use any custom class. + repeated PhraseSet phrase_sets = 1; + + // A collection of custom classes. To specify the classes inline, leave the + // class' `name` blank and fill in the rest of its fields, giving it a unique + // `custom_class_id`. Refer to the inline defined class in phrase hints by its + // `custom_class_id`. + repeated CustomClass custom_classes = 2; +} diff --git a/packages/google-cloud-speech/protos/protos.d.ts b/packages/google-cloud-speech/protos/protos.d.ts index d2f3da3888f..880d2c2585c 100644 --- a/packages/google-cloud-speech/protos/protos.d.ts +++ b/packages/google-cloud-speech/protos/protos.d.ts @@ -2490,6 +2490,9 @@ export namespace google { /** RecognitionConfig profanityFilter */ profanityFilter?: (boolean|null); + /** RecognitionConfig adaptation */ + adaptation?: (google.cloud.speech.v1p1beta1.ISpeechAdaptation|null); + /** RecognitionConfig speechContexts */ speechContexts?: (google.cloud.speech.v1p1beta1.ISpeechContext[]|null); @@ -2554,6 +2557,9 @@ export namespace google { /** RecognitionConfig profanityFilter. */ public profanityFilter: boolean; + /** RecognitionConfig adaptation. */ + public adaptation?: (google.cloud.speech.v1p1beta1.ISpeechAdaptation|null); + /** RecognitionConfig speechContexts. */ public speechContexts: google.cloud.speech.v1p1beta1.ISpeechContext[]; @@ -2682,6 +2688,9 @@ export namespace google { /** SpeakerDiarizationConfig maxSpeakerCount */ maxSpeakerCount?: (number|null); + + /** SpeakerDiarizationConfig speakerTag */ + speakerTag?: (number|null); } /** Represents a SpeakerDiarizationConfig. */ @@ -2702,6 +2711,9 @@ export namespace google { /** SpeakerDiarizationConfig maxSpeakerCount. */ public maxSpeakerCount: number; + /** SpeakerDiarizationConfig speakerTag. */ + public speakerTag: number; + /** * Creates a new SpeakerDiarizationConfig instance using the specified properties. * @param [properties] Properties to set @@ -3339,6 +3351,9 @@ export namespace google { /** LongRunningRecognizeMetadata lastUpdateTime */ lastUpdateTime?: (google.protobuf.ITimestamp|null); + + /** LongRunningRecognizeMetadata uri */ + uri?: (string|null); } /** Represents a LongRunningRecognizeMetadata. */ @@ -3359,6 +3374,9 @@ export namespace google { /** LongRunningRecognizeMetadata lastUpdateTime. */ public lastUpdateTime?: (google.protobuf.ITimestamp|null); + /** LongRunningRecognizeMetadata uri. */ + public uri: string; + /** * Creates a new LongRunningRecognizeMetadata instance using the specified properties. * @param [properties] Properties to set @@ -3978,6 +3996,498 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** Properties of a CustomClass. */ + interface ICustomClass { + + /** CustomClass name */ + name?: (string|null); + + /** CustomClass customClassId */ + customClassId?: (string|null); + + /** CustomClass items */ + items?: (google.cloud.speech.v1p1beta1.CustomClass.IClassItem[]|null); + } + + /** Represents a CustomClass. */ + class CustomClass implements ICustomClass { + + /** + * Constructs a new CustomClass. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1p1beta1.ICustomClass); + + /** CustomClass name. */ + public name: string; + + /** CustomClass customClassId. */ + public customClassId: string; + + /** CustomClass items. */ + public items: google.cloud.speech.v1p1beta1.CustomClass.IClassItem[]; + + /** + * Creates a new CustomClass instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomClass instance + */ + public static create(properties?: google.cloud.speech.v1p1beta1.ICustomClass): google.cloud.speech.v1p1beta1.CustomClass; + + /** + * Encodes the specified CustomClass message. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.verify|verify} messages. + * @param message CustomClass message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1p1beta1.ICustomClass, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomClass message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.verify|verify} messages. + * @param message CustomClass message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1p1beta1.ICustomClass, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomClass message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomClass + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1p1beta1.CustomClass; + + /** + * Decodes a CustomClass message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomClass + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1p1beta1.CustomClass; + + /** + * Verifies a CustomClass message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomClass message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomClass + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1p1beta1.CustomClass; + + /** + * Creates a plain object from a CustomClass message. Also converts values to other types if specified. + * @param message CustomClass + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1p1beta1.CustomClass, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomClass to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace CustomClass { + + /** Properties of a ClassItem. */ + interface IClassItem { + + /** ClassItem value */ + value?: (string|null); + } + + /** Represents a ClassItem. */ + class ClassItem implements IClassItem { + + /** + * Constructs a new ClassItem. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1p1beta1.CustomClass.IClassItem); + + /** ClassItem value. */ + public value: string; + + /** + * Creates a new ClassItem instance using the specified properties. + * @param [properties] Properties to set + * @returns ClassItem instance + */ + public static create(properties?: google.cloud.speech.v1p1beta1.CustomClass.IClassItem): google.cloud.speech.v1p1beta1.CustomClass.ClassItem; + + /** + * Encodes the specified ClassItem message. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.ClassItem.verify|verify} messages. + * @param message ClassItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1p1beta1.CustomClass.IClassItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClassItem message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.ClassItem.verify|verify} messages. + * @param message ClassItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1p1beta1.CustomClass.IClassItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClassItem message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClassItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1p1beta1.CustomClass.ClassItem; + + /** + * Decodes a ClassItem message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClassItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1p1beta1.CustomClass.ClassItem; + + /** + * Verifies a ClassItem message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClassItem message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClassItem + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1p1beta1.CustomClass.ClassItem; + + /** + * Creates a plain object from a ClassItem message. Also converts values to other types if specified. + * @param message ClassItem + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1p1beta1.CustomClass.ClassItem, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClassItem to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PhraseSet. */ + interface IPhraseSet { + + /** PhraseSet name */ + name?: (string|null); + + /** PhraseSet phrases */ + phrases?: (google.cloud.speech.v1p1beta1.PhraseSet.IPhrase[]|null); + + /** PhraseSet boost */ + boost?: (number|null); + } + + /** Represents a PhraseSet. */ + class PhraseSet implements IPhraseSet { + + /** + * Constructs a new PhraseSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1p1beta1.IPhraseSet); + + /** PhraseSet name. */ + public name: string; + + /** PhraseSet phrases. */ + public phrases: google.cloud.speech.v1p1beta1.PhraseSet.IPhrase[]; + + /** PhraseSet boost. */ + public boost: number; + + /** + * Creates a new PhraseSet instance using the specified properties. + * @param [properties] Properties to set + * @returns PhraseSet instance + */ + public static create(properties?: google.cloud.speech.v1p1beta1.IPhraseSet): google.cloud.speech.v1p1beta1.PhraseSet; + + /** + * Encodes the specified PhraseSet message. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.verify|verify} messages. + * @param message PhraseSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1p1beta1.IPhraseSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PhraseSet message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.verify|verify} messages. + * @param message PhraseSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1p1beta1.IPhraseSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PhraseSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PhraseSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1p1beta1.PhraseSet; + + /** + * Decodes a PhraseSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PhraseSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1p1beta1.PhraseSet; + + /** + * Verifies a PhraseSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PhraseSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PhraseSet + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1p1beta1.PhraseSet; + + /** + * Creates a plain object from a PhraseSet message. Also converts values to other types if specified. + * @param message PhraseSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1p1beta1.PhraseSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PhraseSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PhraseSet { + + /** Properties of a Phrase. */ + interface IPhrase { + + /** Phrase value */ + value?: (string|null); + + /** Phrase boost */ + boost?: (number|null); + } + + /** Represents a Phrase. */ + class Phrase implements IPhrase { + + /** + * Constructs a new Phrase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1p1beta1.PhraseSet.IPhrase); + + /** Phrase value. */ + public value: string; + + /** Phrase boost. */ + public boost: number; + + /** + * Creates a new Phrase instance using the specified properties. + * @param [properties] Properties to set + * @returns Phrase instance + */ + public static create(properties?: google.cloud.speech.v1p1beta1.PhraseSet.IPhrase): google.cloud.speech.v1p1beta1.PhraseSet.Phrase; + + /** + * Encodes the specified Phrase message. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.Phrase.verify|verify} messages. + * @param message Phrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1p1beta1.PhraseSet.IPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Phrase message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.Phrase.verify|verify} messages. + * @param message Phrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1p1beta1.PhraseSet.IPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Phrase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Phrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1p1beta1.PhraseSet.Phrase; + + /** + * Decodes a Phrase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Phrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1p1beta1.PhraseSet.Phrase; + + /** + * Verifies a Phrase message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Phrase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Phrase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1p1beta1.PhraseSet.Phrase; + + /** + * Creates a plain object from a Phrase message. Also converts values to other types if specified. + * @param message Phrase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1p1beta1.PhraseSet.Phrase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Phrase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SpeechAdaptation. */ + interface ISpeechAdaptation { + + /** SpeechAdaptation phraseSets */ + phraseSets?: (google.cloud.speech.v1p1beta1.IPhraseSet[]|null); + + /** SpeechAdaptation customClasses */ + customClasses?: (google.cloud.speech.v1p1beta1.ICustomClass[]|null); + } + + /** Represents a SpeechAdaptation. */ + class SpeechAdaptation implements ISpeechAdaptation { + + /** + * Constructs a new SpeechAdaptation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.speech.v1p1beta1.ISpeechAdaptation); + + /** SpeechAdaptation phraseSets. */ + public phraseSets: google.cloud.speech.v1p1beta1.IPhraseSet[]; + + /** SpeechAdaptation customClasses. */ + public customClasses: google.cloud.speech.v1p1beta1.ICustomClass[]; + + /** + * Creates a new SpeechAdaptation instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechAdaptation instance + */ + public static create(properties?: google.cloud.speech.v1p1beta1.ISpeechAdaptation): google.cloud.speech.v1p1beta1.SpeechAdaptation; + + /** + * Encodes the specified SpeechAdaptation message. Does not implicitly {@link google.cloud.speech.v1p1beta1.SpeechAdaptation.verify|verify} messages. + * @param message SpeechAdaptation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.speech.v1p1beta1.ISpeechAdaptation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechAdaptation message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.SpeechAdaptation.verify|verify} messages. + * @param message SpeechAdaptation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.speech.v1p1beta1.ISpeechAdaptation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechAdaptation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechAdaptation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.speech.v1p1beta1.SpeechAdaptation; + + /** + * Decodes a SpeechAdaptation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechAdaptation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.speech.v1p1beta1.SpeechAdaptation; + + /** + * Verifies a SpeechAdaptation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechAdaptation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechAdaptation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.speech.v1p1beta1.SpeechAdaptation; + + /** + * Creates a plain object from a SpeechAdaptation message. Also converts values to other types if specified. + * @param message SpeechAdaptation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.speech.v1p1beta1.SpeechAdaptation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechAdaptation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } } } @@ -4333,6 +4843,232 @@ export namespace google { INPUT_ONLY = 4, IMMUTABLE = 5 } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Namespace protobuf. */ @@ -5893,6 +6629,9 @@ export namespace google { /** FileOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); } /** Represents a FileOptions. */ @@ -6065,6 +6804,9 @@ export namespace google { /** MessageOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); } /** Represents a MessageOptions. */ @@ -6188,6 +6930,9 @@ export namespace google { /** FieldOptions .google.api.fieldBehavior */ ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); } /** Represents a FieldOptions. */ diff --git a/packages/google-cloud-speech/protos/protos.js b/packages/google-cloud-speech/protos/protos.js index a902716b6a9..124e117e5a4 100644 --- a/packages/google-cloud-speech/protos/protos.js +++ b/packages/google-cloud-speech/protos/protos.js @@ -6039,6 +6039,7 @@ * @property {Array.|null} [alternativeLanguageCodes] RecognitionConfig alternativeLanguageCodes * @property {number|null} [maxAlternatives] RecognitionConfig maxAlternatives * @property {boolean|null} [profanityFilter] RecognitionConfig profanityFilter + * @property {google.cloud.speech.v1p1beta1.ISpeechAdaptation|null} [adaptation] RecognitionConfig adaptation * @property {Array.|null} [speechContexts] RecognitionConfig speechContexts * @property {boolean|null} [enableWordTimeOffsets] RecognitionConfig enableWordTimeOffsets * @property {boolean|null} [enableWordConfidence] RecognitionConfig enableWordConfidence @@ -6132,6 +6133,14 @@ */ RecognitionConfig.prototype.profanityFilter = false; + /** + * RecognitionConfig adaptation. + * @member {google.cloud.speech.v1p1beta1.ISpeechAdaptation|null|undefined} adaptation + * @memberof google.cloud.speech.v1p1beta1.RecognitionConfig + * @instance + */ + RecognitionConfig.prototype.adaptation = null; + /** * RecognitionConfig speechContexts. * @member {Array.} speechContexts @@ -6274,6 +6283,8 @@ writer.uint32(/* id 18, wireType 2 =*/146).string(message.alternativeLanguageCodes[i]); if (message.diarizationConfig != null && message.hasOwnProperty("diarizationConfig")) $root.google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig.encode(message.diarizationConfig, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.adaptation != null && message.hasOwnProperty("adaptation")) + $root.google.cloud.speech.v1p1beta1.SpeechAdaptation.encode(message.adaptation, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); return writer; }; @@ -6334,6 +6345,9 @@ case 5: message.profanityFilter = reader.bool(); break; + case 20: + message.adaptation = $root.google.cloud.speech.v1p1beta1.SpeechAdaptation.decode(reader, reader.uint32()); + break; case 6: if (!(message.speechContexts && message.speechContexts.length)) message.speechContexts = []; @@ -6441,6 +6455,11 @@ if (message.profanityFilter != null && message.hasOwnProperty("profanityFilter")) if (typeof message.profanityFilter !== "boolean") return "profanityFilter: boolean expected"; + if (message.adaptation != null && message.hasOwnProperty("adaptation")) { + var error = $root.google.cloud.speech.v1p1beta1.SpeechAdaptation.verify(message.adaptation); + if (error) + return "adaptation." + error; + } if (message.speechContexts != null && message.hasOwnProperty("speechContexts")) { if (!Array.isArray(message.speechContexts)) return "speechContexts: array expected"; @@ -6553,6 +6572,11 @@ message.maxAlternatives = object.maxAlternatives | 0; if (object.profanityFilter != null) message.profanityFilter = Boolean(object.profanityFilter); + if (object.adaptation != null) { + if (typeof object.adaptation !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.RecognitionConfig.adaptation: object expected"); + message.adaptation = $root.google.cloud.speech.v1p1beta1.SpeechAdaptation.fromObject(object.adaptation); + } if (object.speechContexts) { if (!Array.isArray(object.speechContexts)) throw TypeError(".google.cloud.speech.v1p1beta1.RecognitionConfig.speechContexts: array expected"); @@ -6624,6 +6648,7 @@ object.enableSpeakerDiarization = false; object.diarizationSpeakerCount = 0; object.diarizationConfig = null; + object.adaptation = null; } if (message.encoding != null && message.hasOwnProperty("encoding")) object.encoding = options.enums === String ? $root.google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding[message.encoding] : message.encoding; @@ -6667,6 +6692,8 @@ } if (message.diarizationConfig != null && message.hasOwnProperty("diarizationConfig")) object.diarizationConfig = $root.google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig.toObject(message.diarizationConfig, options); + if (message.adaptation != null && message.hasOwnProperty("adaptation")) + object.adaptation = $root.google.cloud.speech.v1p1beta1.SpeechAdaptation.toObject(message.adaptation, options); return object; }; @@ -6721,6 +6748,7 @@ * @property {boolean|null} [enableSpeakerDiarization] SpeakerDiarizationConfig enableSpeakerDiarization * @property {number|null} [minSpeakerCount] SpeakerDiarizationConfig minSpeakerCount * @property {number|null} [maxSpeakerCount] SpeakerDiarizationConfig maxSpeakerCount + * @property {number|null} [speakerTag] SpeakerDiarizationConfig speakerTag */ /** @@ -6762,6 +6790,14 @@ */ SpeakerDiarizationConfig.prototype.maxSpeakerCount = 0; + /** + * SpeakerDiarizationConfig speakerTag. + * @member {number} speakerTag + * @memberof google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig + * @instance + */ + SpeakerDiarizationConfig.prototype.speakerTag = 0; + /** * Creates a new SpeakerDiarizationConfig instance using the specified properties. * @function create @@ -6792,6 +6828,8 @@ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.minSpeakerCount); if (message.maxSpeakerCount != null && message.hasOwnProperty("maxSpeakerCount")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxSpeakerCount); + if (message.speakerTag != null && message.hasOwnProperty("speakerTag")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.speakerTag); return writer; }; @@ -6835,6 +6873,9 @@ case 3: message.maxSpeakerCount = reader.int32(); break; + case 5: + message.speakerTag = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -6879,6 +6920,9 @@ if (message.maxSpeakerCount != null && message.hasOwnProperty("maxSpeakerCount")) if (!$util.isInteger(message.maxSpeakerCount)) return "maxSpeakerCount: integer expected"; + if (message.speakerTag != null && message.hasOwnProperty("speakerTag")) + if (!$util.isInteger(message.speakerTag)) + return "speakerTag: integer expected"; return null; }; @@ -6900,6 +6944,8 @@ message.minSpeakerCount = object.minSpeakerCount | 0; if (object.maxSpeakerCount != null) message.maxSpeakerCount = object.maxSpeakerCount | 0; + if (object.speakerTag != null) + message.speakerTag = object.speakerTag | 0; return message; }; @@ -6920,6 +6966,7 @@ object.enableSpeakerDiarization = false; object.minSpeakerCount = 0; object.maxSpeakerCount = 0; + object.speakerTag = 0; } if (message.enableSpeakerDiarization != null && message.hasOwnProperty("enableSpeakerDiarization")) object.enableSpeakerDiarization = message.enableSpeakerDiarization; @@ -6927,6 +6974,8 @@ object.minSpeakerCount = message.minSpeakerCount; if (message.maxSpeakerCount != null && message.hasOwnProperty("maxSpeakerCount")) object.maxSpeakerCount = message.maxSpeakerCount; + if (message.speakerTag != null && message.hasOwnProperty("speakerTag")) + object.speakerTag = message.speakerTag; return object; }; @@ -8422,6 +8471,7 @@ * @property {number|null} [progressPercent] LongRunningRecognizeMetadata progressPercent * @property {google.protobuf.ITimestamp|null} [startTime] LongRunningRecognizeMetadata startTime * @property {google.protobuf.ITimestamp|null} [lastUpdateTime] LongRunningRecognizeMetadata lastUpdateTime + * @property {string|null} [uri] LongRunningRecognizeMetadata uri */ /** @@ -8463,6 +8513,14 @@ */ LongRunningRecognizeMetadata.prototype.lastUpdateTime = null; + /** + * LongRunningRecognizeMetadata uri. + * @member {string} uri + * @memberof google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata + * @instance + */ + LongRunningRecognizeMetadata.prototype.uri = ""; + /** * Creates a new LongRunningRecognizeMetadata instance using the specified properties. * @function create @@ -8493,6 +8551,8 @@ $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.lastUpdateTime != null && message.hasOwnProperty("lastUpdateTime")) $root.google.protobuf.Timestamp.encode(message.lastUpdateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.uri); return writer; }; @@ -8536,6 +8596,9 @@ case 3: message.lastUpdateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; + case 4: + message.uri = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -8584,6 +8647,9 @@ if (error) return "lastUpdateTime." + error; } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; @@ -8611,6 +8677,8 @@ throw TypeError(".google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata.lastUpdateTime: object expected"); message.lastUpdateTime = $root.google.protobuf.Timestamp.fromObject(object.lastUpdateTime); } + if (object.uri != null) + message.uri = String(object.uri); return message; }; @@ -8631,6 +8699,7 @@ object.progressPercent = 0; object.startTime = null; object.lastUpdateTime = null; + object.uri = ""; } if (message.progressPercent != null && message.hasOwnProperty("progressPercent")) object.progressPercent = message.progressPercent; @@ -8638,6 +8707,8 @@ object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); if (message.lastUpdateTime != null && message.hasOwnProperty("lastUpdateTime")) object.lastUpdateTime = $root.google.protobuf.Timestamp.toObject(message.lastUpdateTime, options); + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; @@ -10060,136 +10131,1983 @@ return WordInfo; })(); - return v1p1beta1; - })(); + v1p1beta1.CustomClass = (function() { - return speech; - })(); + /** + * Properties of a CustomClass. + * @memberof google.cloud.speech.v1p1beta1 + * @interface ICustomClass + * @property {string|null} [name] CustomClass name + * @property {string|null} [customClassId] CustomClass customClassId + * @property {Array.|null} [items] CustomClass items + */ - return cloud; - })(); + /** + * Constructs a new CustomClass. + * @memberof google.cloud.speech.v1p1beta1 + * @classdesc Represents a CustomClass. + * @implements ICustomClass + * @constructor + * @param {google.cloud.speech.v1p1beta1.ICustomClass=} [properties] Properties to set + */ + function CustomClass(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - google.api = (function() { + /** + * CustomClass name. + * @member {string} name + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @instance + */ + CustomClass.prototype.name = ""; - /** - * Namespace api. - * @memberof google - * @namespace - */ - var api = {}; + /** + * CustomClass customClassId. + * @member {string} customClassId + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @instance + */ + CustomClass.prototype.customClassId = ""; - api.Http = (function() { + /** + * CustomClass items. + * @member {Array.} items + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @instance + */ + CustomClass.prototype.items = $util.emptyArray; - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion - */ + /** + * Creates a new CustomClass instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {google.cloud.speech.v1p1beta1.ICustomClass=} [properties] Properties to set + * @returns {google.cloud.speech.v1p1beta1.CustomClass} CustomClass instance + */ + CustomClass.create = function create(properties) { + return new CustomClass(properties); + }; - /** - * Constructs a new Http. - * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp - * @constructor - * @param {google.api.IHttp=} [properties] Properties to set - */ - function Http(properties) { - this.rules = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Encodes the specified CustomClass message. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {google.cloud.speech.v1p1beta1.ICustomClass} message CustomClass message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomClass.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.customClassId != null && message.hasOwnProperty("customClassId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.customClassId); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem.encode(message.items[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; + /** + * Encodes the specified CustomClass message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {google.cloud.speech.v1p1beta1.ICustomClass} message CustomClass message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomClass.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http - * @instance - */ - Http.prototype.fullyDecodeReservedExpansion = false; + /** + * Decodes a CustomClass message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1p1beta1.CustomClass} CustomClass + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomClass.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1p1beta1.CustomClass(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.customClassId = reader.string(); + break; + case 3: + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new Http instance using the specified properties. - * @function create - * @memberof google.api.Http - * @static - * @param {google.api.IHttp=} [properties] Properties to set - * @returns {google.api.Http} Http instance - */ - Http.create = function create(properties) { - return new Http(properties); - }; + /** + * Decodes a CustomClass message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1p1beta1.CustomClass} CustomClass + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomClass.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encode - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); - return writer; - }; + /** + * Verifies a CustomClass message. + * @function verify + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomClass.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.customClassId != null && message.hasOwnProperty("customClassId")) + if (!$util.isString(message.customClassId)) + return "customClassId: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a CustomClass message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1p1beta1.CustomClass} CustomClass + */ + CustomClass.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1p1beta1.CustomClass) + return object; + var message = new $root.google.cloud.speech.v1p1beta1.CustomClass(); + if (object.name != null) + message.name = String(object.name); + if (object.customClassId != null) + message.customClassId = String(object.customClassId); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.speech.v1p1beta1.CustomClass.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.CustomClass.items: object expected"); + message.items[i] = $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem.fromObject(object.items[i]); + } + } + return message; + }; - /** - * Decodes a Http message from the specified reader or buffer. - * @function decode - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decode = function decode(reader, length) { + /** + * Creates a plain object from a CustomClass message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @static + * @param {google.cloud.speech.v1p1beta1.CustomClass} message CustomClass + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomClass.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.name = ""; + object.customClassId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.customClassId != null && message.hasOwnProperty("customClassId")) + object.customClassId = message.customClassId; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this CustomClass to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @instance + * @returns {Object.} JSON object + */ + CustomClass.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + CustomClass.ClassItem = (function() { + + /** + * Properties of a ClassItem. + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @interface IClassItem + * @property {string|null} [value] ClassItem value + */ + + /** + * Constructs a new ClassItem. + * @memberof google.cloud.speech.v1p1beta1.CustomClass + * @classdesc Represents a ClassItem. + * @implements IClassItem + * @constructor + * @param {google.cloud.speech.v1p1beta1.CustomClass.IClassItem=} [properties] Properties to set + */ + function ClassItem(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClassItem value. + * @member {string} value + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @instance + */ + ClassItem.prototype.value = ""; + + /** + * Creates a new ClassItem instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {google.cloud.speech.v1p1beta1.CustomClass.IClassItem=} [properties] Properties to set + * @returns {google.cloud.speech.v1p1beta1.CustomClass.ClassItem} ClassItem instance + */ + ClassItem.create = function create(properties) { + return new ClassItem(properties); + }; + + /** + * Encodes the specified ClassItem message. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.ClassItem.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {google.cloud.speech.v1p1beta1.CustomClass.IClassItem} message ClassItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClassItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified ClassItem message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.CustomClass.ClassItem.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {google.cloud.speech.v1p1beta1.CustomClass.IClassItem} message ClassItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClassItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClassItem message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1p1beta1.CustomClass.ClassItem} ClassItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClassItem.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClassItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1p1beta1.CustomClass.ClassItem} ClassItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClassItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClassItem message. + * @function verify + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClassItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a ClassItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1p1beta1.CustomClass.ClassItem} ClassItem + */ + ClassItem.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem) + return object; + var message = new $root.google.cloud.speech.v1p1beta1.CustomClass.ClassItem(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a ClassItem message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @static + * @param {google.cloud.speech.v1p1beta1.CustomClass.ClassItem} message ClassItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClassItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this ClassItem to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1p1beta1.CustomClass.ClassItem + * @instance + * @returns {Object.} JSON object + */ + ClassItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClassItem; + })(); + + return CustomClass; + })(); + + v1p1beta1.PhraseSet = (function() { + + /** + * Properties of a PhraseSet. + * @memberof google.cloud.speech.v1p1beta1 + * @interface IPhraseSet + * @property {string|null} [name] PhraseSet name + * @property {Array.|null} [phrases] PhraseSet phrases + * @property {number|null} [boost] PhraseSet boost + */ + + /** + * Constructs a new PhraseSet. + * @memberof google.cloud.speech.v1p1beta1 + * @classdesc Represents a PhraseSet. + * @implements IPhraseSet + * @constructor + * @param {google.cloud.speech.v1p1beta1.IPhraseSet=} [properties] Properties to set + */ + function PhraseSet(properties) { + this.phrases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PhraseSet name. + * @member {string} name + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @instance + */ + PhraseSet.prototype.name = ""; + + /** + * PhraseSet phrases. + * @member {Array.} phrases + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @instance + */ + PhraseSet.prototype.phrases = $util.emptyArray; + + /** + * PhraseSet boost. + * @member {number} boost + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @instance + */ + PhraseSet.prototype.boost = 0; + + /** + * Creates a new PhraseSet instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {google.cloud.speech.v1p1beta1.IPhraseSet=} [properties] Properties to set + * @returns {google.cloud.speech.v1p1beta1.PhraseSet} PhraseSet instance + */ + PhraseSet.create = function create(properties) { + return new PhraseSet(properties); + }; + + /** + * Encodes the specified PhraseSet message. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {google.cloud.speech.v1p1beta1.IPhraseSet} message PhraseSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhraseSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.phrases != null && message.phrases.length) + for (var i = 0; i < message.phrases.length; ++i) + $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase.encode(message.phrases[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.boost != null && message.hasOwnProperty("boost")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.boost); + return writer; + }; + + /** + * Encodes the specified PhraseSet message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {google.cloud.speech.v1p1beta1.IPhraseSet} message PhraseSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhraseSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PhraseSet message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1p1beta1.PhraseSet} PhraseSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhraseSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1p1beta1.PhraseSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.phrases && message.phrases.length)) + message.phrases = []; + message.phrases.push($root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase.decode(reader, reader.uint32())); + break; + case 4: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PhraseSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1p1beta1.PhraseSet} PhraseSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhraseSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PhraseSet message. + * @function verify + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PhraseSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.phrases != null && message.hasOwnProperty("phrases")) { + if (!Array.isArray(message.phrases)) + return "phrases: array expected"; + for (var i = 0; i < message.phrases.length; ++i) { + var error = $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase.verify(message.phrases[i]); + if (error) + return "phrases." + error; + } + } + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a PhraseSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1p1beta1.PhraseSet} PhraseSet + */ + PhraseSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1p1beta1.PhraseSet) + return object; + var message = new $root.google.cloud.speech.v1p1beta1.PhraseSet(); + if (object.name != null) + message.name = String(object.name); + if (object.phrases) { + if (!Array.isArray(object.phrases)) + throw TypeError(".google.cloud.speech.v1p1beta1.PhraseSet.phrases: array expected"); + message.phrases = []; + for (var i = 0; i < object.phrases.length; ++i) { + if (typeof object.phrases[i] !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.PhraseSet.phrases: object expected"); + message.phrases[i] = $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase.fromObject(object.phrases[i]); + } + } + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a PhraseSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @static + * @param {google.cloud.speech.v1p1beta1.PhraseSet} message PhraseSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PhraseSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.phrases = []; + if (options.defaults) { + object.name = ""; + object.boost = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.phrases && message.phrases.length) { + object.phrases = []; + for (var j = 0; j < message.phrases.length; ++j) + object.phrases[j] = $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase.toObject(message.phrases[j], options); + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this PhraseSet to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @instance + * @returns {Object.} JSON object + */ + PhraseSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PhraseSet.Phrase = (function() { + + /** + * Properties of a Phrase. + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @interface IPhrase + * @property {string|null} [value] Phrase value + * @property {number|null} [boost] Phrase boost + */ + + /** + * Constructs a new Phrase. + * @memberof google.cloud.speech.v1p1beta1.PhraseSet + * @classdesc Represents a Phrase. + * @implements IPhrase + * @constructor + * @param {google.cloud.speech.v1p1beta1.PhraseSet.IPhrase=} [properties] Properties to set + */ + function Phrase(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Phrase value. + * @member {string} value + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @instance + */ + Phrase.prototype.value = ""; + + /** + * Phrase boost. + * @member {number} boost + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @instance + */ + Phrase.prototype.boost = 0; + + /** + * Creates a new Phrase instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {google.cloud.speech.v1p1beta1.PhraseSet.IPhrase=} [properties] Properties to set + * @returns {google.cloud.speech.v1p1beta1.PhraseSet.Phrase} Phrase instance + */ + Phrase.create = function create(properties) { + return new Phrase(properties); + }; + + /** + * Encodes the specified Phrase message. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.Phrase.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {google.cloud.speech.v1p1beta1.PhraseSet.IPhrase} message Phrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Phrase.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.boost != null && message.hasOwnProperty("boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified Phrase message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.PhraseSet.Phrase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {google.cloud.speech.v1p1beta1.PhraseSet.IPhrase} message Phrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Phrase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Phrase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1p1beta1.PhraseSet.Phrase} Phrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Phrase.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + message.boost = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Phrase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1p1beta1.PhraseSet.Phrase} Phrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Phrase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Phrase message. + * @function verify + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Phrase.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a Phrase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1p1beta1.PhraseSet.Phrase} Phrase + */ + Phrase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase) + return object; + var message = new $root.google.cloud.speech.v1p1beta1.PhraseSet.Phrase(); + if (object.value != null) + message.value = String(object.value); + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a Phrase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @static + * @param {google.cloud.speech.v1p1beta1.PhraseSet.Phrase} message Phrase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Phrase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.boost = 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this Phrase to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1p1beta1.PhraseSet.Phrase + * @instance + * @returns {Object.} JSON object + */ + Phrase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Phrase; + })(); + + return PhraseSet; + })(); + + v1p1beta1.SpeechAdaptation = (function() { + + /** + * Properties of a SpeechAdaptation. + * @memberof google.cloud.speech.v1p1beta1 + * @interface ISpeechAdaptation + * @property {Array.|null} [phraseSets] SpeechAdaptation phraseSets + * @property {Array.|null} [customClasses] SpeechAdaptation customClasses + */ + + /** + * Constructs a new SpeechAdaptation. + * @memberof google.cloud.speech.v1p1beta1 + * @classdesc Represents a SpeechAdaptation. + * @implements ISpeechAdaptation + * @constructor + * @param {google.cloud.speech.v1p1beta1.ISpeechAdaptation=} [properties] Properties to set + */ + function SpeechAdaptation(properties) { + this.phraseSets = []; + this.customClasses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechAdaptation phraseSets. + * @member {Array.} phraseSets + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @instance + */ + SpeechAdaptation.prototype.phraseSets = $util.emptyArray; + + /** + * SpeechAdaptation customClasses. + * @member {Array.} customClasses + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @instance + */ + SpeechAdaptation.prototype.customClasses = $util.emptyArray; + + /** + * Creates a new SpeechAdaptation instance using the specified properties. + * @function create + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {google.cloud.speech.v1p1beta1.ISpeechAdaptation=} [properties] Properties to set + * @returns {google.cloud.speech.v1p1beta1.SpeechAdaptation} SpeechAdaptation instance + */ + SpeechAdaptation.create = function create(properties) { + return new SpeechAdaptation(properties); + }; + + /** + * Encodes the specified SpeechAdaptation message. Does not implicitly {@link google.cloud.speech.v1p1beta1.SpeechAdaptation.verify|verify} messages. + * @function encode + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {google.cloud.speech.v1p1beta1.ISpeechAdaptation} message SpeechAdaptation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechAdaptation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phraseSets != null && message.phraseSets.length) + for (var i = 0; i < message.phraseSets.length; ++i) + $root.google.cloud.speech.v1p1beta1.PhraseSet.encode(message.phraseSets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.customClasses != null && message.customClasses.length) + for (var i = 0; i < message.customClasses.length; ++i) + $root.google.cloud.speech.v1p1beta1.CustomClass.encode(message.customClasses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SpeechAdaptation message, length delimited. Does not implicitly {@link google.cloud.speech.v1p1beta1.SpeechAdaptation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {google.cloud.speech.v1p1beta1.ISpeechAdaptation} message SpeechAdaptation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechAdaptation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechAdaptation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.speech.v1p1beta1.SpeechAdaptation} SpeechAdaptation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechAdaptation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.speech.v1p1beta1.SpeechAdaptation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.phraseSets && message.phraseSets.length)) + message.phraseSets = []; + message.phraseSets.push($root.google.cloud.speech.v1p1beta1.PhraseSet.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.customClasses && message.customClasses.length)) + message.customClasses = []; + message.customClasses.push($root.google.cloud.speech.v1p1beta1.CustomClass.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechAdaptation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.speech.v1p1beta1.SpeechAdaptation} SpeechAdaptation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechAdaptation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechAdaptation message. + * @function verify + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechAdaptation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phraseSets != null && message.hasOwnProperty("phraseSets")) { + if (!Array.isArray(message.phraseSets)) + return "phraseSets: array expected"; + for (var i = 0; i < message.phraseSets.length; ++i) { + var error = $root.google.cloud.speech.v1p1beta1.PhraseSet.verify(message.phraseSets[i]); + if (error) + return "phraseSets." + error; + } + } + if (message.customClasses != null && message.hasOwnProperty("customClasses")) { + if (!Array.isArray(message.customClasses)) + return "customClasses: array expected"; + for (var i = 0; i < message.customClasses.length; ++i) { + var error = $root.google.cloud.speech.v1p1beta1.CustomClass.verify(message.customClasses[i]); + if (error) + return "customClasses." + error; + } + } + return null; + }; + + /** + * Creates a SpeechAdaptation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.speech.v1p1beta1.SpeechAdaptation} SpeechAdaptation + */ + SpeechAdaptation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.speech.v1p1beta1.SpeechAdaptation) + return object; + var message = new $root.google.cloud.speech.v1p1beta1.SpeechAdaptation(); + if (object.phraseSets) { + if (!Array.isArray(object.phraseSets)) + throw TypeError(".google.cloud.speech.v1p1beta1.SpeechAdaptation.phraseSets: array expected"); + message.phraseSets = []; + for (var i = 0; i < object.phraseSets.length; ++i) { + if (typeof object.phraseSets[i] !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.SpeechAdaptation.phraseSets: object expected"); + message.phraseSets[i] = $root.google.cloud.speech.v1p1beta1.PhraseSet.fromObject(object.phraseSets[i]); + } + } + if (object.customClasses) { + if (!Array.isArray(object.customClasses)) + throw TypeError(".google.cloud.speech.v1p1beta1.SpeechAdaptation.customClasses: array expected"); + message.customClasses = []; + for (var i = 0; i < object.customClasses.length; ++i) { + if (typeof object.customClasses[i] !== "object") + throw TypeError(".google.cloud.speech.v1p1beta1.SpeechAdaptation.customClasses: object expected"); + message.customClasses[i] = $root.google.cloud.speech.v1p1beta1.CustomClass.fromObject(object.customClasses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SpeechAdaptation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @static + * @param {google.cloud.speech.v1p1beta1.SpeechAdaptation} message SpeechAdaptation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechAdaptation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.phraseSets = []; + object.customClasses = []; + } + if (message.phraseSets && message.phraseSets.length) { + object.phraseSets = []; + for (var j = 0; j < message.phraseSets.length; ++j) + object.phraseSets[j] = $root.google.cloud.speech.v1p1beta1.PhraseSet.toObject(message.phraseSets[j], options); + } + if (message.customClasses && message.customClasses.length) { + object.customClasses = []; + for (var j = 0; j < message.customClasses.length; ++j) + object.customClasses[j] = $root.google.cloud.speech.v1p1beta1.CustomClass.toObject(message.customClasses[j], options); + } + return object; + }; + + /** + * Converts this SpeechAdaptation to JSON. + * @function toJSON + * @memberof google.cloud.speech.v1p1beta1.SpeechAdaptation + * @instance + * @returns {Object.} JSON object + */ + SpeechAdaptation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SpeechAdaptation; + })(); + + return v1p1beta1; + })(); + + return speech; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = ""; + + /** + * HttpRule put. + * @member {string} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = ""; + + /** + * HttpRule post. + * @member {string} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = ""; + + /** + * HttpRule delete. + * @member {string} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = ""; + + /** + * HttpRule patch. + * @member {string} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = ""; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && message.hasOwnProperty("selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && message.hasOwnProperty("get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && message.hasOwnProperty("put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && message.hasOwnProperty("post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && message.hasOwnProperty("delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && message.hasOwnProperty("patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && message.hasOwnProperty("body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && message.hasOwnProperty("custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message["delete"] = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && message.hasOwnProperty("kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && message.hasOwnProperty("path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.kind = reader.string(); break; case 2: - message.fullyDecodeReservedExpansion = reader.bool(); + message.path = reader.string(); break; default: reader.skipType(tag & 7); @@ -10200,143 +12118,144 @@ }; /** - * Decodes a Http message from the specified reader or buffer, length delimited. + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Http.decodeDelimited = function decodeDelimited(reader) { + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Http message. + * Verifies a CustomHttpPattern message. * @function verify - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Http.verify = function verify(message) { + CustomHttpPattern.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; - } - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - if (typeof message.fullyDecodeReservedExpansion !== "boolean") - return "fullyDecodeReservedExpansion: boolean expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; return null; }; /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} object Plain object - * @returns {google.api.Http} Http + * @returns {google.api.CustomHttpPattern} CustomHttpPattern */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) return object; - var message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } - } - if (object.fullyDecodeReservedExpansion != null) - message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); return message; }; /** - * Creates a plain object from a Http message. Also converts values to other types if specified. + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @static - * @param {google.api.Http} message Http + * @param {google.api.CustomHttpPattern} message CustomHttpPattern * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Http.toObject = function toObject(message, options) { + CustomHttpPattern.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (options.defaults) - object.fullyDecodeReservedExpansion = false; - if (message.rules && message.rules.length) { - object.rules = []; - for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + if (options.defaults) { + object.kind = ""; + object.path = ""; } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; return object; }; /** - * Converts this Http to JSON. + * Converts this CustomHttpPattern to JSON. * @function toJSON - * @memberof google.api.Http + * @memberof google.api.CustomHttpPattern * @instance * @returns {Object.} JSON object */ - Http.prototype.toJSON = function toJSON() { + CustomHttpPattern.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Http; + return CustomHttpPattern; })(); - api.HttpRule = (function() { + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {string} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + return values; + })(); + + api.ResourceDescriptor = (function() { /** - * Properties of a HttpRule. + * Properties of a ResourceDescriptor. * @memberof google.api - * @interface IHttpRule - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [body] HttpRule body - * @property {string|null} [responseBody] HttpRule responseBody - * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular */ /** - * Constructs a new HttpRule. + * Constructs a new ResourceDescriptor. * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set + * @param {google.api.IResourceDescriptor=} [properties] Properties to set */ - function HttpRule(properties) { - this.additionalBindings = []; + function ResourceDescriptor(properties) { + this.pattern = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10344,209 +12263,143 @@ } /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; - - /** - * HttpRule get. - * @member {string} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = ""; - - /** - * HttpRule put. - * @member {string} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = ""; - - /** - * HttpRule post. - * @member {string} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = ""; - - /** - * HttpRule delete. - * @member {string} delete - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype["delete"] = ""; - - /** - * HttpRule patch. - * @member {string} patch - * @memberof google.api.HttpRule + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.patch = ""; + ResourceDescriptor.prototype.type = ""; /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.custom = null; + ResourceDescriptor.prototype.pattern = $util.emptyArray; /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.body = ""; + ResourceDescriptor.prototype.nameField = ""; /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.responseBody = ""; + ResourceDescriptor.prototype.history = 0; /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor * @instance */ - HttpRule.prototype.additionalBindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + ResourceDescriptor.prototype.plural = ""; /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor * @instance */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); + ResourceDescriptor.prototype.singular = ""; /** - * Creates a new HttpRule instance using the specified properties. + * Creates a new ResourceDescriptor instance using the specified properties. * @function create - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); }; /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. * @function encode - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encode = function encode(message, writer) { + ResourceDescriptor.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.selector != null && message.hasOwnProperty("selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && message.hasOwnProperty("get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && message.hasOwnProperty("put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && message.hasOwnProperty("post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && message.hasOwnProperty("delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && message.hasOwnProperty("patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && message.hasOwnProperty("body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && message.hasOwnProperty("custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additionalBindings != null && message.additionalBindings.length) - for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && message.hasOwnProperty("nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && message.hasOwnProperty("history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && message.hasOwnProperty("plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && message.hasOwnProperty("singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); return writer; }; /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a HttpRule message from the specified reader or buffer. + * Decodes a ResourceDescriptor message from the specified reader or buffer. * @function decode - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceDescriptor} ResourceDescriptor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decode = function decode(reader, length) { + ResourceDescriptor.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.selector = reader.string(); + message.type = reader.string(); break; case 2: - message.get = reader.string(); + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); break; case 3: - message.put = reader.string(); + message.nameField = reader.string(); break; case 4: - message.post = reader.string(); + message.history = reader.int32(); break; case 5: - message["delete"] = reader.string(); + message.plural = reader.string(); break; case 6: - message.patch = reader.string(); - break; - case 8: - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 7: - message.body = reader.string(); - break; - case 12: - message.responseBody = reader.string(); - break; - case 11: - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + message.singular = reader.string(); break; default: reader.skipType(tag & 7); @@ -10557,240 +12410,196 @@ }; /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceDescriptor} ResourceDescriptor * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HttpRule message. - * @function verify - * @memberof google.api.HttpRule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpRule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } - } - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - if (!$util.isString(message.responseBody)) - return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { - if (!Array.isArray(message.additionalBindings)) - return "additionalBindings: array expected"; - for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); - if (error) - return "additionalBindings." + error; - } + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; return null; }; /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule + * @returns {google.api.ResourceDescriptor} ResourceDescriptor */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) return object; - var message = new $root.google.api.HttpRule(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); } - if (object.body != null) - message.body = String(object.body); - if (object.responseBody != null) - message.responseBody = String(object.responseBody); - if (object.additionalBindings) { - if (!Array.isArray(object.additionalBindings)) - throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); - message.additionalBindings = []; - for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); - } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); return message; }; /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @static - * @param {google.api.HttpRule} message HttpRule + * @param {google.api.ResourceDescriptor} message ResourceDescriptor * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - HttpRule.toObject = function toObject(message, options) { + ResourceDescriptor.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.additionalBindings = []; + object.pattern = []; if (options.defaults) { - object.selector = ""; - object.body = ""; - object.responseBody = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; } - if (message.additionalBindings && message.additionalBindings.length) { - object.additionalBindings = []; - for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; return object; }; /** - * Converts this HttpRule to JSON. + * Converts this ResourceDescriptor to JSON. * @function toJSON - * @memberof google.api.HttpRule + * @memberof google.api.ResourceDescriptor * @instance * @returns {Object.} JSON object */ - HttpRule.prototype.toJSON = function toJSON() { + ResourceDescriptor.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return HttpRule; + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {string} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + return ResourceDescriptor; })(); - api.CustomHttpPattern = (function() { + api.ResourceReference = (function() { /** - * Properties of a CustomHttpPattern. + * Properties of a ResourceReference. * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType */ /** - * Constructs a new CustomHttpPattern. + * Constructs a new ResourceReference. * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern + * @classdesc Represents a ResourceReference. + * @implements IResourceReference * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @param {google.api.IResourceReference=} [properties] Properties to set */ - function CustomHttpPattern(properties) { + function ResourceReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10798,88 +12607,88 @@ } /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference * @instance */ - CustomHttpPattern.prototype.kind = ""; + ResourceReference.prototype.type = ""; /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference * @instance */ - CustomHttpPattern.prototype.path = ""; + ResourceReference.prototype.childType = ""; /** - * Creates a new CustomHttpPattern instance using the specified properties. + * Creates a new ResourceReference instance using the specified properties. * @function create - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); }; /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. * @function encode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encode = function encode(message, writer) { + ResourceReference.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.kind != null && message.hasOwnProperty("kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && message.hasOwnProperty("path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && message.hasOwnProperty("childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); return writer; }; /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. + * Decodes a ResourceReference message from the specified reader or buffer. * @function decode - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.ResourceReference} ResourceReference * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decode = function decode(reader, length) { + ResourceReference.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.kind = reader.string(); + message.type = reader.string(); break; case 2: - message.path = reader.string(); + message.childType = reader.string(); break; default: reader.skipType(tag & 7); @@ -10890,118 +12699,96 @@ }; /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.ResourceReference} ResourceReference * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + ResourceReference.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CustomHttpPattern message. + * Verifies a ResourceReference message. * @function verify - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CustomHttpPattern.verify = function verify(message) { + ResourceReference.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; return null; }; /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @returns {google.api.ResourceReference} ResourceReference */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) return object; - var message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); return message; }; /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {google.api.ResourceReference} message ResourceReference * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CustomHttpPattern.toObject = function toObject(message, options) { + ResourceReference.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.kind = ""; - object.path = ""; + object.type = ""; + object.childType = ""; } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; return object; }; /** - * Converts this CustomHttpPattern to JSON. + * Converts this ResourceReference to JSON. * @function toJSON - * @memberof google.api.CustomHttpPattern + * @memberof google.api.ResourceReference * @instance * @returns {Object.} JSON object */ - CustomHttpPattern.prototype.toJSON = function toJSON() { + ResourceReference.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CustomHttpPattern; - })(); - - /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {string} - * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value - * @property {number} OPTIONAL=1 OPTIONAL value - * @property {number} REQUIRED=2 REQUIRED value - * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value - * @property {number} INPUT_ONLY=4 INPUT_ONLY value - * @property {number} IMMUTABLE=5 IMMUTABLE value - */ - api.FieldBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - values[valuesById[3] = "OUTPUT_ONLY"] = 3; - values[valuesById[4] = "INPUT_ONLY"] = 4; - values[valuesById[5] = "IMMUTABLE"] = 5; - return values; + return ResourceReference; })(); return api; @@ -15175,6 +16962,7 @@ * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace * @property {string|null} [rubyPackage] FileOptions rubyPackage * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition */ /** @@ -15187,6 +16975,7 @@ */ function FileOptions(properties) { this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15361,6 +17150,14 @@ */ FileOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + /** * Creates a new FileOptions instance using the specified properties. * @function create @@ -15428,6 +17225,9 @@ if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); return writer; }; @@ -15527,6 +17327,11 @@ message.uninterpretedOption = []; message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; + case 1053: + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -15637,6 +17442,15 @@ return "uninterpretedOption." + error; } } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } return null; }; @@ -15714,6 +17528,16 @@ message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } return message; }; @@ -15730,8 +17554,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } if (options.defaults) { object.javaPackage = ""; object.javaOuterClassname = ""; @@ -15799,6 +17625,11 @@ for (var j = 0; j < message.uninterpretedOption.length; ++j) object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } return object; }; @@ -15843,6 +17674,7 @@ * @property {boolean|null} [deprecated] MessageOptions deprecated * @property {boolean|null} [mapEntry] MessageOptions mapEntry * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource */ /** @@ -15901,6 +17733,14 @@ */ MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + /** * Creates a new MessageOptions instance using the specified properties. * @function create @@ -15936,6 +17776,8 @@ if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); return writer; }; @@ -15987,6 +17829,9 @@ message.uninterpretedOption = []; message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; + case 1053: + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -16043,6 +17888,11 @@ return "uninterpretedOption." + error; } } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } return null; }; @@ -16076,6 +17926,11 @@ message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } return message; }; @@ -16099,6 +17954,7 @@ object.noStandardDescriptorAccessor = false; object.deprecated = false; object.mapEntry = false; + object[".google.api.resource"] = null; } if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) object.messageSetWireFormat = message.messageSetWireFormat; @@ -16113,6 +17969,8 @@ for (var j = 0; j < message.uninterpretedOption.length; ++j) object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); return object; }; @@ -16144,6 +18002,7 @@ * @property {boolean|null} [weak] FieldOptions weak * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference */ /** @@ -16227,6 +18086,14 @@ */ FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + /** * Creates a new FieldOptions instance using the specified properties. * @function create @@ -16272,6 +18139,8 @@ writer.int32(message[".google.api.fieldBehavior"][i]); writer.ldelim(); } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); return writer; }; @@ -16339,6 +18208,9 @@ } else message[".google.api.fieldBehavior"].push(reader.int32()); break; + case 1055: + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -16429,6 +18301,11 @@ break; } } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } return null; }; @@ -16523,6 +18400,11 @@ break; } } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } return message; }; @@ -16550,6 +18432,7 @@ object.lazy = false; object.jstype = options.enums === String ? "JS_NORMAL" : 0; object.weak = false; + object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; @@ -16573,6 +18456,8 @@ for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); return object; }; diff --git a/packages/google-cloud-speech/protos/protos.json b/packages/google-cloud-speech/protos/protos.json index 4fd814f0f63..08516bca8ec 100644 --- a/packages/google-cloud-speech/protos/protos.json +++ b/packages/google-cloud-speech/protos/protos.json @@ -484,7 +484,7 @@ "cc_enable_arenas": true, "go_package": "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech", "java_multiple_files": true, - "java_outer_classname": "SpeechProto", + "java_outer_classname": "SpeechResourceProto", "java_package": "com.google.cloud.speech.v1p1beta1", "objc_class_prefix": "GCS" }, @@ -636,6 +636,10 @@ "type": "bool", "id": 5 }, + "adaptation": { + "type": "SpeechAdaptation", + "id": 20 + }, "speechContexts": { "rule": "repeated", "type": "SpeechContext", @@ -713,6 +717,14 @@ "maxSpeakerCount": { "type": "int32", "id": 3 + }, + "speakerTag": { + "type": "int32", + "id": 5, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, @@ -864,6 +876,13 @@ "lastUpdateTime": { "type": "google.protobuf.Timestamp", "id": 3 + }, + "uri": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, @@ -917,7 +936,10 @@ }, "languageCode": { "type": "string", - "id": 6 + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, @@ -934,7 +956,10 @@ }, "languageCode": { "type": "string", - "id": 5 + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } } }, @@ -975,7 +1000,90 @@ }, "speakerTag": { "type": "int32", - "id": 5 + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CustomClass": { + "options": { + "(google.api.resource).type": "speech.googleapis.com/CustomClass", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/customClasses/{custom_class}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "customClassId": { + "type": "string", + "id": 2 + }, + "items": { + "rule": "repeated", + "type": "ClassItem", + "id": 3 + } + }, + "nested": { + "ClassItem": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + } + } + }, + "PhraseSet": { + "options": { + "(google.api.resource).type": "speech.googleapis.com/PhraseSet", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/phraseSets/{phrase_set}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "phrases": { + "rule": "repeated", + "type": "Phrase", + "id": 2 + }, + "boost": { + "type": "float", + "id": 4 + } + }, + "nested": { + "Phrase": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + } + } + }, + "SpeechAdaptation": { + "fields": { + "phraseSets": { + "rule": "repeated", + "type": "PhraseSet", + "id": 1 + }, + "customClasses": { + "rule": "repeated", + "type": "CustomClass", + "id": 2 } } } @@ -989,7 +1097,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "FieldBehaviorProto", + "java_outer_classname": "ResourceProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -1113,6 +1221,72 @@ "INPUT_ONLY": 4, "IMMUTABLE": 5 } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } } } }, diff --git a/packages/google-cloud-speech/src/v1p1beta1/speech_client.ts b/packages/google-cloud-speech/src/v1p1beta1/speech_client.ts index 25a80f2dfe2..bcc6e7c0094 100644 --- a/packages/google-cloud-speech/src/v1p1beta1/speech_client.ts +++ b/packages/google-cloud-speech/src/v1p1beta1/speech_client.ts @@ -51,6 +51,7 @@ export class SpeechClient { batching: {}, }; innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; speechStub?: Promise<{[name: string]: Function}>; @@ -149,6 +150,18 @@ export class SpeechClient { : nodejsProtoPath ); + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + customClassPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/customClasses/{custom_class}' + ), + phraseSetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/phraseSets/{phrase_set}' + ), + }; + // Some of the methods on this service provide streaming responses. // Provide descriptors for these. this.descriptors.stream = { @@ -511,6 +524,113 @@ export class SpeechClient { this.initialize(); return this.innerApiCalls.longRunningRecognize(request, options, callback); } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified customClass resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} custom_class + * @returns {string} Resource name string. + */ + customClassPath(project: string, location: string, customClass: string) { + return this.pathTemplates.customClassPathTemplate.render({ + project: project, + location: location, + custom_class: customClass, + }); + } + + /** + * Parse the project from CustomClass resource. + * + * @param {string} customClassName + * A fully-qualified path representing CustomClass resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCustomClassName(customClassName: string) { + return this.pathTemplates.customClassPathTemplate.match(customClassName) + .project; + } + + /** + * Parse the location from CustomClass resource. + * + * @param {string} customClassName + * A fully-qualified path representing CustomClass resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCustomClassName(customClassName: string) { + return this.pathTemplates.customClassPathTemplate.match(customClassName) + .location; + } + + /** + * Parse the custom_class from CustomClass resource. + * + * @param {string} customClassName + * A fully-qualified path representing CustomClass resource. + * @returns {string} A string representing the custom_class. + */ + matchCustomClassFromCustomClassName(customClassName: string) { + return this.pathTemplates.customClassPathTemplate.match(customClassName) + .custom_class; + } + + /** + * Return a fully-qualified phraseSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} phrase_set + * @returns {string} Resource name string. + */ + phraseSetPath(project: string, location: string, phraseSet: string) { + return this.pathTemplates.phraseSetPathTemplate.render({ + project: project, + location: location, + phrase_set: phraseSet, + }); + } + + /** + * Parse the project from PhraseSet resource. + * + * @param {string} phraseSetName + * A fully-qualified path representing PhraseSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPhraseSetName(phraseSetName: string) { + return this.pathTemplates.phraseSetPathTemplate.match(phraseSetName) + .project; + } + + /** + * Parse the location from PhraseSet resource. + * + * @param {string} phraseSetName + * A fully-qualified path representing PhraseSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPhraseSetName(phraseSetName: string) { + return this.pathTemplates.phraseSetPathTemplate.match(phraseSetName) + .location; + } + + /** + * Parse the phrase_set from PhraseSet resource. + * + * @param {string} phraseSetName + * A fully-qualified path representing PhraseSet resource. + * @returns {string} A string representing the phrase_set. + */ + matchPhraseSetFromPhraseSetName(phraseSetName: string) { + return this.pathTemplates.phraseSetPathTemplate.match(phraseSetName) + .phrase_set; + } /** * Terminate the GRPC channel and close the client. diff --git a/packages/google-cloud-speech/src/v1p1beta1/speech_proto_list.json b/packages/google-cloud-speech/src/v1p1beta1/speech_proto_list.json index 100934e5328..3b92ac9fac9 100644 --- a/packages/google-cloud-speech/src/v1p1beta1/speech_proto_list.json +++ b/packages/google-cloud-speech/src/v1p1beta1/speech_proto_list.json @@ -1,3 +1,4 @@ [ - "../../protos/google/cloud/speech/v1p1beta1/cloud_speech.proto" + "../../protos/google/cloud/speech/v1p1beta1/cloud_speech.proto", + "../../protos/google/cloud/speech/v1p1beta1/resource.proto" ] diff --git a/packages/google-cloud-speech/synth.metadata b/packages/google-cloud-speech/synth.metadata index 5523df11338..19c530d6203 100644 --- a/packages/google-cloud-speech/synth.metadata +++ b/packages/google-cloud-speech/synth.metadata @@ -1,12 +1,25 @@ { - "updateTime": "2020-04-11T00:58:17.534247Z", "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/nodejs-speech.git", + "sha": "4abdb5ce8cde7477cc9a0785406ebcbfa5dd08af" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "bcc476396e799806d3355e87246c6becf6250a70", + "internalRef": "306974763" + } + }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "6f32150677c9784f3c3a7e1949472bd29c9d72c5", - "log": "6f32150677c9784f3c3a7e1949472bd29c9d72c5\nfix: installs test_utils from its common repo (#480)\n\n\n74ce986d3b5431eb66985e9a00c4eb45295a4020\nfix: stop recording update_time in synth.metadata (#478)\n\n\n7f8e62aa3edd225f76347a16f92e400661fdfb52\nchore(java): release-please only updates non maven versions in README (#476)\n\nPrevent release-please and synthtool from fighting over the released library version. Synthtool updates the install snippets from the samples pom.xml files so the bots fight if they are temporarily out of sync after a release.\nc7e0e517d7f46f77bebd27da2e5afcaa6eee7e25\nbuild(java): fix nightly integration test config to run integrations (#465)\n\nThis was only running the units.\nbd69a2aa7b70875f3c988e269706b22fefbef40e\nbuild(java): fix retry_with_backoff when -e option set (#475)\n\n\nd9b173c427bfa0c6cca818233562e7e8841a357c\nfix: record version of working repo in synth.metadata (#473)\n\nPartial revert of b37cf74d12e9a42b9de9e61a4f26133d7cd9c168.\nf73a541770d95a609e5be6bf6b3b220d17cefcbe\nfeat(discogapic): allow local discovery-artifact-manager (#474)\n\n\n8cf0f5d93a70c3dcb0b4999d3152c46d4d9264bf\ndoc: describe the Autosynth & Synthtool protocol (#472)\n\n* doc: describe the Autosynth & Synthtool protocol\n\n* Accommodate review comments.\n980baaa738a1ad8fa02b4fdbd56be075ee77ece5\nfix: pin sphinx to <3.0.0 as new version causes new error (#471)\n\nThe error `toctree contains reference to document changlelog that doesn't have a title: no link will be generated` occurs as of 3.0.0. Pinning to 2.x until we address the docs build issue.\n\nTowards #470\n\nI did this manually for python-datastore https://github.com/googleapis/python-datastore/pull/22\n928b2998ac5023e7c7e254ab935f9ef022455aad\nchore(deps): update dependency com.google.cloud.samples:shared-configuration to v1.0.15 (#466)\n\nCo-authored-by: Jeffrey Rennie \n188f1b1d53181f739b98f8aa5d40cfe99eb90c47\nfix: allow local and external deps to be specified (#469)\n\nModify noxfile.py to allow local and external dependencies for\nsystem tests to be specified.\n" + "sha": "682c0c37d1054966ca662a44259e96cc7aea4413" } } ], diff --git a/packages/google-cloud-speech/system-test/install.ts b/packages/google-cloud-speech/system-test/install.ts index c4d80e9c0c8..4c1ba3eb79a 100644 --- a/packages/google-cloud-speech/system-test/install.ts +++ b/packages/google-cloud-speech/system-test/install.ts @@ -21,7 +21,7 @@ import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; describe('typescript consumer tests', () => { - it('should have correct type signature for typescript users', async function() { + it('should have correct type signature for typescript users', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), // path to your module. @@ -35,7 +35,7 @@ describe('typescript consumer tests', () => { await packNTest(options); // will throw upon error. }); - it('should have correct type signature for javascript users', async function() { + it('should have correct type signature for javascript users', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), // path to your module. diff --git a/packages/google-cloud-speech/test/gapic_speech_v1p1beta1.ts b/packages/google-cloud-speech/test/gapic_speech_v1p1beta1.ts index fc923f71bb6..10da22a3824 100644 --- a/packages/google-cloud-speech/test/gapic_speech_v1p1beta1.ts +++ b/packages/google-cloud-speech/test/gapic_speech_v1p1beta1.ts @@ -486,4 +486,134 @@ describe('v1p1beta1.SpeechClient', () => { ); }); }); + + describe('Path templates', () => { + describe('customClass', () => { + const fakePath = '/rendered/path/customClass'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + custom_class: 'customClassValue', + }; + const client = new speechModule.v1p1beta1.SpeechClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.customClassPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.customClassPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('customClassPath', () => { + const result = client.customClassPath( + 'projectValue', + 'locationValue', + 'customClassValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.customClassPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCustomClassName', () => { + const result = client.matchProjectFromCustomClassName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.customClassPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCustomClassName', () => { + const result = client.matchLocationFromCustomClassName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.customClassPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCustomClassFromCustomClassName', () => { + const result = client.matchCustomClassFromCustomClassName(fakePath); + assert.strictEqual(result, 'customClassValue'); + assert( + (client.pathTemplates.customClassPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('phraseSet', () => { + const fakePath = '/rendered/path/phraseSet'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + phrase_set: 'phraseSetValue', + }; + const client = new speechModule.v1p1beta1.SpeechClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.phraseSetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.phraseSetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('phraseSetPath', () => { + const result = client.phraseSetPath( + 'projectValue', + 'locationValue', + 'phraseSetValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.phraseSetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPhraseSetName', () => { + const result = client.matchProjectFromPhraseSetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.phraseSetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPhraseSetName', () => { + const result = client.matchLocationFromPhraseSetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.phraseSetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPhraseSetFromPhraseSetName', () => { + const result = client.matchPhraseSetFromPhraseSetName(fakePath); + assert.strictEqual(result, 'phraseSetValue'); + assert( + (client.pathTemplates.phraseSetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); });