Skip to content

Commit

Permalink
chore: update proto docs and code style (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Mar 3, 2019
1 parent 4f65d5b commit 532a975
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ option java_multiple_files = true;
option java_outer_classname = "SpeechProto";
option java_package = "com.google.cloud.speech.v1";


// Service that implements Google Cloud Speech API.
service Speech {
// Performs synchronous speech recognition: receive results after all audio
Expand All @@ -47,7 +46,8 @@ service Speech {
// google.longrunning.Operations interface. Returns either an
// `Operation.error` or an `Operation.response` which contains
// a `LongRunningRecognizeResponse` message.
rpc LongRunningRecognize(LongRunningRecognizeRequest) returns (google.longrunning.Operation) {
rpc LongRunningRecognize(LongRunningRecognizeRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/speech:longrunningrecognize"
body: "*"
Expand All @@ -56,8 +56,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.
Expand Down Expand Up @@ -155,7 +155,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;
Expand Down Expand Up @@ -203,7 +204,8 @@ message RecognitionConfig {

// 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.v1.RecognitionConfig.AudioEncoding].
// for all other audio formats. For details, see
// [AudioEncoding][google.cloud.speech.v1.RecognitionConfig.AudioEncoding].
AudioEncoding encoding = 1;

// Sample rate in Hertz of the audio data sent in all
Expand All @@ -212,7 +214,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 and required
// for all other audio formats. For details, see [AudioEncoding][google.cloud.speech.v1.RecognitionConfig.AudioEncoding].
// for all other audio formats. For details, see
// [AudioEncoding][google.cloud.speech.v1.RecognitionConfig.AudioEncoding].
int32 sample_rate_hertz = 2;

// *Optional* The number of channels in the input audio data.
Expand Down Expand Up @@ -341,8 +344,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](/speech-to-text/quotas#content).
// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
// See [content limits](/speech-to-text/quotas#content).
message RecognitionAudio {
// The audio source, which is either inline content or a Google Cloud
// Storage uri.
Expand All @@ -357,8 +360,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;
}
}
Expand Down Expand Up @@ -463,8 +467,8 @@ message StreamingRecognizeResponse {
END_OF_SINGLE_UTTERANCE = 1;
}

// Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that
// specifies the error for the operation.
// Output only. If set, returns a [google.rpc.Status][google.rpc.Status]
// message that specifies the error for the operation.
google.rpc.Status error = 1;

// Output only. This repeated list contains zero or more results that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ option java_multiple_files = true;
option java_outer_classname = "SpeechProto";
option java_package = "com.google.cloud.speech.v1p1beta1";


// Service that implements Google Cloud Speech API.
service Speech {
// Performs synchronous speech recognition: receive results after all audio
Expand All @@ -47,7 +46,8 @@ service Speech {
// google.longrunning.Operations interface. Returns either an
// `Operation.error` or an `Operation.response` which contains
// a `LongRunningRecognizeResponse` message.
rpc LongRunningRecognize(LongRunningRecognizeRequest) returns (google.longrunning.Operation) {
rpc LongRunningRecognize(LongRunningRecognizeRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1p1beta1/speech:longrunningrecognize"
body: "*"
Expand All @@ -56,8 +56,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.
Expand Down Expand Up @@ -155,7 +155,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;
Expand Down Expand Up @@ -203,7 +204,8 @@ message RecognitionConfig {

// 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
Expand All @@ -212,7 +214,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 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].
int32 sample_rate_hertz = 2;

// *Optional* The number of channels in the input audio data.
Expand Down Expand Up @@ -269,9 +272,10 @@ message RecognitionConfig {
// won't be filtered out.
bool profanity_filter = 5;

// *Optional* array of [SpeechContext][google.cloud.speech.v1p1beta1.SpeechContext].
// A means to provide context to assist the speech recognition. For more
// information, see [Phrase Hints](/speech-to-text/docs/basics#phrase-hints).
// *Optional* array of
// [SpeechContext][google.cloud.speech.v1p1beta1.SpeechContext]. A means to
// provide context to assist the speech recognition. For more information, see
// [Phrase Hints](/speech-to-text/docs/basics#phrase-hints).
repeated SpeechContext speech_contexts = 6;

// *Optional* If `true`, the top result includes a list of words and
Expand Down Expand Up @@ -511,8 +515,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](/speech-to-text/quotas#content).
// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
// See [content limits](/speech-to-text/quotas#content).
message RecognitionAudio {
// The audio source, which is either inline content or a Google Cloud
// Storage uri.
Expand All @@ -527,8 +531,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;
}
}
Expand Down Expand Up @@ -633,8 +638,8 @@ message StreamingRecognizeResponse {
END_OF_SINGLE_UTTERANCE = 1;
}

// Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that
// specifies the error for the operation.
// Output only. If set, returns a [google.rpc.Status][google.rpc.Status]
// message that specifies the error for the operation.
google.rpc.Status error = 1;

// Output only. This repeated list contains zero or more results that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ const StreamingRecognitionConfig = {
* @property {number} encoding
* 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.
* for all other audio formats. For details, see
* AudioEncoding.
*
* The number should be among the values of [AudioEncoding]{@link google.cloud.speech.v1.AudioEncoding}
*
Expand All @@ -147,7 +148,8 @@ const StreamingRecognitionConfig = {
* 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 and required
* for all other audio formats. For details, see AudioEncoding.
* for all other audio formats. For details, see
* AudioEncoding.
*
* @property {number} audioChannelCount
* *Optional* The number of channels in the input audio data.
Expand Down Expand Up @@ -289,7 +291,8 @@ const 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 error code.
* google.rpc.Code.INVALID_ARGUMENT error
* code.
*
* @enum {number}
* @memberof google.cloud.speech.v1
Expand Down Expand Up @@ -380,8 +383,8 @@ const 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. See
* [content limits](https://cloud.google.com/speech-to-text/quotas#content).
* returns google.rpc.Code.INVALID_ARGUMENT.
* See [content limits](https://cloud.google.com/speech-to-text/quotas#content).
*
* @property {string} content
* The audio data bytes encoded as specified in
Expand All @@ -394,8 +397,9 @@ const SpeechContext = {
* 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). For more information, see
* [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
* google.rpc.Code.INVALID_ARGUMENT).
* For more information, see [Request
* URIs](https://cloud.google.com/storage/docs/reference-uris).
*
* @typedef RecognitionAudio
* @memberof google.cloud.speech.v1
Expand Down Expand Up @@ -524,8 +528,8 @@ const LongRunningRecognizeMetadata = {
* one or more (repeated) `results`.
*
* @property {Object} error
* Output only. If set, returns a google.rpc.Status message that
* specifies the error for the operation.
* Output only. If set, returns a google.rpc.Status
* message that specifies the error for the operation.
*
* This object should have the same structure as [Status]{@link google.rpc.Status}
*
Expand Down
31 changes: 17 additions & 14 deletions packages/google-cloud-node/src/v1/doc/google/rpc/doc_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@
// to be loaded as the JS file.

/**
* The `Status` type defines a logical error model that is suitable for different
* programming environments, including REST APIs and RPC APIs. It is used by
* [gRPC](https://github.com/grpc). The error model is designed to be:
* The `Status` type defines a logical error model that is suitable for
* different programming environments, including REST APIs and RPC APIs. It is
* used by [gRPC](https://github.com/grpc). The error model is designed to be:
*
* - Simple to use and understand for most users
* - Flexible enough to meet unexpected needs
*
* # Overview
*
* The `Status` message contains three pieces of data: error code, error message,
* and error details. The error code should be an enum value of
* google.rpc.Code, but it may accept additional error codes if needed. The
* error message should be a developer-facing English message that helps
* developers *understand* and *resolve* the error. If a localized user-facing
* error message is needed, put the localized message in the error details or
* localize it in the client. The optional error details may contain arbitrary
* information about the error. There is a predefined set of error detail types
* in the package `google.rpc` that can be used for common error conditions.
* The `Status` message contains three pieces of data: error code, error
* message, and error details. The error code should be an enum value of
* google.rpc.Code, but it may accept additional error codes
* if needed. The error message should be a developer-facing English message
* that helps developers *understand* and *resolve* the error. If a localized
* user-facing error message is needed, put the localized message in the error
* details or localize it in the client. The optional error details may contain
* arbitrary information about the error. There is a predefined set of error
* detail types in the package `google.rpc` that can be used for common error
* conditions.
*
* # Language mapping
*
Expand Down Expand Up @@ -70,12 +71,14 @@
* be used directly after any stripping needed for security/privacy reasons.
*
* @property {number} code
* The status code, which should be an enum value of google.rpc.Code.
* The status code, which should be an enum value of
* google.rpc.Code.
*
* @property {string} message
* A developer-facing error message, which should be in English. Any
* user-facing error message should be localized and sent in the
* google.rpc.Status.details field, or localized by the client.
* google.rpc.Status.details field, or localized
* by the client.
*
* @property {Object[]} details
* A list of messages that carry the error details. There is a common set of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ const StreamingRecognitionConfig = {
* @property {number} encoding
* 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.
* for all other audio formats. For details, see
* AudioEncoding.
*
* The number should be among the values of [AudioEncoding]{@link google.cloud.speech.v1p1beta1.AudioEncoding}
*
Expand All @@ -147,7 +148,8 @@ const StreamingRecognitionConfig = {
* 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 and required
* for all other audio formats. For details, see AudioEncoding.
* for all other audio formats. For details, see
* AudioEncoding.
*
* @property {number} audioChannelCount
* *Optional* The number of channels in the input audio data.
Expand Down Expand Up @@ -204,9 +206,10 @@ const StreamingRecognitionConfig = {
* won't be filtered out.
*
* @property {Object[]} speechContexts
* *Optional* array of SpeechContext.
* A means to provide context to assist the speech recognition. For more
* information, see [Phrase Hints](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints).
* *Optional* array of
* SpeechContext. A means to
* provide context to assist the speech recognition. For more information, see
* [Phrase Hints](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints).
*
* This object should have the same structure as [SpeechContext]{@link google.cloud.speech.v1p1beta1.SpeechContext}
*
Expand Down Expand Up @@ -330,7 +333,8 @@ const 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 error code.
* google.rpc.Code.INVALID_ARGUMENT error
* code.
*
* @enum {number}
* @memberof google.cloud.speech.v1p1beta1
Expand Down Expand Up @@ -638,8 +642,8 @@ const 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. See
* [content limits](https://cloud.google.com/speech-to-text/quotas#content).
* returns google.rpc.Code.INVALID_ARGUMENT.
* See [content limits](https://cloud.google.com/speech-to-text/quotas#content).
*
* @property {string} content
* The audio data bytes encoded as specified in
Expand All @@ -652,8 +656,9 @@ const SpeechContext = {
* 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). For more information, see
* [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
* google.rpc.Code.INVALID_ARGUMENT).
* For more information, see [Request
* URIs](https://cloud.google.com/storage/docs/reference-uris).
*
* @typedef RecognitionAudio
* @memberof google.cloud.speech.v1p1beta1
Expand Down Expand Up @@ -782,8 +787,8 @@ const LongRunningRecognizeMetadata = {
* one or more (repeated) `results`.
*
* @property {Object} error
* Output only. If set, returns a google.rpc.Status message that
* specifies the error for the operation.
* Output only. If set, returns a google.rpc.Status
* message that specifies the error for the operation.
*
* This object should have the same structure as [Status]{@link google.rpc.Status}
*
Expand Down
Loading

0 comments on commit 532a975

Please sign in to comment.