...

Source file src/google.golang.org/api/speech/v1/speech-gen.go

Documentation: google.golang.org/api/speech/v1

     1  // Copyright 2024 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package speech provides access to the Cloud Speech-to-Text API.
     8  //
     9  // This package is DEPRECATED. Use package cloud.google.com/go/speech/apiv1 instead.
    10  //
    11  // For product documentation, see: https://cloud.google.com/speech-to-text/docs/quickstart-protocol
    12  //
    13  // # Library status
    14  //
    15  // These client libraries are officially supported by Google. However, this
    16  // library is considered complete and is in maintenance mode. This means
    17  // that we will address critical bugs and security issues but will not add
    18  // any new features.
    19  //
    20  // When possible, we recommend using our newer
    21  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    22  // that are still actively being worked and iterated on.
    23  //
    24  // # Creating a client
    25  //
    26  // Usage example:
    27  //
    28  //	import "google.golang.org/api/speech/v1"
    29  //	...
    30  //	ctx := context.Background()
    31  //	speechService, err := speech.NewService(ctx)
    32  //
    33  // In this example, Google Application Default Credentials are used for
    34  // authentication. For information on how to create and obtain Application
    35  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    36  //
    37  // # Other authentication options
    38  //
    39  // To use an API key for authentication (note: some APIs do not support API
    40  // keys), use [google.golang.org/api/option.WithAPIKey]:
    41  //
    42  //	speechService, err := speech.NewService(ctx, option.WithAPIKey("AIza..."))
    43  //
    44  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    45  // flow, use [google.golang.org/api/option.WithTokenSource]:
    46  //
    47  //	config := &oauth2.Config{...}
    48  //	// ...
    49  //	token, err := config.Exchange(ctx, ...)
    50  //	speechService, err := speech.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    51  //
    52  // See [google.golang.org/api/option.ClientOption] for details on options.
    53  package speech // import "google.golang.org/api/speech/v1"
    54  
    55  import (
    56  	"bytes"
    57  	"context"
    58  	"encoding/json"
    59  	"errors"
    60  	"fmt"
    61  	"io"
    62  	"net/http"
    63  	"net/url"
    64  	"strconv"
    65  	"strings"
    66  
    67  	googleapi "google.golang.org/api/googleapi"
    68  	internal "google.golang.org/api/internal"
    69  	gensupport "google.golang.org/api/internal/gensupport"
    70  	option "google.golang.org/api/option"
    71  	internaloption "google.golang.org/api/option/internaloption"
    72  	htransport "google.golang.org/api/transport/http"
    73  )
    74  
    75  // Always reference these packages, just in case the auto-generated code
    76  // below doesn't.
    77  var _ = bytes.NewBuffer
    78  var _ = strconv.Itoa
    79  var _ = fmt.Sprintf
    80  var _ = json.NewDecoder
    81  var _ = io.Copy
    82  var _ = url.Parse
    83  var _ = gensupport.MarshalJSON
    84  var _ = googleapi.Version
    85  var _ = errors.New
    86  var _ = strings.Replace
    87  var _ = context.Canceled
    88  var _ = internaloption.WithDefaultEndpoint
    89  var _ = internal.Version
    90  
    91  const apiId = "speech:v1"
    92  const apiName = "speech"
    93  const apiVersion = "v1"
    94  const basePath = "https://speech.googleapis.com/"
    95  const basePathTemplate = "https://speech.UNIVERSE_DOMAIN/"
    96  const mtlsBasePath = "https://speech.mtls.googleapis.com/"
    97  
    98  // OAuth2 scopes used by this API.
    99  const (
   100  	// See, edit, configure, and delete your Google Cloud data and see the email
   101  	// address for your Google Account.
   102  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   103  )
   104  
   105  // NewService creates a new Service.
   106  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   107  	scopesOption := internaloption.WithDefaultScopes(
   108  		"https://www.googleapis.com/auth/cloud-platform",
   109  	)
   110  	// NOTE: prepend, so we don't override user-specified scopes.
   111  	opts = append([]option.ClientOption{scopesOption}, opts...)
   112  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   113  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   114  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   115  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   116  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	s, err := New(client)
   121  	if err != nil {
   122  		return nil, err
   123  	}
   124  	if endpoint != "" {
   125  		s.BasePath = endpoint
   126  	}
   127  	return s, nil
   128  }
   129  
   130  // New creates a new Service. It uses the provided http.Client for requests.
   131  //
   132  // Deprecated: please use NewService instead.
   133  // To provide a custom HTTP client, use option.WithHTTPClient.
   134  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   135  func New(client *http.Client) (*Service, error) {
   136  	if client == nil {
   137  		return nil, errors.New("client is nil")
   138  	}
   139  	s := &Service{client: client, BasePath: basePath}
   140  	s.Operations = NewOperationsService(s)
   141  	s.Projects = NewProjectsService(s)
   142  	s.Speech = NewSpeechService(s)
   143  	return s, nil
   144  }
   145  
   146  type Service struct {
   147  	client    *http.Client
   148  	BasePath  string // API endpoint base URL
   149  	UserAgent string // optional additional User-Agent fragment
   150  
   151  	Operations *OperationsService
   152  
   153  	Projects *ProjectsService
   154  
   155  	Speech *SpeechService
   156  }
   157  
   158  func (s *Service) userAgent() string {
   159  	if s.UserAgent == "" {
   160  		return googleapi.UserAgent
   161  	}
   162  	return googleapi.UserAgent + " " + s.UserAgent
   163  }
   164  
   165  func NewOperationsService(s *Service) *OperationsService {
   166  	rs := &OperationsService{s: s}
   167  	return rs
   168  }
   169  
   170  type OperationsService struct {
   171  	s *Service
   172  }
   173  
   174  func NewProjectsService(s *Service) *ProjectsService {
   175  	rs := &ProjectsService{s: s}
   176  	rs.Locations = NewProjectsLocationsService(s)
   177  	return rs
   178  }
   179  
   180  type ProjectsService struct {
   181  	s *Service
   182  
   183  	Locations *ProjectsLocationsService
   184  }
   185  
   186  func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
   187  	rs := &ProjectsLocationsService{s: s}
   188  	rs.CustomClasses = NewProjectsLocationsCustomClassesService(s)
   189  	rs.PhraseSets = NewProjectsLocationsPhraseSetsService(s)
   190  	return rs
   191  }
   192  
   193  type ProjectsLocationsService struct {
   194  	s *Service
   195  
   196  	CustomClasses *ProjectsLocationsCustomClassesService
   197  
   198  	PhraseSets *ProjectsLocationsPhraseSetsService
   199  }
   200  
   201  func NewProjectsLocationsCustomClassesService(s *Service) *ProjectsLocationsCustomClassesService {
   202  	rs := &ProjectsLocationsCustomClassesService{s: s}
   203  	return rs
   204  }
   205  
   206  type ProjectsLocationsCustomClassesService struct {
   207  	s *Service
   208  }
   209  
   210  func NewProjectsLocationsPhraseSetsService(s *Service) *ProjectsLocationsPhraseSetsService {
   211  	rs := &ProjectsLocationsPhraseSetsService{s: s}
   212  	return rs
   213  }
   214  
   215  type ProjectsLocationsPhraseSetsService struct {
   216  	s *Service
   217  }
   218  
   219  func NewSpeechService(s *Service) *SpeechService {
   220  	rs := &SpeechService{s: s}
   221  	return rs
   222  }
   223  
   224  type SpeechService struct {
   225  	s *Service
   226  }
   227  
   228  type ABNFGrammar struct {
   229  	// AbnfStrings: All declarations and rules of an ABNF grammar broken up into
   230  	// multiple strings that will end up concatenated.
   231  	AbnfStrings []string `json:"abnfStrings,omitempty"`
   232  	// ForceSendFields is a list of field names (e.g. "AbnfStrings") to
   233  	// unconditionally include in API requests. By default, fields with empty or
   234  	// default values are omitted from API requests. See
   235  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   236  	// details.
   237  	ForceSendFields []string `json:"-"`
   238  	// NullFields is a list of field names (e.g. "AbnfStrings") to include in API
   239  	// requests with the JSON null value. By default, fields with empty values are
   240  	// omitted from API requests. See
   241  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   242  	NullFields []string `json:"-"`
   243  }
   244  
   245  func (s *ABNFGrammar) MarshalJSON() ([]byte, error) {
   246  	type NoMethod ABNFGrammar
   247  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   248  }
   249  
   250  // ClassItem: An item of the class.
   251  type ClassItem struct {
   252  	// Value: The class item's value.
   253  	Value string `json:"value,omitempty"`
   254  	// ForceSendFields is a list of field names (e.g. "Value") to unconditionally
   255  	// include in API requests. By default, fields with empty or default values are
   256  	// omitted from API requests. See
   257  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   258  	// details.
   259  	ForceSendFields []string `json:"-"`
   260  	// NullFields is a list of field names (e.g. "Value") to include in API
   261  	// requests with the JSON null value. By default, fields with empty values are
   262  	// omitted from API requests. See
   263  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   264  	NullFields []string `json:"-"`
   265  }
   266  
   267  func (s *ClassItem) MarshalJSON() ([]byte, error) {
   268  	type NoMethod ClassItem
   269  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   270  }
   271  
   272  // CreateCustomClassRequest: Message sent by the client for the
   273  // `CreateCustomClass` method.
   274  type CreateCustomClassRequest struct {
   275  	// CustomClass: Required. The custom class to create.
   276  	CustomClass *CustomClass `json:"customClass,omitempty"`
   277  	// CustomClassId: Required. The ID to use for the custom class, which will
   278  	// become the final component of the custom class' resource name. This value
   279  	// should restrict to letters, numbers, and hyphens, with the first character a
   280  	// letter, the last a letter or a number, and be 4-63 characters.
   281  	CustomClassId string `json:"customClassId,omitempty"`
   282  	// ForceSendFields is a list of field names (e.g. "CustomClass") to
   283  	// unconditionally include in API requests. By default, fields with empty or
   284  	// default values are omitted from API requests. See
   285  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   286  	// details.
   287  	ForceSendFields []string `json:"-"`
   288  	// NullFields is a list of field names (e.g. "CustomClass") to include in API
   289  	// requests with the JSON null value. By default, fields with empty values are
   290  	// omitted from API requests. See
   291  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   292  	NullFields []string `json:"-"`
   293  }
   294  
   295  func (s *CreateCustomClassRequest) MarshalJSON() ([]byte, error) {
   296  	type NoMethod CreateCustomClassRequest
   297  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   298  }
   299  
   300  // CreatePhraseSetRequest: Message sent by the client for the `CreatePhraseSet`
   301  // method.
   302  type CreatePhraseSetRequest struct {
   303  	// PhraseSet: Required. The phrase set to create.
   304  	PhraseSet *PhraseSet `json:"phraseSet,omitempty"`
   305  	// PhraseSetId: Required. The ID to use for the phrase set, which will become
   306  	// the final component of the phrase set's resource name. This value should
   307  	// restrict to letters, numbers, and hyphens, with the first character a
   308  	// letter, the last a letter or a number, and be 4-63 characters.
   309  	PhraseSetId string `json:"phraseSetId,omitempty"`
   310  	// ForceSendFields is a list of field names (e.g. "PhraseSet") to
   311  	// unconditionally include in API requests. By default, fields with empty or
   312  	// default values are omitted from API requests. See
   313  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   314  	// details.
   315  	ForceSendFields []string `json:"-"`
   316  	// NullFields is a list of field names (e.g. "PhraseSet") to include in API
   317  	// requests with the JSON null value. By default, fields with empty values are
   318  	// omitted from API requests. See
   319  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   320  	NullFields []string `json:"-"`
   321  }
   322  
   323  func (s *CreatePhraseSetRequest) MarshalJSON() ([]byte, error) {
   324  	type NoMethod CreatePhraseSetRequest
   325  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   326  }
   327  
   328  // CustomClass: A set of words or phrases that represents a common concept
   329  // likely to appear in your audio, for example a list of passenger ship names.
   330  // CustomClass items can be substituted into placeholders that you set in
   331  // PhraseSet phrases.
   332  type CustomClass struct {
   333  	// Annotations: Output only. Allows users to store small amounts of arbitrary
   334  	// data. Both the key and the value must be 63 characters or less each. At most
   335  	// 100 annotations. This field is not used.
   336  	Annotations map[string]string `json:"annotations,omitempty"`
   337  	// CustomClassId: If this custom class is a resource, the custom_class_id is
   338  	// the resource id of the CustomClass. Case sensitive.
   339  	CustomClassId string `json:"customClassId,omitempty"`
   340  	// DeleteTime: Output only. The time at which this resource was requested for
   341  	// deletion. This field is not used.
   342  	DeleteTime string `json:"deleteTime,omitempty"`
   343  	// DisplayName: Output only. User-settable, human-readable name for the
   344  	// CustomClass. Must be 63 characters or less. This field is not used.
   345  	DisplayName string `json:"displayName,omitempty"`
   346  	// Etag: Output only. This checksum is computed by the server based on the
   347  	// value of other fields. This may be sent on update, undelete, and delete
   348  	// requests to ensure the client has an up-to-date value before proceeding.
   349  	// This field is not used.
   350  	Etag string `json:"etag,omitempty"`
   351  	// ExpireTime: Output only. The time at which this resource will be purged.
   352  	// This field is not used.
   353  	ExpireTime string `json:"expireTime,omitempty"`
   354  	// Items: A collection of class items.
   355  	Items []*ClassItem `json:"items,omitempty"`
   356  	// KmsKeyName: Output only. The KMS key name
   357  	// (https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which the
   358  	// content of the ClassItem is encrypted. The expected format is
   359  	// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryp
   360  	// to_key}`.
   361  	KmsKeyName string `json:"kmsKeyName,omitempty"`
   362  	// KmsKeyVersionName: Output only. The KMS key version name
   363  	// (https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) with
   364  	// which content of the ClassItem is encrypted. The expected format is
   365  	// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryp
   366  	// to_key}/cryptoKeyVersions/{crypto_key_version}`.
   367  	KmsKeyVersionName string `json:"kmsKeyVersionName,omitempty"`
   368  	// Name: The resource name of the custom class.
   369  	Name string `json:"name,omitempty"`
   370  	// Reconciling: Output only. Whether or not this CustomClass is in the process
   371  	// of being updated. This field is not used.
   372  	Reconciling bool `json:"reconciling,omitempty"`
   373  	// State: Output only. The CustomClass lifecycle state. This field is not used.
   374  	//
   375  	// Possible values:
   376  	//   "STATE_UNSPECIFIED" - Unspecified state. This is only used/useful for
   377  	// distinguishing unset values.
   378  	//   "ACTIVE" - The normal and active state.
   379  	//   "DELETED" - This CustomClass has been deleted.
   380  	State string `json:"state,omitempty"`
   381  	// Uid: Output only. System-assigned unique identifier for the CustomClass.
   382  	// This field is not used.
   383  	Uid string `json:"uid,omitempty"`
   384  
   385  	// ServerResponse contains the HTTP response code and headers from the server.
   386  	googleapi.ServerResponse `json:"-"`
   387  	// ForceSendFields is a list of field names (e.g. "Annotations") to
   388  	// unconditionally include in API requests. By default, fields with empty or
   389  	// default values are omitted from API requests. See
   390  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   391  	// details.
   392  	ForceSendFields []string `json:"-"`
   393  	// NullFields is a list of field names (e.g. "Annotations") to include in API
   394  	// requests with the JSON null value. By default, fields with empty values are
   395  	// omitted from API requests. See
   396  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   397  	NullFields []string `json:"-"`
   398  }
   399  
   400  func (s *CustomClass) MarshalJSON() ([]byte, error) {
   401  	type NoMethod CustomClass
   402  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   403  }
   404  
   405  // Empty: A generic empty message that you can re-use to avoid defining
   406  // duplicated empty messages in your APIs. A typical example is to use it as
   407  // the request or the response type of an API method. For instance: service Foo
   408  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   409  type Empty struct {
   410  	// ServerResponse contains the HTTP response code and headers from the server.
   411  	googleapi.ServerResponse `json:"-"`
   412  }
   413  
   414  // Entry: A single replacement configuration.
   415  type Entry struct {
   416  	// CaseSensitive: Whether the search is case sensitive.
   417  	CaseSensitive bool `json:"caseSensitive,omitempty"`
   418  	// Replace: What to replace with. Max length is 100 characters.
   419  	Replace string `json:"replace,omitempty"`
   420  	// Search: What to replace. Max length is 100 characters.
   421  	Search string `json:"search,omitempty"`
   422  	// ForceSendFields is a list of field names (e.g. "CaseSensitive") to
   423  	// unconditionally include in API requests. By default, fields with empty or
   424  	// default values are omitted from API requests. See
   425  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   426  	// details.
   427  	ForceSendFields []string `json:"-"`
   428  	// NullFields is a list of field names (e.g. "CaseSensitive") to include in API
   429  	// requests with the JSON null value. By default, fields with empty values are
   430  	// omitted from API requests. See
   431  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   432  	NullFields []string `json:"-"`
   433  }
   434  
   435  func (s *Entry) MarshalJSON() ([]byte, error) {
   436  	type NoMethod Entry
   437  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   438  }
   439  
   440  // ListCustomClassesResponse: Message returned to the client by the
   441  // `ListCustomClasses` method.
   442  type ListCustomClassesResponse struct {
   443  	// CustomClasses: The custom classes.
   444  	CustomClasses []*CustomClass `json:"customClasses,omitempty"`
   445  	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
   446  	// next page. If this field is omitted, there are no subsequent pages.
   447  	NextPageToken string `json:"nextPageToken,omitempty"`
   448  
   449  	// ServerResponse contains the HTTP response code and headers from the server.
   450  	googleapi.ServerResponse `json:"-"`
   451  	// ForceSendFields is a list of field names (e.g. "CustomClasses") to
   452  	// unconditionally include in API requests. By default, fields with empty or
   453  	// default values are omitted from API requests. See
   454  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   455  	// details.
   456  	ForceSendFields []string `json:"-"`
   457  	// NullFields is a list of field names (e.g. "CustomClasses") to include in API
   458  	// requests with the JSON null value. By default, fields with empty values are
   459  	// omitted from API requests. See
   460  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   461  	NullFields []string `json:"-"`
   462  }
   463  
   464  func (s *ListCustomClassesResponse) MarshalJSON() ([]byte, error) {
   465  	type NoMethod ListCustomClassesResponse
   466  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   467  }
   468  
   469  // ListOperationsResponse: The response message for Operations.ListOperations.
   470  type ListOperationsResponse struct {
   471  	// NextPageToken: The standard List next-page token.
   472  	NextPageToken string `json:"nextPageToken,omitempty"`
   473  	// Operations: A list of operations that matches the specified filter in the
   474  	// request.
   475  	Operations []*Operation `json:"operations,omitempty"`
   476  
   477  	// ServerResponse contains the HTTP response code and headers from the server.
   478  	googleapi.ServerResponse `json:"-"`
   479  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   480  	// unconditionally include in API requests. By default, fields with empty or
   481  	// default values are omitted from API requests. See
   482  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   483  	// details.
   484  	ForceSendFields []string `json:"-"`
   485  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   486  	// requests with the JSON null value. By default, fields with empty values are
   487  	// omitted from API requests. See
   488  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   489  	NullFields []string `json:"-"`
   490  }
   491  
   492  func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
   493  	type NoMethod ListOperationsResponse
   494  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   495  }
   496  
   497  // ListPhraseSetResponse: Message returned to the client by the `ListPhraseSet`
   498  // method.
   499  type ListPhraseSetResponse struct {
   500  	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
   501  	// next page. If this field is omitted, there are no subsequent pages.
   502  	NextPageToken string `json:"nextPageToken,omitempty"`
   503  	// PhraseSets: The phrase set.
   504  	PhraseSets []*PhraseSet `json:"phraseSets,omitempty"`
   505  
   506  	// ServerResponse contains the HTTP response code and headers from the server.
   507  	googleapi.ServerResponse `json:"-"`
   508  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   509  	// unconditionally include in API requests. By default, fields with empty or
   510  	// default values are omitted from API requests. See
   511  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   512  	// details.
   513  	ForceSendFields []string `json:"-"`
   514  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   515  	// requests with the JSON null value. By default, fields with empty values are
   516  	// omitted from API requests. See
   517  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   518  	NullFields []string `json:"-"`
   519  }
   520  
   521  func (s *ListPhraseSetResponse) MarshalJSON() ([]byte, error) {
   522  	type NoMethod ListPhraseSetResponse
   523  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   524  }
   525  
   526  // LongRunningRecognizeMetadata: Describes the progress of a long-running
   527  // `LongRunningRecognize` call. It is included in the `metadata` field of the
   528  // `Operation` returned by the `GetOperation` call of the
   529  // `google::longrunning::Operations` service.
   530  type LongRunningRecognizeMetadata struct {
   531  	// LastUpdateTime: Time of the most recent processing update.
   532  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
   533  	// ProgressPercent: Approximate percentage of audio processed thus far.
   534  	// Guaranteed to be 100 when the audio is fully processed and the results are
   535  	// available.
   536  	ProgressPercent int64 `json:"progressPercent,omitempty"`
   537  	// StartTime: Time when the request was received.
   538  	StartTime string `json:"startTime,omitempty"`
   539  	// Uri: Output only. The URI of the audio file being transcribed. Empty if the
   540  	// audio was sent as byte content.
   541  	Uri string `json:"uri,omitempty"`
   542  	// ForceSendFields is a list of field names (e.g. "LastUpdateTime") to
   543  	// unconditionally include in API requests. By default, fields with empty or
   544  	// default values are omitted from API requests. See
   545  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   546  	// details.
   547  	ForceSendFields []string `json:"-"`
   548  	// NullFields is a list of field names (e.g. "LastUpdateTime") to include in
   549  	// API requests with the JSON null value. By default, fields with empty values
   550  	// are omitted from API requests. See
   551  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   552  	NullFields []string `json:"-"`
   553  }
   554  
   555  func (s *LongRunningRecognizeMetadata) MarshalJSON() ([]byte, error) {
   556  	type NoMethod LongRunningRecognizeMetadata
   557  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   558  }
   559  
   560  // LongRunningRecognizeRequest: The top-level message sent by the client for
   561  // the `LongRunningRecognize` method.
   562  type LongRunningRecognizeRequest struct {
   563  	// Audio: Required. The audio data to be recognized.
   564  	Audio *RecognitionAudio `json:"audio,omitempty"`
   565  	// Config: Required. Provides information to the recognizer that specifies how
   566  	// to process the request.
   567  	Config *RecognitionConfig `json:"config,omitempty"`
   568  	// OutputConfig: Optional. Specifies an optional destination for the
   569  	// recognition results.
   570  	OutputConfig *TranscriptOutputConfig `json:"outputConfig,omitempty"`
   571  	// ForceSendFields is a list of field names (e.g. "Audio") to unconditionally
   572  	// include in API requests. By default, fields with empty or default values are
   573  	// omitted from API requests. See
   574  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   575  	// details.
   576  	ForceSendFields []string `json:"-"`
   577  	// NullFields is a list of field names (e.g. "Audio") to include in API
   578  	// requests with the JSON null value. By default, fields with empty values are
   579  	// omitted from API requests. See
   580  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   581  	NullFields []string `json:"-"`
   582  }
   583  
   584  func (s *LongRunningRecognizeRequest) MarshalJSON() ([]byte, error) {
   585  	type NoMethod LongRunningRecognizeRequest
   586  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   587  }
   588  
   589  // LongRunningRecognizeResponse: The only message returned to the client by the
   590  // `LongRunningRecognize` method. It contains the result as zero or more
   591  // sequential `SpeechRecognitionResult` messages. It is included in the
   592  // `result.response` field of the `Operation` returned by the `GetOperation`
   593  // call of the `google::longrunning::Operations` service.
   594  type LongRunningRecognizeResponse struct {
   595  	// OutputConfig: Original output config if present in the request.
   596  	OutputConfig *TranscriptOutputConfig `json:"outputConfig,omitempty"`
   597  	// OutputError: If the transcript output fails this field contains the relevant
   598  	// error.
   599  	OutputError *Status `json:"outputError,omitempty"`
   600  	// RequestId: The ID associated with the request. This is a unique ID specific
   601  	// only to the given request.
   602  	RequestId int64 `json:"requestId,omitempty,string"`
   603  	// Results: Sequential list of transcription results corresponding to
   604  	// sequential portions of audio.
   605  	Results []*SpeechRecognitionResult `json:"results,omitempty"`
   606  	// SpeechAdaptationInfo: Provides information on speech adaptation behavior in
   607  	// response
   608  	SpeechAdaptationInfo *SpeechAdaptationInfo `json:"speechAdaptationInfo,omitempty"`
   609  	// TotalBilledTime: When available, billed audio seconds for the corresponding
   610  	// request.
   611  	TotalBilledTime string `json:"totalBilledTime,omitempty"`
   612  	// ForceSendFields is a list of field names (e.g. "OutputConfig") to
   613  	// unconditionally include in API requests. By default, fields with empty or
   614  	// default values are omitted from API requests. See
   615  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   616  	// details.
   617  	ForceSendFields []string `json:"-"`
   618  	// NullFields is a list of field names (e.g. "OutputConfig") to include in API
   619  	// requests with the JSON null value. By default, fields with empty values are
   620  	// omitted from API requests. See
   621  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   622  	NullFields []string `json:"-"`
   623  }
   624  
   625  func (s *LongRunningRecognizeResponse) MarshalJSON() ([]byte, error) {
   626  	type NoMethod LongRunningRecognizeResponse
   627  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   628  }
   629  
   630  // Operation: This resource represents a long-running operation that is the
   631  // result of a network API call.
   632  type Operation struct {
   633  	// Done: If the value is `false`, it means the operation is still in progress.
   634  	// If `true`, the operation is completed, and either `error` or `response` is
   635  	// available.
   636  	Done bool `json:"done,omitempty"`
   637  	// Error: The error result of the operation in case of failure or cancellation.
   638  	Error *Status `json:"error,omitempty"`
   639  	// Metadata: Service-specific metadata associated with the operation. It
   640  	// typically contains progress information and common metadata such as create
   641  	// time. Some services might not provide such metadata. Any method that returns
   642  	// a long-running operation should document the metadata type, if any.
   643  	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
   644  	// Name: The server-assigned name, which is only unique within the same service
   645  	// that originally returns it. If you use the default HTTP mapping, the `name`
   646  	// should be a resource name ending with `operations/{unique_id}`.
   647  	Name string `json:"name,omitempty"`
   648  	// Response: The normal, successful response of the operation. If the original
   649  	// method returns no data on success, such as `Delete`, the response is
   650  	// `google.protobuf.Empty`. If the original method is standard
   651  	// `Get`/`Create`/`Update`, the response should be the resource. For other
   652  	// methods, the response should have the type `XxxResponse`, where `Xxx` is the
   653  	// original method name. For example, if the original method name is
   654  	// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
   655  	Response googleapi.RawMessage `json:"response,omitempty"`
   656  
   657  	// ServerResponse contains the HTTP response code and headers from the server.
   658  	googleapi.ServerResponse `json:"-"`
   659  	// ForceSendFields is a list of field names (e.g. "Done") to unconditionally
   660  	// include in API requests. By default, fields with empty or default values are
   661  	// omitted from API requests. See
   662  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   663  	// details.
   664  	ForceSendFields []string `json:"-"`
   665  	// NullFields is a list of field names (e.g. "Done") to include in API requests
   666  	// with the JSON null value. By default, fields with empty values are omitted
   667  	// from API requests. See
   668  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   669  	NullFields []string `json:"-"`
   670  }
   671  
   672  func (s *Operation) MarshalJSON() ([]byte, error) {
   673  	type NoMethod Operation
   674  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   675  }
   676  
   677  // Phrase: A phrases containing words and phrase "hints" so that the speech
   678  // recognition is more likely to recognize them. This can be used to improve
   679  // the accuracy for specific words and phrases, for example, if specific
   680  // commands are typically spoken by the user. This can also be used to add
   681  // additional words to the vocabulary of the recognizer. See usage limits
   682  // (https://cloud.google.com/speech-to-text/quotas#content). List items can
   683  // also include pre-built or custom classes containing groups of words that
   684  // represent common concepts that occur in natural language. For example,
   685  // rather than providing a phrase hint for every month of the year (e.g. "i was
   686  // born in january", "i was born in febuary", ...), use the pre-built `$MONTH`
   687  // class improves the likelihood of correctly transcribing audio that includes
   688  // months (e.g. "i was born in $month"). To refer to pre-built classes, use the
   689  // class' symbol prepended with `$` e.g. `$MONTH`. To refer to custom classes
   690  // that were defined inline in the request, set the class's `custom_class_id`
   691  // to a string unique to all class resources and inline classes. Then use the
   692  // class' id wrapped in $`{...}` e.g. "${my-months}". To refer to custom
   693  // classes resources, use the class' id wrapped in `${}` (e.g. `${my-months}`).
   694  // Speech-to-Text supports three locations: `global`, `us` (US North America),
   695  // and `eu` (Europe). If you are calling the `speech.googleapis.com` endpoint,
   696  // use the `global` location. To specify a region, use a regional endpoint
   697  // (https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us`
   698  // or `eu` location value.
   699  type Phrase struct {
   700  	// Boost: Hint Boost. Overrides the boost set at the phrase set level. Positive
   701  	// value will increase the probability that a specific phrase will be
   702  	// recognized over other similar sounding phrases. The higher the boost, the
   703  	// higher the chance of false positive recognition as well. Negative boost will
   704  	// simply be ignored. Though `boost` can accept a wide range of positive
   705  	// values, most use cases are best served with values between 0 and 20. We
   706  	// recommend using a binary search approach to finding the optimal value for
   707  	// your use case as well as adding phrases both with and without boost to your
   708  	// requests.
   709  	Boost float64 `json:"boost,omitempty"`
   710  	// Value: The phrase itself.
   711  	Value string `json:"value,omitempty"`
   712  	// ForceSendFields is a list of field names (e.g. "Boost") to unconditionally
   713  	// include in API requests. By default, fields with empty or default values are
   714  	// omitted from API requests. See
   715  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   716  	// details.
   717  	ForceSendFields []string `json:"-"`
   718  	// NullFields is a list of field names (e.g. "Boost") to include in API
   719  	// requests with the JSON null value. By default, fields with empty values are
   720  	// omitted from API requests. See
   721  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   722  	NullFields []string `json:"-"`
   723  }
   724  
   725  func (s *Phrase) MarshalJSON() ([]byte, error) {
   726  	type NoMethod Phrase
   727  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   728  }
   729  
   730  func (s *Phrase) UnmarshalJSON(data []byte) error {
   731  	type NoMethod Phrase
   732  	var s1 struct {
   733  		Boost gensupport.JSONFloat64 `json:"boost"`
   734  		*NoMethod
   735  	}
   736  	s1.NoMethod = (*NoMethod)(s)
   737  	if err := json.Unmarshal(data, &s1); err != nil {
   738  		return err
   739  	}
   740  	s.Boost = float64(s1.Boost)
   741  	return nil
   742  }
   743  
   744  // PhraseSet: Provides "hints" to the speech recognizer to favor specific words
   745  // and phrases in the results.
   746  type PhraseSet struct {
   747  	// Annotations: Output only. Allows users to store small amounts of arbitrary
   748  	// data. Both the key and the value must be 63 characters or less each. At most
   749  	// 100 annotations. This field is not used.
   750  	Annotations map[string]string `json:"annotations,omitempty"`
   751  	// Boost: Hint Boost. Positive value will increase the probability that a
   752  	// specific phrase will be recognized over other similar sounding phrases. The
   753  	// higher the boost, the higher the chance of false positive recognition as
   754  	// well. Negative boost values would correspond to anti-biasing. Anti-biasing
   755  	// is not enabled, so negative boost will simply be ignored. Though `boost` can
   756  	// accept a wide range of positive values, most use cases are best served with
   757  	// values between 0 (exclusive) and 20. We recommend using a binary search
   758  	// approach to finding the optimal value for your use case as well as adding
   759  	// phrases both with and without boost to your requests.
   760  	Boost float64 `json:"boost,omitempty"`
   761  	// DeleteTime: Output only. The time at which this resource was requested for
   762  	// deletion. This field is not used.
   763  	DeleteTime string `json:"deleteTime,omitempty"`
   764  	// DisplayName: Output only. User-settable, human-readable name for the
   765  	// PhraseSet. Must be 63 characters or less. This field is not used.
   766  	DisplayName string `json:"displayName,omitempty"`
   767  	// Etag: Output only. This checksum is computed by the server based on the
   768  	// value of other fields. This may be sent on update, undelete, and delete
   769  	// requests to ensure the client has an up-to-date value before proceeding.
   770  	// This field is not used.
   771  	Etag string `json:"etag,omitempty"`
   772  	// ExpireTime: Output only. The time at which this resource will be purged.
   773  	// This field is not used.
   774  	ExpireTime string `json:"expireTime,omitempty"`
   775  	// KmsKeyName: Output only. The KMS key name
   776  	// (https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which the
   777  	// content of the PhraseSet is encrypted. The expected format is
   778  	// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryp
   779  	// to_key}`.
   780  	KmsKeyName string `json:"kmsKeyName,omitempty"`
   781  	// KmsKeyVersionName: Output only. The KMS key version name
   782  	// (https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) with
   783  	// which content of the PhraseSet is encrypted. The expected format is
   784  	// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryp
   785  	// to_key}/cryptoKeyVersions/{crypto_key_version}`.
   786  	KmsKeyVersionName string `json:"kmsKeyVersionName,omitempty"`
   787  	// Name: The resource name of the phrase set.
   788  	Name string `json:"name,omitempty"`
   789  	// Phrases: A list of word and phrases.
   790  	Phrases []*Phrase `json:"phrases,omitempty"`
   791  	// Reconciling: Output only. Whether or not this PhraseSet is in the process of
   792  	// being updated. This field is not used.
   793  	Reconciling bool `json:"reconciling,omitempty"`
   794  	// State: Output only. The CustomClass lifecycle state. This field is not used.
   795  	//
   796  	// Possible values:
   797  	//   "STATE_UNSPECIFIED" - Unspecified state. This is only used/useful for
   798  	// distinguishing unset values.
   799  	//   "ACTIVE" - The normal and active state.
   800  	//   "DELETED" - This CustomClass has been deleted.
   801  	State string `json:"state,omitempty"`
   802  	// Uid: Output only. System-assigned unique identifier for the PhraseSet. This
   803  	// field is not used.
   804  	Uid string `json:"uid,omitempty"`
   805  
   806  	// ServerResponse contains the HTTP response code and headers from the server.
   807  	googleapi.ServerResponse `json:"-"`
   808  	// ForceSendFields is a list of field names (e.g. "Annotations") to
   809  	// unconditionally include in API requests. By default, fields with empty or
   810  	// default values are omitted from API requests. See
   811  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   812  	// details.
   813  	ForceSendFields []string `json:"-"`
   814  	// NullFields is a list of field names (e.g. "Annotations") to include in API
   815  	// requests with the JSON null value. By default, fields with empty values are
   816  	// omitted from API requests. See
   817  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   818  	NullFields []string `json:"-"`
   819  }
   820  
   821  func (s *PhraseSet) MarshalJSON() ([]byte, error) {
   822  	type NoMethod PhraseSet
   823  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   824  }
   825  
   826  func (s *PhraseSet) UnmarshalJSON(data []byte) error {
   827  	type NoMethod PhraseSet
   828  	var s1 struct {
   829  		Boost gensupport.JSONFloat64 `json:"boost"`
   830  		*NoMethod
   831  	}
   832  	s1.NoMethod = (*NoMethod)(s)
   833  	if err := json.Unmarshal(data, &s1); err != nil {
   834  		return err
   835  	}
   836  	s.Boost = float64(s1.Boost)
   837  	return nil
   838  }
   839  
   840  // RecognitionAudio: Contains audio data in the encoding specified in the
   841  // `RecognitionConfig`. Either `content` or `uri` must be supplied. Supplying
   842  // both or neither returns google.rpc.Code.INVALID_ARGUMENT. See content limits
   843  // (https://cloud.google.com/speech-to-text/quotas#content).
   844  type RecognitionAudio struct {
   845  	// Content: The audio data bytes encoded as specified in `RecognitionConfig`.
   846  	// Note: as with all bytes fields, proto buffers use a pure binary
   847  	// representation, whereas JSON representations use base64.
   848  	Content string `json:"content,omitempty"`
   849  	// Uri: URI that points to a file that contains audio data bytes as specified
   850  	// in `RecognitionConfig`. The file must not be compressed (for example, gzip).
   851  	// Currently, only Google Cloud Storage URIs are supported, which must be
   852  	// specified in the following format: `gs://bucket_name/object_name` (other URI
   853  	// formats return google.rpc.Code.INVALID_ARGUMENT). For more information, see
   854  	// Request URIs (https://cloud.google.com/storage/docs/reference-uris).
   855  	Uri string `json:"uri,omitempty"`
   856  	// ForceSendFields is a list of field names (e.g. "Content") to unconditionally
   857  	// include in API requests. By default, fields with empty or default values are
   858  	// omitted from API requests. See
   859  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   860  	// details.
   861  	ForceSendFields []string `json:"-"`
   862  	// NullFields is a list of field names (e.g. "Content") to include in API
   863  	// requests with the JSON null value. By default, fields with empty values are
   864  	// omitted from API requests. See
   865  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   866  	NullFields []string `json:"-"`
   867  }
   868  
   869  func (s *RecognitionAudio) MarshalJSON() ([]byte, error) {
   870  	type NoMethod RecognitionAudio
   871  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   872  }
   873  
   874  // RecognitionConfig: Provides information to the recognizer that specifies how
   875  // to process the request.
   876  type RecognitionConfig struct {
   877  	// Adaptation: Speech adaptation configuration improves the accuracy of speech
   878  	// recognition. For more information, see the speech adaptation
   879  	// (https://cloud.google.com/speech-to-text/docs/adaptation) documentation.
   880  	// When speech adaptation is set it supersedes the `speech_contexts` field.
   881  	Adaptation *SpeechAdaptation `json:"adaptation,omitempty"`
   882  	// AlternativeLanguageCodes: A list of up to 3 additional BCP-47
   883  	// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags, listing
   884  	// possible alternative languages of the supplied audio. See Language Support
   885  	// (https://cloud.google.com/speech-to-text/docs/languages) for a list of the
   886  	// currently supported language codes. If alternative languages are listed,
   887  	// recognition result will contain recognition in the most likely language
   888  	// detected including the main language_code. The recognition result will
   889  	// include the language tag of the language detected in the audio. Note: This
   890  	// feature is only supported for Voice Command and Voice Search use cases and
   891  	// performance may vary for other use cases (e.g., phone call transcription).
   892  	AlternativeLanguageCodes []string `json:"alternativeLanguageCodes,omitempty"`
   893  	// AudioChannelCount: The number of channels in the input audio data. ONLY set
   894  	// this for MULTI-CHANNEL recognition. Valid values for LINEAR16, OGG_OPUS and
   895  	// FLAC are `1`-`8`. Valid value for MULAW, AMR, AMR_WB and
   896  	// SPEEX_WITH_HEADER_BYTE is only `1`. If `0` or omitted, defaults to one
   897  	// channel (mono). Note: We only recognize the first channel by default. To
   898  	// perform independent recognition on each channel set
   899  	// `enable_separate_recognition_per_channel` to 'true'.
   900  	AudioChannelCount int64 `json:"audioChannelCount,omitempty"`
   901  	// DiarizationConfig: Config to enable speaker diarization and set additional
   902  	// parameters to make diarization better suited for your application. Note:
   903  	// When this is enabled, we send all the words from the beginning of the audio
   904  	// for the top alternative in every consecutive STREAMING responses. This is
   905  	// done in order to improve our speaker tags as our models learn to identify
   906  	// the speakers in the conversation over time. For non-streaming requests, the
   907  	// diarization results will be provided only in the top alternative of the
   908  	// FINAL SpeechRecognitionResult.
   909  	DiarizationConfig *SpeakerDiarizationConfig `json:"diarizationConfig,omitempty"`
   910  	// EnableAutomaticPunctuation: If 'true', adds punctuation to recognition
   911  	// result hypotheses. This feature is only available in select languages.
   912  	// Setting this for requests in other languages has no effect at all. The
   913  	// default 'false' value does not add punctuation to result hypotheses.
   914  	EnableAutomaticPunctuation bool `json:"enableAutomaticPunctuation,omitempty"`
   915  	// EnableSeparateRecognitionPerChannel: This needs to be set to `true`
   916  	// explicitly and `audio_channel_count` > 1 to get each channel recognized
   917  	// separately. The recognition result will contain a `channel_tag` field to
   918  	// state which channel that result belongs to. If this is not true, we will
   919  	// only recognize the first channel. The request is billed cumulatively for all
   920  	// channels recognized: `audio_channel_count` multiplied by the length of the
   921  	// audio.
   922  	EnableSeparateRecognitionPerChannel bool `json:"enableSeparateRecognitionPerChannel,omitempty"`
   923  	// EnableSpokenEmojis: The spoken emoji behavior for the call If not set, uses
   924  	// default behavior based on model of choice If 'true', adds spoken emoji
   925  	// formatting for the request. This will replace spoken emojis with the
   926  	// corresponding Unicode symbols in the final transcript. If 'false', spoken
   927  	// emojis are not replaced.
   928  	EnableSpokenEmojis bool `json:"enableSpokenEmojis,omitempty"`
   929  	// EnableSpokenPunctuation: The spoken punctuation behavior for the call If not
   930  	// set, uses default behavior based on model of choice e.g. command_and_search
   931  	// will enable spoken punctuation by default If 'true', replaces spoken
   932  	// punctuation with the corresponding symbols in the request. For example, "how
   933  	// are you question mark" becomes "how are you?". See
   934  	// https://cloud.google.com/speech-to-text/docs/spoken-punctuation for support.
   935  	// If 'false', spoken punctuation is not replaced.
   936  	EnableSpokenPunctuation bool `json:"enableSpokenPunctuation,omitempty"`
   937  	// EnableWordConfidence: If `true`, the top result includes a list of words and
   938  	// the confidence for those words. If `false`, no word-level confidence
   939  	// information is returned. The default is `false`.
   940  	EnableWordConfidence bool `json:"enableWordConfidence,omitempty"`
   941  	// EnableWordTimeOffsets: If `true`, the top result includes a list of words
   942  	// and the start and end time offsets (timestamps) for those words. If `false`,
   943  	// no word-level time offset information is returned. The default is `false`.
   944  	EnableWordTimeOffsets bool `json:"enableWordTimeOffsets,omitempty"`
   945  	// Encoding: Encoding of audio data sent in all `RecognitionAudio` messages.
   946  	// This field is optional for `FLAC` and `WAV` audio files and required for all
   947  	// other audio formats. For details, see AudioEncoding.
   948  	//
   949  	// Possible values:
   950  	//   "ENCODING_UNSPECIFIED" - Not specified.
   951  	//   "LINEAR16" - Uncompressed 16-bit signed little-endian samples (Linear
   952  	// PCM).
   953  	//   "FLAC" - `FLAC` (Free Lossless Audio Codec) is the recommended encoding
   954  	// because it is lossless--therefore recognition is not compromised--and
   955  	// requires only about half the bandwidth of `LINEAR16`. `FLAC` stream encoding
   956  	// supports 16-bit and 24-bit samples, however, not all fields in `STREAMINFO`
   957  	// are supported.
   958  	//   "MULAW" - 8-bit samples that compand 14-bit audio samples using G.711
   959  	// PCMU/mu-law.
   960  	//   "AMR" - Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be
   961  	// 8000.
   962  	//   "AMR_WB" - Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be
   963  	// 16000.
   964  	//   "OGG_OPUS" - Opus encoded audio frames in Ogg container
   965  	// ([OggOpus](https://wiki.xiph.org/OggOpus)). `sample_rate_hertz` must be one
   966  	// of 8000, 12000, 16000, 24000, or 48000.
   967  	//   "SPEEX_WITH_HEADER_BYTE" - Although the use of lossy encodings is not
   968  	// recommended, if a very low bitrate encoding is required, `OGG_OPUS` is
   969  	// highly preferred over Speex encoding. The [Speex](https://speex.org/)
   970  	// encoding supported by Cloud Speech API has a header byte in each block, as
   971  	// in MIME type `audio/x-speex-with-header-byte`. It is a variant of the RTP
   972  	// Speex encoding defined in [RFC 5574](https://tools.ietf.org/html/rfc5574).
   973  	// The stream is a sequence of blocks, one block per RTP packet. Each block
   974  	// starts with a byte containing the length of the block, in bytes, followed by
   975  	// one or more frames of Speex data, padded to an integral number of bytes
   976  	// (octets) as specified in RFC 5574. In other words, each RTP header is
   977  	// replaced with a single byte containing the block length. Only Speex wideband
   978  	// is supported. `sample_rate_hertz` must be 16000.
   979  	//   "MP3" - MP3 audio. MP3 encoding is a Beta feature and only available in
   980  	// v1p1beta1. Support all standard MP3 bitrates (which range from 32-320 kbps).
   981  	// When using this encoding, `sample_rate_hertz` has to match the sample rate
   982  	// of the file being used.
   983  	//   "WEBM_OPUS" - Opus encoded audio frames in WebM container
   984  	// ([WebM](https://www.webmproject.org/docs/container/)). `sample_rate_hertz`
   985  	// must be one of 8000, 12000, 16000, 24000, or 48000.
   986  	Encoding string `json:"encoding,omitempty"`
   987  	// LanguageCode: Required. The language of the supplied audio as a BCP-47
   988  	// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. Example:
   989  	// "en-US". See Language Support
   990  	// (https://cloud.google.com/speech-to-text/docs/languages) for a list of the
   991  	// currently supported language codes.
   992  	LanguageCode string `json:"languageCode,omitempty"`
   993  	// MaxAlternatives: Maximum number of recognition hypotheses to be returned.
   994  	// Specifically, the maximum number of `SpeechRecognitionAlternative` messages
   995  	// within each `SpeechRecognitionResult`. The server may return fewer than
   996  	// `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will
   997  	// return a maximum of one. If omitted, will return a maximum of one.
   998  	MaxAlternatives int64 `json:"maxAlternatives,omitempty"`
   999  	// Metadata: Metadata regarding this request.
  1000  	Metadata *RecognitionMetadata `json:"metadata,omitempty"`
  1001  	// Model: Which model to select for the given request. Select the model best
  1002  	// suited to your domain to get best results. If a model is not explicitly
  1003  	// specified, then we auto-select a model based on the parameters in the
  1004  	// RecognitionConfig. *Model* *Description* latest_long Best for long form
  1005  	// content like media or conversation. latest_short Best for short form content
  1006  	// like commands or single shot directed speech. command_and_search Best for
  1007  	// short queries such as voice commands or voice search. phone_call Best for
  1008  	// audio that originated from a phone call (typically recorded at an 8khz
  1009  	// sampling rate). video Best for audio that originated from video or includes
  1010  	// multiple speakers. Ideally the audio is recorded at a 16khz or greater
  1011  	// sampling rate. This is a premium model that costs more than the standard
  1012  	// rate. default Best for audio that is not one of the specific audio models.
  1013  	// For example, long-form audio. Ideally the audio is high-fidelity, recorded
  1014  	// at a 16khz or greater sampling rate. medical_conversation Best for audio
  1015  	// that originated from a conversation between a medical provider and patient.
  1016  	// medical_dictation Best for audio that originated from dictation notes by a
  1017  	// medical provider.
  1018  	Model string `json:"model,omitempty"`
  1019  	// ProfanityFilter: If set to `true`, the server will attempt to filter out
  1020  	// profanities, replacing all but the initial character in each filtered word
  1021  	// with asterisks, e.g. "f***". If set to `false` or omitted, profanities won't
  1022  	// be filtered out.
  1023  	ProfanityFilter bool `json:"profanityFilter,omitempty"`
  1024  	// SampleRateHertz: Sample rate in Hertz of the audio data sent in all
  1025  	// `RecognitionAudio` messages. Valid values are: 8000-48000. 16000 is optimal.
  1026  	// For best results, set the sampling rate of the audio source to 16000 Hz. If
  1027  	// that's not possible, use the native sample rate of the audio source (instead
  1028  	// of re-sampling). This field is optional for FLAC and WAV audio files, but is
  1029  	// required for all other audio formats. For details, see AudioEncoding.
  1030  	SampleRateHertz int64 `json:"sampleRateHertz,omitempty"`
  1031  	// SpeechContexts: Array of SpeechContext. A means to provide context to assist
  1032  	// the speech recognition. For more information, see speech adaptation
  1033  	// (https://cloud.google.com/speech-to-text/docs/adaptation).
  1034  	SpeechContexts []*SpeechContext `json:"speechContexts,omitempty"`
  1035  	// TranscriptNormalization: Optional. Use transcription normalization to
  1036  	// automatically replace parts of the transcript with phrases of your choosing.
  1037  	// For StreamingRecognize, this normalization only applies to stable partial
  1038  	// transcripts (stability > 0.8) and final transcripts.
  1039  	TranscriptNormalization *TranscriptNormalization `json:"transcriptNormalization,omitempty"`
  1040  	// UseEnhanced: Set to true to use an enhanced model for speech recognition. If
  1041  	// `use_enhanced` is set to true and the `model` field is not set, then an
  1042  	// appropriate enhanced model is chosen if an enhanced model exists for the
  1043  	// audio. If `use_enhanced` is true and an enhanced version of the specified
  1044  	// model does not exist, then the speech is recognized using the standard
  1045  	// version of the specified model.
  1046  	UseEnhanced bool `json:"useEnhanced,omitempty"`
  1047  	// ForceSendFields is a list of field names (e.g. "Adaptation") to
  1048  	// unconditionally include in API requests. By default, fields with empty or
  1049  	// default values are omitted from API requests. See
  1050  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1051  	// details.
  1052  	ForceSendFields []string `json:"-"`
  1053  	// NullFields is a list of field names (e.g. "Adaptation") to include in API
  1054  	// requests with the JSON null value. By default, fields with empty values are
  1055  	// omitted from API requests. See
  1056  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1057  	NullFields []string `json:"-"`
  1058  }
  1059  
  1060  func (s *RecognitionConfig) MarshalJSON() ([]byte, error) {
  1061  	type NoMethod RecognitionConfig
  1062  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1063  }
  1064  
  1065  // RecognitionMetadata: Description of audio data to be recognized.
  1066  type RecognitionMetadata struct {
  1067  	// AudioTopic: Description of the content. Eg. "Recordings of federal supreme
  1068  	// court hearings from 2012".
  1069  	AudioTopic string `json:"audioTopic,omitempty"`
  1070  	// IndustryNaicsCodeOfAudio: The industry vertical to which this speech
  1071  	// recognition request most closely applies. This is most indicative of the
  1072  	// topics contained in the audio. Use the 6-digit NAICS code to identify the
  1073  	// industry vertical - see https://www.naics.com/search/.
  1074  	IndustryNaicsCodeOfAudio int64 `json:"industryNaicsCodeOfAudio,omitempty"`
  1075  	// InteractionType: The use case most closely describing the audio content to
  1076  	// be recognized.
  1077  	//
  1078  	// Possible values:
  1079  	//   "INTERACTION_TYPE_UNSPECIFIED" - Use case is either unknown or is
  1080  	// something other than one of the other values below.
  1081  	//   "DISCUSSION" - Multiple people in a conversation or discussion. For
  1082  	// example in a meeting with two or more people actively participating.
  1083  	// Typically all the primary people speaking would be in the same room (if not,
  1084  	// see PHONE_CALL)
  1085  	//   "PRESENTATION" - One or more persons lecturing or presenting to others,
  1086  	// mostly uninterrupted.
  1087  	//   "PHONE_CALL" - A phone-call or video-conference in which two or more
  1088  	// people, who are not in the same room, are actively participating.
  1089  	//   "VOICEMAIL" - A recorded message intended for another person to listen to.
  1090  	//   "PROFESSIONALLY_PRODUCED" - Professionally produced audio (eg. TV Show,
  1091  	// Podcast).
  1092  	//   "VOICE_SEARCH" - Transcribe spoken questions and queries into text.
  1093  	//   "VOICE_COMMAND" - Transcribe voice commands, such as for controlling a
  1094  	// device.
  1095  	//   "DICTATION" - Transcribe speech to text to create a written document, such
  1096  	// as a text-message, email or report.
  1097  	InteractionType string `json:"interactionType,omitempty"`
  1098  	// MicrophoneDistance: The audio type that most closely describes the audio
  1099  	// being recognized.
  1100  	//
  1101  	// Possible values:
  1102  	//   "MICROPHONE_DISTANCE_UNSPECIFIED" - Audio type is not known.
  1103  	//   "NEARFIELD" - The audio was captured from a closely placed microphone. Eg.
  1104  	// phone, dictaphone, or handheld microphone. Generally if there speaker is
  1105  	// within 1 meter of the microphone.
  1106  	//   "MIDFIELD" - The speaker if within 3 meters of the microphone.
  1107  	//   "FARFIELD" - The speaker is more than 3 meters away from the microphone.
  1108  	MicrophoneDistance string `json:"microphoneDistance,omitempty"`
  1109  	// OriginalMediaType: The original media the speech was recorded on.
  1110  	//
  1111  	// Possible values:
  1112  	//   "ORIGINAL_MEDIA_TYPE_UNSPECIFIED" - Unknown original media type.
  1113  	//   "AUDIO" - The speech data is an audio recording.
  1114  	//   "VIDEO" - The speech data originally recorded on a video.
  1115  	OriginalMediaType string `json:"originalMediaType,omitempty"`
  1116  	// OriginalMimeType: Mime type of the original audio file. For example
  1117  	// `audio/m4a`, `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`. A list of
  1118  	// possible audio mime types is maintained at
  1119  	// http://www.iana.org/assignments/media-types/media-types.xhtml#audio
  1120  	OriginalMimeType string `json:"originalMimeType,omitempty"`
  1121  	// RecordingDeviceName: The device used to make the recording. Examples 'Nexus
  1122  	// 5X' or 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or 'Cardioid
  1123  	// Microphone'.
  1124  	RecordingDeviceName string `json:"recordingDeviceName,omitempty"`
  1125  	// RecordingDeviceType: The type of device the speech was recorded with.
  1126  	//
  1127  	// Possible values:
  1128  	//   "RECORDING_DEVICE_TYPE_UNSPECIFIED" - The recording device is unknown.
  1129  	//   "SMARTPHONE" - Speech was recorded on a smartphone.
  1130  	//   "PC" - Speech was recorded using a personal computer or tablet.
  1131  	//   "PHONE_LINE" - Speech was recorded over a phone line.
  1132  	//   "VEHICLE" - Speech was recorded in a vehicle.
  1133  	//   "OTHER_OUTDOOR_DEVICE" - Speech was recorded outdoors.
  1134  	//   "OTHER_INDOOR_DEVICE" - Speech was recorded indoors.
  1135  	RecordingDeviceType string `json:"recordingDeviceType,omitempty"`
  1136  	// ForceSendFields is a list of field names (e.g. "AudioTopic") to
  1137  	// unconditionally include in API requests. By default, fields with empty or
  1138  	// default values are omitted from API requests. See
  1139  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1140  	// details.
  1141  	ForceSendFields []string `json:"-"`
  1142  	// NullFields is a list of field names (e.g. "AudioTopic") to include in API
  1143  	// requests with the JSON null value. By default, fields with empty values are
  1144  	// omitted from API requests. See
  1145  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1146  	NullFields []string `json:"-"`
  1147  }
  1148  
  1149  func (s *RecognitionMetadata) MarshalJSON() ([]byte, error) {
  1150  	type NoMethod RecognitionMetadata
  1151  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1152  }
  1153  
  1154  // RecognizeRequest: The top-level message sent by the client for the
  1155  // `Recognize` method.
  1156  type RecognizeRequest struct {
  1157  	// Audio: Required. The audio data to be recognized.
  1158  	Audio *RecognitionAudio `json:"audio,omitempty"`
  1159  	// Config: Required. Provides information to the recognizer that specifies how
  1160  	// to process the request.
  1161  	Config *RecognitionConfig `json:"config,omitempty"`
  1162  	// ForceSendFields is a list of field names (e.g. "Audio") to unconditionally
  1163  	// include in API requests. By default, fields with empty or default values are
  1164  	// omitted from API requests. See
  1165  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1166  	// details.
  1167  	ForceSendFields []string `json:"-"`
  1168  	// NullFields is a list of field names (e.g. "Audio") to include in API
  1169  	// requests with the JSON null value. By default, fields with empty values are
  1170  	// omitted from API requests. See
  1171  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1172  	NullFields []string `json:"-"`
  1173  }
  1174  
  1175  func (s *RecognizeRequest) MarshalJSON() ([]byte, error) {
  1176  	type NoMethod RecognizeRequest
  1177  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1178  }
  1179  
  1180  // RecognizeResponse: The only message returned to the client by the
  1181  // `Recognize` method. It contains the result as zero or more sequential
  1182  // `SpeechRecognitionResult` messages.
  1183  type RecognizeResponse struct {
  1184  	// RequestId: The ID associated with the request. This is a unique ID specific
  1185  	// only to the given request.
  1186  	RequestId int64 `json:"requestId,omitempty,string"`
  1187  	// Results: Sequential list of transcription results corresponding to
  1188  	// sequential portions of audio.
  1189  	Results []*SpeechRecognitionResult `json:"results,omitempty"`
  1190  	// SpeechAdaptationInfo: Provides information on adaptation behavior in
  1191  	// response
  1192  	SpeechAdaptationInfo *SpeechAdaptationInfo `json:"speechAdaptationInfo,omitempty"`
  1193  	// TotalBilledTime: When available, billed audio seconds for the corresponding
  1194  	// request.
  1195  	TotalBilledTime string `json:"totalBilledTime,omitempty"`
  1196  	// UsingLegacyModels: Whether request used legacy asr models (was not
  1197  	// automatically migrated to use conformer models).
  1198  	UsingLegacyModels bool `json:"usingLegacyModels,omitempty"`
  1199  
  1200  	// ServerResponse contains the HTTP response code and headers from the server.
  1201  	googleapi.ServerResponse `json:"-"`
  1202  	// ForceSendFields is a list of field names (e.g. "RequestId") to
  1203  	// unconditionally include in API requests. By default, fields with empty or
  1204  	// default values are omitted from API requests. See
  1205  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1206  	// details.
  1207  	ForceSendFields []string `json:"-"`
  1208  	// NullFields is a list of field names (e.g. "RequestId") to include in API
  1209  	// requests with the JSON null value. By default, fields with empty values are
  1210  	// omitted from API requests. See
  1211  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1212  	NullFields []string `json:"-"`
  1213  }
  1214  
  1215  func (s *RecognizeResponse) MarshalJSON() ([]byte, error) {
  1216  	type NoMethod RecognizeResponse
  1217  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1218  }
  1219  
  1220  // SpeakerDiarizationConfig: Config to enable speaker diarization.
  1221  type SpeakerDiarizationConfig struct {
  1222  	// EnableSpeakerDiarization: If 'true', enables speaker detection for each
  1223  	// recognized word in the top alternative of the recognition result using a
  1224  	// speaker_label provided in the WordInfo.
  1225  	EnableSpeakerDiarization bool `json:"enableSpeakerDiarization,omitempty"`
  1226  	// MaxSpeakerCount: Maximum number of speakers in the conversation. This range
  1227  	// gives you more flexibility by allowing the system to automatically determine
  1228  	// the correct number of speakers. If not set, the default value is 6.
  1229  	MaxSpeakerCount int64 `json:"maxSpeakerCount,omitempty"`
  1230  	// MinSpeakerCount: Minimum number of speakers in the conversation. This range
  1231  	// gives you more flexibility by allowing the system to automatically determine
  1232  	// the correct number of speakers. If not set, the default value is 2.
  1233  	MinSpeakerCount int64 `json:"minSpeakerCount,omitempty"`
  1234  	// SpeakerTag: Output only. Unused.
  1235  	SpeakerTag int64 `json:"speakerTag,omitempty"`
  1236  	// ForceSendFields is a list of field names (e.g. "EnableSpeakerDiarization")
  1237  	// to unconditionally include in API requests. By default, fields with empty or
  1238  	// default values are omitted from API requests. See
  1239  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1240  	// details.
  1241  	ForceSendFields []string `json:"-"`
  1242  	// NullFields is a list of field names (e.g. "EnableSpeakerDiarization") to
  1243  	// include in API requests with the JSON null value. By default, fields with
  1244  	// empty values are omitted from API requests. See
  1245  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1246  	NullFields []string `json:"-"`
  1247  }
  1248  
  1249  func (s *SpeakerDiarizationConfig) MarshalJSON() ([]byte, error) {
  1250  	type NoMethod SpeakerDiarizationConfig
  1251  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1252  }
  1253  
  1254  // SpeechAdaptation: Speech adaptation configuration.
  1255  type SpeechAdaptation struct {
  1256  	// AbnfGrammar: Augmented Backus-Naur form (ABNF) is a standardized grammar
  1257  	// notation comprised by a set of derivation rules. See specifications:
  1258  	// https://www.w3.org/TR/speech-grammar
  1259  	AbnfGrammar *ABNFGrammar `json:"abnfGrammar,omitempty"`
  1260  	// CustomClasses: A collection of custom classes. To specify the classes
  1261  	// inline, leave the class' `name` blank and fill in the rest of its fields,
  1262  	// giving it a unique `custom_class_id`. Refer to the inline defined class in
  1263  	// phrase hints by its `custom_class_id`.
  1264  	CustomClasses []*CustomClass `json:"customClasses,omitempty"`
  1265  	// PhraseSetReferences: A collection of phrase set resource names to use.
  1266  	PhraseSetReferences []string `json:"phraseSetReferences,omitempty"`
  1267  	// PhraseSets: A collection of phrase sets. To specify the hints inline, leave
  1268  	// the phrase set's `name` blank and fill in the rest of its fields. Any phrase
  1269  	// set can use any custom class.
  1270  	PhraseSets []*PhraseSet `json:"phraseSets,omitempty"`
  1271  	// ForceSendFields is a list of field names (e.g. "AbnfGrammar") to
  1272  	// unconditionally include in API requests. By default, fields with empty or
  1273  	// default values are omitted from API requests. See
  1274  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1275  	// details.
  1276  	ForceSendFields []string `json:"-"`
  1277  	// NullFields is a list of field names (e.g. "AbnfGrammar") to include in API
  1278  	// requests with the JSON null value. By default, fields with empty values are
  1279  	// omitted from API requests. See
  1280  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1281  	NullFields []string `json:"-"`
  1282  }
  1283  
  1284  func (s *SpeechAdaptation) MarshalJSON() ([]byte, error) {
  1285  	type NoMethod SpeechAdaptation
  1286  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1287  }
  1288  
  1289  // SpeechAdaptationInfo: Information on speech adaptation use in results
  1290  type SpeechAdaptationInfo struct {
  1291  	// AdaptationTimeout: Whether there was a timeout when applying speech
  1292  	// adaptation. If true, adaptation had no effect in the response transcript.
  1293  	AdaptationTimeout bool `json:"adaptationTimeout,omitempty"`
  1294  	// TimeoutMessage: If set, returns a message specifying which part of the
  1295  	// speech adaptation request timed out.
  1296  	TimeoutMessage string `json:"timeoutMessage,omitempty"`
  1297  	// ForceSendFields is a list of field names (e.g. "AdaptationTimeout") to
  1298  	// unconditionally include in API requests. By default, fields with empty or
  1299  	// default values are omitted from API requests. See
  1300  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1301  	// details.
  1302  	ForceSendFields []string `json:"-"`
  1303  	// NullFields is a list of field names (e.g. "AdaptationTimeout") to include in
  1304  	// API requests with the JSON null value. By default, fields with empty values
  1305  	// are omitted from API requests. See
  1306  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1307  	NullFields []string `json:"-"`
  1308  }
  1309  
  1310  func (s *SpeechAdaptationInfo) MarshalJSON() ([]byte, error) {
  1311  	type NoMethod SpeechAdaptationInfo
  1312  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1313  }
  1314  
  1315  // SpeechContext: Provides "hints" to the speech recognizer to favor specific
  1316  // words and phrases in the results.
  1317  type SpeechContext struct {
  1318  	// Boost: Hint Boost. Positive value will increase the probability that a
  1319  	// specific phrase will be recognized over other similar sounding phrases. The
  1320  	// higher the boost, the higher the chance of false positive recognition as
  1321  	// well. Negative boost values would correspond to anti-biasing. Anti-biasing
  1322  	// is not enabled, so negative boost will simply be ignored. Though `boost` can
  1323  	// accept a wide range of positive values, most use cases are best served with
  1324  	// values between 0 and 20. We recommend using a binary search approach to
  1325  	// finding the optimal value for your use case.
  1326  	Boost float64 `json:"boost,omitempty"`
  1327  	// Phrases: A list of strings containing words and phrases "hints" so that the
  1328  	// speech recognition is more likely to recognize them. This can be used to
  1329  	// improve the accuracy for specific words and phrases, for example, if
  1330  	// specific commands are typically spoken by the user. This can also be used to
  1331  	// add additional words to the vocabulary of the recognizer. See usage limits
  1332  	// (https://cloud.google.com/speech-to-text/quotas#content). List items can
  1333  	// also be set to classes for groups of words that represent common concepts
  1334  	// that occur in natural language. For example, rather than providing phrase
  1335  	// hints for every month of the year, using the $MONTH class improves the
  1336  	// likelihood of correctly transcribing audio that includes months.
  1337  	Phrases []string `json:"phrases,omitempty"`
  1338  	// ForceSendFields is a list of field names (e.g. "Boost") to unconditionally
  1339  	// include in API requests. By default, fields with empty or default values are
  1340  	// omitted from API requests. See
  1341  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1342  	// details.
  1343  	ForceSendFields []string `json:"-"`
  1344  	// NullFields is a list of field names (e.g. "Boost") to include in API
  1345  	// requests with the JSON null value. By default, fields with empty values are
  1346  	// omitted from API requests. See
  1347  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1348  	NullFields []string `json:"-"`
  1349  }
  1350  
  1351  func (s *SpeechContext) MarshalJSON() ([]byte, error) {
  1352  	type NoMethod SpeechContext
  1353  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1354  }
  1355  
  1356  func (s *SpeechContext) UnmarshalJSON(data []byte) error {
  1357  	type NoMethod SpeechContext
  1358  	var s1 struct {
  1359  		Boost gensupport.JSONFloat64 `json:"boost"`
  1360  		*NoMethod
  1361  	}
  1362  	s1.NoMethod = (*NoMethod)(s)
  1363  	if err := json.Unmarshal(data, &s1); err != nil {
  1364  		return err
  1365  	}
  1366  	s.Boost = float64(s1.Boost)
  1367  	return nil
  1368  }
  1369  
  1370  // SpeechRecognitionAlternative: Alternative hypotheses (a.k.a. n-best list).
  1371  type SpeechRecognitionAlternative struct {
  1372  	// Confidence: The confidence estimate between 0.0 and 1.0. A higher number
  1373  	// indicates an estimated greater likelihood that the recognized words are
  1374  	// correct. This field is set only for the top alternative of a non-streaming
  1375  	// result or, of a streaming result where `is_final=true`. This field is not
  1376  	// guaranteed to be accurate and users should not rely on it to be always
  1377  	// provided. The default of 0.0 is a sentinel value indicating `confidence` was
  1378  	// not set.
  1379  	Confidence float64 `json:"confidence,omitempty"`
  1380  	// Transcript: Transcript text representing the words that the user spoke. In
  1381  	// languages that use spaces to separate words, the transcript might have a
  1382  	// leading space if it isn't the first result. You can concatenate each result
  1383  	// to obtain the full transcript without using a separator.
  1384  	Transcript string `json:"transcript,omitempty"`
  1385  	// Words: A list of word-specific information for each recognized word. Note:
  1386  	// When `enable_speaker_diarization` is true, you will see all the words from
  1387  	// the beginning of the audio.
  1388  	Words []*WordInfo `json:"words,omitempty"`
  1389  	// ForceSendFields is a list of field names (e.g. "Confidence") to
  1390  	// unconditionally include in API requests. By default, fields with empty or
  1391  	// default values are omitted from API requests. See
  1392  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1393  	// details.
  1394  	ForceSendFields []string `json:"-"`
  1395  	// NullFields is a list of field names (e.g. "Confidence") to include in API
  1396  	// requests with the JSON null value. By default, fields with empty values are
  1397  	// omitted from API requests. See
  1398  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1399  	NullFields []string `json:"-"`
  1400  }
  1401  
  1402  func (s *SpeechRecognitionAlternative) MarshalJSON() ([]byte, error) {
  1403  	type NoMethod SpeechRecognitionAlternative
  1404  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1405  }
  1406  
  1407  func (s *SpeechRecognitionAlternative) UnmarshalJSON(data []byte) error {
  1408  	type NoMethod SpeechRecognitionAlternative
  1409  	var s1 struct {
  1410  		Confidence gensupport.JSONFloat64 `json:"confidence"`
  1411  		*NoMethod
  1412  	}
  1413  	s1.NoMethod = (*NoMethod)(s)
  1414  	if err := json.Unmarshal(data, &s1); err != nil {
  1415  		return err
  1416  	}
  1417  	s.Confidence = float64(s1.Confidence)
  1418  	return nil
  1419  }
  1420  
  1421  // SpeechRecognitionResult: A speech recognition result corresponding to a
  1422  // portion of the audio.
  1423  type SpeechRecognitionResult struct {
  1424  	// Alternatives: May contain one or more recognition hypotheses (up to the
  1425  	// maximum specified in `max_alternatives`). These alternatives are ordered in
  1426  	// terms of accuracy, with the top (first) alternative being the most probable,
  1427  	// as ranked by the recognizer.
  1428  	Alternatives []*SpeechRecognitionAlternative `json:"alternatives,omitempty"`
  1429  	// ChannelTag: For multi-channel audio, this is the channel number
  1430  	// corresponding to the recognized result for the audio from that channel. For
  1431  	// audio_channel_count = N, its output values can range from '1' to 'N'.
  1432  	ChannelTag int64 `json:"channelTag,omitempty"`
  1433  	// LanguageCode: Output only. The BCP-47
  1434  	// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of the language
  1435  	// in this result. This language code was detected to have the most likelihood
  1436  	// of being spoken in the audio.
  1437  	LanguageCode string `json:"languageCode,omitempty"`
  1438  	// ResultEndTime: Time offset of the end of this result relative to the
  1439  	// beginning of the audio.
  1440  	ResultEndTime string `json:"resultEndTime,omitempty"`
  1441  	// ForceSendFields is a list of field names (e.g. "Alternatives") to
  1442  	// unconditionally include in API requests. By default, fields with empty or
  1443  	// default values are omitted from API requests. See
  1444  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1445  	// details.
  1446  	ForceSendFields []string `json:"-"`
  1447  	// NullFields is a list of field names (e.g. "Alternatives") to include in API
  1448  	// requests with the JSON null value. By default, fields with empty values are
  1449  	// omitted from API requests. See
  1450  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1451  	NullFields []string `json:"-"`
  1452  }
  1453  
  1454  func (s *SpeechRecognitionResult) MarshalJSON() ([]byte, error) {
  1455  	type NoMethod SpeechRecognitionResult
  1456  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1457  }
  1458  
  1459  // Status: The `Status` type defines a logical error model that is suitable for
  1460  // different programming environments, including REST APIs and RPC APIs. It is
  1461  // used by gRPC (https://github.com/grpc). Each `Status` message contains three
  1462  // pieces of data: error code, error message, and error details. You can find
  1463  // out more about this error model and how to work with it in the API Design
  1464  // Guide (https://cloud.google.com/apis/design/errors).
  1465  type Status struct {
  1466  	// Code: The status code, which should be an enum value of google.rpc.Code.
  1467  	Code int64 `json:"code,omitempty"`
  1468  	// Details: A list of messages that carry the error details. There is a common
  1469  	// set of message types for APIs to use.
  1470  	Details []googleapi.RawMessage `json:"details,omitempty"`
  1471  	// Message: A developer-facing error message, which should be in English. Any
  1472  	// user-facing error message should be localized and sent in the
  1473  	// google.rpc.Status.details field, or localized by the client.
  1474  	Message string `json:"message,omitempty"`
  1475  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
  1476  	// include in API requests. By default, fields with empty or default values are
  1477  	// omitted from API requests. See
  1478  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1479  	// details.
  1480  	ForceSendFields []string `json:"-"`
  1481  	// NullFields is a list of field names (e.g. "Code") to include in API requests
  1482  	// with the JSON null value. By default, fields with empty values are omitted
  1483  	// from API requests. See
  1484  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1485  	NullFields []string `json:"-"`
  1486  }
  1487  
  1488  func (s *Status) MarshalJSON() ([]byte, error) {
  1489  	type NoMethod Status
  1490  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1491  }
  1492  
  1493  // TranscriptNormalization: Transcription normalization configuration. Use
  1494  // transcription normalization to automatically replace parts of the transcript
  1495  // with phrases of your choosing. For StreamingRecognize, this normalization
  1496  // only applies to stable partial transcripts (stability > 0.8) and final
  1497  // transcripts.
  1498  type TranscriptNormalization struct {
  1499  	// Entries: A list of replacement entries. We will perform replacement with one
  1500  	// entry at a time. For example, the second entry in ["cat" => "dog", "mountain
  1501  	// cat" => "mountain dog"] will never be applied because we will always process
  1502  	// the first entry before it. At most 100 entries.
  1503  	Entries []*Entry `json:"entries,omitempty"`
  1504  	// ForceSendFields is a list of field names (e.g. "Entries") to unconditionally
  1505  	// include in API requests. By default, fields with empty or default values are
  1506  	// omitted from API requests. See
  1507  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1508  	// details.
  1509  	ForceSendFields []string `json:"-"`
  1510  	// NullFields is a list of field names (e.g. "Entries") to include in API
  1511  	// requests with the JSON null value. By default, fields with empty values are
  1512  	// omitted from API requests. See
  1513  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1514  	NullFields []string `json:"-"`
  1515  }
  1516  
  1517  func (s *TranscriptNormalization) MarshalJSON() ([]byte, error) {
  1518  	type NoMethod TranscriptNormalization
  1519  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1520  }
  1521  
  1522  // TranscriptOutputConfig: Specifies an optional destination for the
  1523  // recognition results.
  1524  type TranscriptOutputConfig struct {
  1525  	// GcsUri: Specifies a Cloud Storage URI for the recognition results. Must be
  1526  	// specified in the format: `gs://bucket_name/object_name`, and the bucket must
  1527  	// already exist.
  1528  	GcsUri string `json:"gcsUri,omitempty"`
  1529  	// ForceSendFields is a list of field names (e.g. "GcsUri") to unconditionally
  1530  	// include in API requests. By default, fields with empty or default values are
  1531  	// omitted from API requests. See
  1532  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1533  	// details.
  1534  	ForceSendFields []string `json:"-"`
  1535  	// NullFields is a list of field names (e.g. "GcsUri") to include in API
  1536  	// requests with the JSON null value. By default, fields with empty values are
  1537  	// omitted from API requests. See
  1538  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1539  	NullFields []string `json:"-"`
  1540  }
  1541  
  1542  func (s *TranscriptOutputConfig) MarshalJSON() ([]byte, error) {
  1543  	type NoMethod TranscriptOutputConfig
  1544  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1545  }
  1546  
  1547  // WordInfo: Word-specific information for recognized words.
  1548  type WordInfo struct {
  1549  	// Confidence: The confidence estimate between 0.0 and 1.0. A higher number
  1550  	// indicates an estimated greater likelihood that the recognized words are
  1551  	// correct. This field is set only for the top alternative of a non-streaming
  1552  	// result or, of a streaming result where `is_final=true`. This field is not
  1553  	// guaranteed to be accurate and users should not rely on it to be always
  1554  	// provided. The default of 0.0 is a sentinel value indicating `confidence` was
  1555  	// not set.
  1556  	Confidence float64 `json:"confidence,omitempty"`
  1557  	// EndTime: Time offset relative to the beginning of the audio, and
  1558  	// corresponding to the end of the spoken word. This field is only set if
  1559  	// `enable_word_time_offsets=true` and only in the top hypothesis. This is an
  1560  	// experimental feature and the accuracy of the time offset can vary.
  1561  	EndTime string `json:"endTime,omitempty"`
  1562  	// SpeakerLabel: Output only. A label value assigned for every unique speaker
  1563  	// within the audio. This field specifies which speaker was detected to have
  1564  	// spoken this word. For some models, like medical_conversation this can be
  1565  	// actual speaker role, for example "patient" or "provider", but generally this
  1566  	// would be a number identifying a speaker. This field is only set if
  1567  	// enable_speaker_diarization = 'true' and only for the top alternative.
  1568  	SpeakerLabel string `json:"speakerLabel,omitempty"`
  1569  	// SpeakerTag: Output only. A distinct integer value is assigned for every
  1570  	// speaker within the audio. This field specifies which one of those speakers
  1571  	// was detected to have spoken this word. Value ranges from '1' to
  1572  	// diarization_speaker_count. speaker_tag is set if enable_speaker_diarization
  1573  	// = 'true' and only for the top alternative. Note: Use speaker_label instead.
  1574  	SpeakerTag int64 `json:"speakerTag,omitempty"`
  1575  	// StartTime: Time offset relative to the beginning of the audio, and
  1576  	// corresponding to the start of the spoken word. This field is only set if
  1577  	// `enable_word_time_offsets=true` and only in the top hypothesis. This is an
  1578  	// experimental feature and the accuracy of the time offset can vary.
  1579  	StartTime string `json:"startTime,omitempty"`
  1580  	// Word: The word corresponding to this set of information.
  1581  	Word string `json:"word,omitempty"`
  1582  	// ForceSendFields is a list of field names (e.g. "Confidence") to
  1583  	// unconditionally include in API requests. By default, fields with empty or
  1584  	// default values are omitted from API requests. See
  1585  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1586  	// details.
  1587  	ForceSendFields []string `json:"-"`
  1588  	// NullFields is a list of field names (e.g. "Confidence") to include in API
  1589  	// requests with the JSON null value. By default, fields with empty values are
  1590  	// omitted from API requests. See
  1591  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1592  	NullFields []string `json:"-"`
  1593  }
  1594  
  1595  func (s *WordInfo) MarshalJSON() ([]byte, error) {
  1596  	type NoMethod WordInfo
  1597  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1598  }
  1599  
  1600  func (s *WordInfo) UnmarshalJSON(data []byte) error {
  1601  	type NoMethod WordInfo
  1602  	var s1 struct {
  1603  		Confidence gensupport.JSONFloat64 `json:"confidence"`
  1604  		*NoMethod
  1605  	}
  1606  	s1.NoMethod = (*NoMethod)(s)
  1607  	if err := json.Unmarshal(data, &s1); err != nil {
  1608  		return err
  1609  	}
  1610  	s.Confidence = float64(s1.Confidence)
  1611  	return nil
  1612  }
  1613  
  1614  type OperationsGetCall struct {
  1615  	s            *Service
  1616  	name         string
  1617  	urlParams_   gensupport.URLParams
  1618  	ifNoneMatch_ string
  1619  	ctx_         context.Context
  1620  	header_      http.Header
  1621  }
  1622  
  1623  // Get: Gets the latest state of a long-running operation. Clients can use this
  1624  // method to poll the operation result at intervals as recommended by the API
  1625  // service.
  1626  //
  1627  // - name: The name of the operation resource.
  1628  func (r *OperationsService) Get(name string) *OperationsGetCall {
  1629  	c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1630  	c.name = name
  1631  	return c
  1632  }
  1633  
  1634  // Fields allows partial responses to be retrieved. See
  1635  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1636  // details.
  1637  func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  1638  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1639  	return c
  1640  }
  1641  
  1642  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1643  // object's ETag matches the given value. This is useful for getting updates
  1644  // only after the object has changed since the last request.
  1645  func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  1646  	c.ifNoneMatch_ = entityTag
  1647  	return c
  1648  }
  1649  
  1650  // Context sets the context to be used in this call's Do method.
  1651  func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  1652  	c.ctx_ = ctx
  1653  	return c
  1654  }
  1655  
  1656  // Header returns a http.Header that can be modified by the caller to add
  1657  // headers to the request.
  1658  func (c *OperationsGetCall) Header() http.Header {
  1659  	if c.header_ == nil {
  1660  		c.header_ = make(http.Header)
  1661  	}
  1662  	return c.header_
  1663  }
  1664  
  1665  func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1666  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1667  	if c.ifNoneMatch_ != "" {
  1668  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1669  	}
  1670  	var body io.Reader = nil
  1671  	c.urlParams_.Set("alt", alt)
  1672  	c.urlParams_.Set("prettyPrint", "false")
  1673  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/operations/{+name}")
  1674  	urls += "?" + c.urlParams_.Encode()
  1675  	req, err := http.NewRequest("GET", urls, body)
  1676  	if err != nil {
  1677  		return nil, err
  1678  	}
  1679  	req.Header = reqHeaders
  1680  	googleapi.Expand(req.URL, map[string]string{
  1681  		"name": c.name,
  1682  	})
  1683  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1684  }
  1685  
  1686  // Do executes the "speech.operations.get" call.
  1687  // Any non-2xx status code is an error. Response headers are in either
  1688  // *Operation.ServerResponse.Header or (if a response was returned at all) in
  1689  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1690  // whether the returned error was because http.StatusNotModified was returned.
  1691  func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1692  	gensupport.SetOptions(c.urlParams_, opts...)
  1693  	res, err := c.doRequest("json")
  1694  	if res != nil && res.StatusCode == http.StatusNotModified {
  1695  		if res.Body != nil {
  1696  			res.Body.Close()
  1697  		}
  1698  		return nil, gensupport.WrapError(&googleapi.Error{
  1699  			Code:   res.StatusCode,
  1700  			Header: res.Header,
  1701  		})
  1702  	}
  1703  	if err != nil {
  1704  		return nil, err
  1705  	}
  1706  	defer googleapi.CloseBody(res)
  1707  	if err := googleapi.CheckResponse(res); err != nil {
  1708  		return nil, gensupport.WrapError(err)
  1709  	}
  1710  	ret := &Operation{
  1711  		ServerResponse: googleapi.ServerResponse{
  1712  			Header:         res.Header,
  1713  			HTTPStatusCode: res.StatusCode,
  1714  		},
  1715  	}
  1716  	target := &ret
  1717  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1718  		return nil, err
  1719  	}
  1720  	return ret, nil
  1721  }
  1722  
  1723  type OperationsListCall struct {
  1724  	s            *Service
  1725  	urlParams_   gensupport.URLParams
  1726  	ifNoneMatch_ string
  1727  	ctx_         context.Context
  1728  	header_      http.Header
  1729  }
  1730  
  1731  // List: Lists operations that match the specified filter in the request. If
  1732  // the server doesn't support this method, it returns `UNIMPLEMENTED`.
  1733  func (r *OperationsService) List() *OperationsListCall {
  1734  	c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1735  	return c
  1736  }
  1737  
  1738  // Filter sets the optional parameter "filter": The standard list filter.
  1739  func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  1740  	c.urlParams_.Set("filter", filter)
  1741  	return c
  1742  }
  1743  
  1744  // Name sets the optional parameter "name": The name of the operation's parent
  1745  // resource.
  1746  func (c *OperationsListCall) Name(name string) *OperationsListCall {
  1747  	c.urlParams_.Set("name", name)
  1748  	return c
  1749  }
  1750  
  1751  // PageSize sets the optional parameter "pageSize": The standard list page
  1752  // size.
  1753  func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  1754  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1755  	return c
  1756  }
  1757  
  1758  // PageToken sets the optional parameter "pageToken": The standard list page
  1759  // token.
  1760  func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  1761  	c.urlParams_.Set("pageToken", pageToken)
  1762  	return c
  1763  }
  1764  
  1765  // Fields allows partial responses to be retrieved. See
  1766  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1767  // details.
  1768  func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  1769  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1770  	return c
  1771  }
  1772  
  1773  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1774  // object's ETag matches the given value. This is useful for getting updates
  1775  // only after the object has changed since the last request.
  1776  func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  1777  	c.ifNoneMatch_ = entityTag
  1778  	return c
  1779  }
  1780  
  1781  // Context sets the context to be used in this call's Do method.
  1782  func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  1783  	c.ctx_ = ctx
  1784  	return c
  1785  }
  1786  
  1787  // Header returns a http.Header that can be modified by the caller to add
  1788  // headers to the request.
  1789  func (c *OperationsListCall) Header() http.Header {
  1790  	if c.header_ == nil {
  1791  		c.header_ = make(http.Header)
  1792  	}
  1793  	return c.header_
  1794  }
  1795  
  1796  func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  1797  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1798  	if c.ifNoneMatch_ != "" {
  1799  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1800  	}
  1801  	var body io.Reader = nil
  1802  	c.urlParams_.Set("alt", alt)
  1803  	c.urlParams_.Set("prettyPrint", "false")
  1804  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/operations")
  1805  	urls += "?" + c.urlParams_.Encode()
  1806  	req, err := http.NewRequest("GET", urls, body)
  1807  	if err != nil {
  1808  		return nil, err
  1809  	}
  1810  	req.Header = reqHeaders
  1811  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1812  }
  1813  
  1814  // Do executes the "speech.operations.list" call.
  1815  // Any non-2xx status code is an error. Response headers are in either
  1816  // *ListOperationsResponse.ServerResponse.Header or (if a response was returned
  1817  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1818  // check whether the returned error was because http.StatusNotModified was
  1819  // returned.
  1820  func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  1821  	gensupport.SetOptions(c.urlParams_, opts...)
  1822  	res, err := c.doRequest("json")
  1823  	if res != nil && res.StatusCode == http.StatusNotModified {
  1824  		if res.Body != nil {
  1825  			res.Body.Close()
  1826  		}
  1827  		return nil, gensupport.WrapError(&googleapi.Error{
  1828  			Code:   res.StatusCode,
  1829  			Header: res.Header,
  1830  		})
  1831  	}
  1832  	if err != nil {
  1833  		return nil, err
  1834  	}
  1835  	defer googleapi.CloseBody(res)
  1836  	if err := googleapi.CheckResponse(res); err != nil {
  1837  		return nil, gensupport.WrapError(err)
  1838  	}
  1839  	ret := &ListOperationsResponse{
  1840  		ServerResponse: googleapi.ServerResponse{
  1841  			Header:         res.Header,
  1842  			HTTPStatusCode: res.StatusCode,
  1843  		},
  1844  	}
  1845  	target := &ret
  1846  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1847  		return nil, err
  1848  	}
  1849  	return ret, nil
  1850  }
  1851  
  1852  // Pages invokes f for each page of results.
  1853  // A non-nil error returned from f will halt the iteration.
  1854  // The provided context supersedes any context provided to the Context method.
  1855  func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  1856  	c.ctx_ = ctx
  1857  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1858  	for {
  1859  		x, err := c.Do()
  1860  		if err != nil {
  1861  			return err
  1862  		}
  1863  		if err := f(x); err != nil {
  1864  			return err
  1865  		}
  1866  		if x.NextPageToken == "" {
  1867  			return nil
  1868  		}
  1869  		c.PageToken(x.NextPageToken)
  1870  	}
  1871  }
  1872  
  1873  type ProjectsLocationsCustomClassesCreateCall struct {
  1874  	s                        *Service
  1875  	parent                   string
  1876  	createcustomclassrequest *CreateCustomClassRequest
  1877  	urlParams_               gensupport.URLParams
  1878  	ctx_                     context.Context
  1879  	header_                  http.Header
  1880  }
  1881  
  1882  // Create: Create a custom class.
  1883  //
  1884  //   - parent: The parent resource where this custom class will be created.
  1885  //     Format: `projects/{project}/locations/{location}/customClasses`
  1886  //     Speech-to-Text supports three locations: `global`, `us` (US North
  1887  //     America), and `eu` (Europe). If you are calling the
  1888  //     `speech.googleapis.com` endpoint, use the `global` location. To specify a
  1889  //     region, use a regional endpoint
  1890  //     (https://cloud.google.com/speech-to-text/docs/endpoints) with matching
  1891  //     `us` or `eu` location value.
  1892  func (r *ProjectsLocationsCustomClassesService) Create(parent string, createcustomclassrequest *CreateCustomClassRequest) *ProjectsLocationsCustomClassesCreateCall {
  1893  	c := &ProjectsLocationsCustomClassesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1894  	c.parent = parent
  1895  	c.createcustomclassrequest = createcustomclassrequest
  1896  	return c
  1897  }
  1898  
  1899  // Fields allows partial responses to be retrieved. See
  1900  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1901  // details.
  1902  func (c *ProjectsLocationsCustomClassesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsCustomClassesCreateCall {
  1903  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1904  	return c
  1905  }
  1906  
  1907  // Context sets the context to be used in this call's Do method.
  1908  func (c *ProjectsLocationsCustomClassesCreateCall) Context(ctx context.Context) *ProjectsLocationsCustomClassesCreateCall {
  1909  	c.ctx_ = ctx
  1910  	return c
  1911  }
  1912  
  1913  // Header returns a http.Header that can be modified by the caller to add
  1914  // headers to the request.
  1915  func (c *ProjectsLocationsCustomClassesCreateCall) Header() http.Header {
  1916  	if c.header_ == nil {
  1917  		c.header_ = make(http.Header)
  1918  	}
  1919  	return c.header_
  1920  }
  1921  
  1922  func (c *ProjectsLocationsCustomClassesCreateCall) doRequest(alt string) (*http.Response, error) {
  1923  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1924  	var body io.Reader = nil
  1925  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.createcustomclassrequest)
  1926  	if err != nil {
  1927  		return nil, err
  1928  	}
  1929  	c.urlParams_.Set("alt", alt)
  1930  	c.urlParams_.Set("prettyPrint", "false")
  1931  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/customClasses")
  1932  	urls += "?" + c.urlParams_.Encode()
  1933  	req, err := http.NewRequest("POST", urls, body)
  1934  	if err != nil {
  1935  		return nil, err
  1936  	}
  1937  	req.Header = reqHeaders
  1938  	googleapi.Expand(req.URL, map[string]string{
  1939  		"parent": c.parent,
  1940  	})
  1941  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1942  }
  1943  
  1944  // Do executes the "speech.projects.locations.customClasses.create" call.
  1945  // Any non-2xx status code is an error. Response headers are in either
  1946  // *CustomClass.ServerResponse.Header or (if a response was returned at all) in
  1947  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1948  // whether the returned error was because http.StatusNotModified was returned.
  1949  func (c *ProjectsLocationsCustomClassesCreateCall) Do(opts ...googleapi.CallOption) (*CustomClass, error) {
  1950  	gensupport.SetOptions(c.urlParams_, opts...)
  1951  	res, err := c.doRequest("json")
  1952  	if res != nil && res.StatusCode == http.StatusNotModified {
  1953  		if res.Body != nil {
  1954  			res.Body.Close()
  1955  		}
  1956  		return nil, gensupport.WrapError(&googleapi.Error{
  1957  			Code:   res.StatusCode,
  1958  			Header: res.Header,
  1959  		})
  1960  	}
  1961  	if err != nil {
  1962  		return nil, err
  1963  	}
  1964  	defer googleapi.CloseBody(res)
  1965  	if err := googleapi.CheckResponse(res); err != nil {
  1966  		return nil, gensupport.WrapError(err)
  1967  	}
  1968  	ret := &CustomClass{
  1969  		ServerResponse: googleapi.ServerResponse{
  1970  			Header:         res.Header,
  1971  			HTTPStatusCode: res.StatusCode,
  1972  		},
  1973  	}
  1974  	target := &ret
  1975  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1976  		return nil, err
  1977  	}
  1978  	return ret, nil
  1979  }
  1980  
  1981  type ProjectsLocationsCustomClassesDeleteCall struct {
  1982  	s          *Service
  1983  	name       string
  1984  	urlParams_ gensupport.URLParams
  1985  	ctx_       context.Context
  1986  	header_    http.Header
  1987  }
  1988  
  1989  // Delete: Delete a custom class.
  1990  //
  1991  //   - name: The name of the custom class to delete. Format:
  1992  //     `projects/{project}/locations/{location}/customClasses/{custom_class}`
  1993  //     Speech-to-Text supports three locations: `global`, `us` (US North
  1994  //     America), and `eu` (Europe). If you are calling the
  1995  //     `speech.googleapis.com` endpoint, use the `global` location. To specify a
  1996  //     region, use a regional endpoint
  1997  //     (https://cloud.google.com/speech-to-text/docs/endpoints) with matching
  1998  //     `us` or `eu` location value.
  1999  func (r *ProjectsLocationsCustomClassesService) Delete(name string) *ProjectsLocationsCustomClassesDeleteCall {
  2000  	c := &ProjectsLocationsCustomClassesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2001  	c.name = name
  2002  	return c
  2003  }
  2004  
  2005  // Fields allows partial responses to be retrieved. See
  2006  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2007  // details.
  2008  func (c *ProjectsLocationsCustomClassesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsCustomClassesDeleteCall {
  2009  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2010  	return c
  2011  }
  2012  
  2013  // Context sets the context to be used in this call's Do method.
  2014  func (c *ProjectsLocationsCustomClassesDeleteCall) Context(ctx context.Context) *ProjectsLocationsCustomClassesDeleteCall {
  2015  	c.ctx_ = ctx
  2016  	return c
  2017  }
  2018  
  2019  // Header returns a http.Header that can be modified by the caller to add
  2020  // headers to the request.
  2021  func (c *ProjectsLocationsCustomClassesDeleteCall) Header() http.Header {
  2022  	if c.header_ == nil {
  2023  		c.header_ = make(http.Header)
  2024  	}
  2025  	return c.header_
  2026  }
  2027  
  2028  func (c *ProjectsLocationsCustomClassesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2029  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2030  	var body io.Reader = nil
  2031  	c.urlParams_.Set("alt", alt)
  2032  	c.urlParams_.Set("prettyPrint", "false")
  2033  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2034  	urls += "?" + c.urlParams_.Encode()
  2035  	req, err := http.NewRequest("DELETE", urls, body)
  2036  	if err != nil {
  2037  		return nil, err
  2038  	}
  2039  	req.Header = reqHeaders
  2040  	googleapi.Expand(req.URL, map[string]string{
  2041  		"name": c.name,
  2042  	})
  2043  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2044  }
  2045  
  2046  // Do executes the "speech.projects.locations.customClasses.delete" call.
  2047  // Any non-2xx status code is an error. Response headers are in either
  2048  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  2049  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2050  // whether the returned error was because http.StatusNotModified was returned.
  2051  func (c *ProjectsLocationsCustomClassesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2052  	gensupport.SetOptions(c.urlParams_, opts...)
  2053  	res, err := c.doRequest("json")
  2054  	if res != nil && res.StatusCode == http.StatusNotModified {
  2055  		if res.Body != nil {
  2056  			res.Body.Close()
  2057  		}
  2058  		return nil, gensupport.WrapError(&googleapi.Error{
  2059  			Code:   res.StatusCode,
  2060  			Header: res.Header,
  2061  		})
  2062  	}
  2063  	if err != nil {
  2064  		return nil, err
  2065  	}
  2066  	defer googleapi.CloseBody(res)
  2067  	if err := googleapi.CheckResponse(res); err != nil {
  2068  		return nil, gensupport.WrapError(err)
  2069  	}
  2070  	ret := &Empty{
  2071  		ServerResponse: googleapi.ServerResponse{
  2072  			Header:         res.Header,
  2073  			HTTPStatusCode: res.StatusCode,
  2074  		},
  2075  	}
  2076  	target := &ret
  2077  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2078  		return nil, err
  2079  	}
  2080  	return ret, nil
  2081  }
  2082  
  2083  type ProjectsLocationsCustomClassesGetCall struct {
  2084  	s            *Service
  2085  	name         string
  2086  	urlParams_   gensupport.URLParams
  2087  	ifNoneMatch_ string
  2088  	ctx_         context.Context
  2089  	header_      http.Header
  2090  }
  2091  
  2092  // Get: Get a custom class.
  2093  //
  2094  //   - name: The name of the custom class to retrieve. Format:
  2095  //     `projects/{project}/locations/{location}/customClasses/{custom_class}`.
  2096  func (r *ProjectsLocationsCustomClassesService) Get(name string) *ProjectsLocationsCustomClassesGetCall {
  2097  	c := &ProjectsLocationsCustomClassesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2098  	c.name = name
  2099  	return c
  2100  }
  2101  
  2102  // Fields allows partial responses to be retrieved. See
  2103  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2104  // details.
  2105  func (c *ProjectsLocationsCustomClassesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsCustomClassesGetCall {
  2106  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2107  	return c
  2108  }
  2109  
  2110  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2111  // object's ETag matches the given value. This is useful for getting updates
  2112  // only after the object has changed since the last request.
  2113  func (c *ProjectsLocationsCustomClassesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsCustomClassesGetCall {
  2114  	c.ifNoneMatch_ = entityTag
  2115  	return c
  2116  }
  2117  
  2118  // Context sets the context to be used in this call's Do method.
  2119  func (c *ProjectsLocationsCustomClassesGetCall) Context(ctx context.Context) *ProjectsLocationsCustomClassesGetCall {
  2120  	c.ctx_ = ctx
  2121  	return c
  2122  }
  2123  
  2124  // Header returns a http.Header that can be modified by the caller to add
  2125  // headers to the request.
  2126  func (c *ProjectsLocationsCustomClassesGetCall) Header() http.Header {
  2127  	if c.header_ == nil {
  2128  		c.header_ = make(http.Header)
  2129  	}
  2130  	return c.header_
  2131  }
  2132  
  2133  func (c *ProjectsLocationsCustomClassesGetCall) doRequest(alt string) (*http.Response, error) {
  2134  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2135  	if c.ifNoneMatch_ != "" {
  2136  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2137  	}
  2138  	var body io.Reader = nil
  2139  	c.urlParams_.Set("alt", alt)
  2140  	c.urlParams_.Set("prettyPrint", "false")
  2141  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2142  	urls += "?" + c.urlParams_.Encode()
  2143  	req, err := http.NewRequest("GET", urls, body)
  2144  	if err != nil {
  2145  		return nil, err
  2146  	}
  2147  	req.Header = reqHeaders
  2148  	googleapi.Expand(req.URL, map[string]string{
  2149  		"name": c.name,
  2150  	})
  2151  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2152  }
  2153  
  2154  // Do executes the "speech.projects.locations.customClasses.get" call.
  2155  // Any non-2xx status code is an error. Response headers are in either
  2156  // *CustomClass.ServerResponse.Header or (if a response was returned at all) in
  2157  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2158  // whether the returned error was because http.StatusNotModified was returned.
  2159  func (c *ProjectsLocationsCustomClassesGetCall) Do(opts ...googleapi.CallOption) (*CustomClass, error) {
  2160  	gensupport.SetOptions(c.urlParams_, opts...)
  2161  	res, err := c.doRequest("json")
  2162  	if res != nil && res.StatusCode == http.StatusNotModified {
  2163  		if res.Body != nil {
  2164  			res.Body.Close()
  2165  		}
  2166  		return nil, gensupport.WrapError(&googleapi.Error{
  2167  			Code:   res.StatusCode,
  2168  			Header: res.Header,
  2169  		})
  2170  	}
  2171  	if err != nil {
  2172  		return nil, err
  2173  	}
  2174  	defer googleapi.CloseBody(res)
  2175  	if err := googleapi.CheckResponse(res); err != nil {
  2176  		return nil, gensupport.WrapError(err)
  2177  	}
  2178  	ret := &CustomClass{
  2179  		ServerResponse: googleapi.ServerResponse{
  2180  			Header:         res.Header,
  2181  			HTTPStatusCode: res.StatusCode,
  2182  		},
  2183  	}
  2184  	target := &ret
  2185  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2186  		return nil, err
  2187  	}
  2188  	return ret, nil
  2189  }
  2190  
  2191  type ProjectsLocationsCustomClassesListCall struct {
  2192  	s            *Service
  2193  	parent       string
  2194  	urlParams_   gensupport.URLParams
  2195  	ifNoneMatch_ string
  2196  	ctx_         context.Context
  2197  	header_      http.Header
  2198  }
  2199  
  2200  // List: List custom classes.
  2201  //
  2202  //   - parent: The parent, which owns this collection of custom classes. Format:
  2203  //     `projects/{project}/locations/{location}/customClasses` Speech-to-Text
  2204  //     supports three locations: `global`, `us` (US North America), and `eu`
  2205  //     (Europe). If you are calling the `speech.googleapis.com` endpoint, use the
  2206  //     `global` location. To specify a region, use a regional endpoint
  2207  //     (https://cloud.google.com/speech-to-text/docs/endpoints) with matching
  2208  //     `us` or `eu` location value.
  2209  func (r *ProjectsLocationsCustomClassesService) List(parent string) *ProjectsLocationsCustomClassesListCall {
  2210  	c := &ProjectsLocationsCustomClassesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2211  	c.parent = parent
  2212  	return c
  2213  }
  2214  
  2215  // PageSize sets the optional parameter "pageSize": The maximum number of
  2216  // custom classes to return. The service may return fewer than this value. If
  2217  // unspecified, at most 50 custom classes will be returned. The maximum value
  2218  // is 1000; values above 1000 will be coerced to 1000.
  2219  func (c *ProjectsLocationsCustomClassesListCall) PageSize(pageSize int64) *ProjectsLocationsCustomClassesListCall {
  2220  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2221  	return c
  2222  }
  2223  
  2224  // PageToken sets the optional parameter "pageToken": A page token, received
  2225  // from a previous `ListCustomClass` call. Provide this to retrieve the
  2226  // subsequent page. When paginating, all other parameters provided to
  2227  // `ListCustomClass` must match the call that provided the page token.
  2228  func (c *ProjectsLocationsCustomClassesListCall) PageToken(pageToken string) *ProjectsLocationsCustomClassesListCall {
  2229  	c.urlParams_.Set("pageToken", pageToken)
  2230  	return c
  2231  }
  2232  
  2233  // Fields allows partial responses to be retrieved. See
  2234  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2235  // details.
  2236  func (c *ProjectsLocationsCustomClassesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsCustomClassesListCall {
  2237  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2238  	return c
  2239  }
  2240  
  2241  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2242  // object's ETag matches the given value. This is useful for getting updates
  2243  // only after the object has changed since the last request.
  2244  func (c *ProjectsLocationsCustomClassesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsCustomClassesListCall {
  2245  	c.ifNoneMatch_ = entityTag
  2246  	return c
  2247  }
  2248  
  2249  // Context sets the context to be used in this call's Do method.
  2250  func (c *ProjectsLocationsCustomClassesListCall) Context(ctx context.Context) *ProjectsLocationsCustomClassesListCall {
  2251  	c.ctx_ = ctx
  2252  	return c
  2253  }
  2254  
  2255  // Header returns a http.Header that can be modified by the caller to add
  2256  // headers to the request.
  2257  func (c *ProjectsLocationsCustomClassesListCall) Header() http.Header {
  2258  	if c.header_ == nil {
  2259  		c.header_ = make(http.Header)
  2260  	}
  2261  	return c.header_
  2262  }
  2263  
  2264  func (c *ProjectsLocationsCustomClassesListCall) doRequest(alt string) (*http.Response, error) {
  2265  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2266  	if c.ifNoneMatch_ != "" {
  2267  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2268  	}
  2269  	var body io.Reader = nil
  2270  	c.urlParams_.Set("alt", alt)
  2271  	c.urlParams_.Set("prettyPrint", "false")
  2272  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/customClasses")
  2273  	urls += "?" + c.urlParams_.Encode()
  2274  	req, err := http.NewRequest("GET", urls, body)
  2275  	if err != nil {
  2276  		return nil, err
  2277  	}
  2278  	req.Header = reqHeaders
  2279  	googleapi.Expand(req.URL, map[string]string{
  2280  		"parent": c.parent,
  2281  	})
  2282  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2283  }
  2284  
  2285  // Do executes the "speech.projects.locations.customClasses.list" call.
  2286  // Any non-2xx status code is an error. Response headers are in either
  2287  // *ListCustomClassesResponse.ServerResponse.Header or (if a response was
  2288  // returned at all) in error.(*googleapi.Error).Header. Use
  2289  // googleapi.IsNotModified to check whether the returned error was because
  2290  // http.StatusNotModified was returned.
  2291  func (c *ProjectsLocationsCustomClassesListCall) Do(opts ...googleapi.CallOption) (*ListCustomClassesResponse, error) {
  2292  	gensupport.SetOptions(c.urlParams_, opts...)
  2293  	res, err := c.doRequest("json")
  2294  	if res != nil && res.StatusCode == http.StatusNotModified {
  2295  		if res.Body != nil {
  2296  			res.Body.Close()
  2297  		}
  2298  		return nil, gensupport.WrapError(&googleapi.Error{
  2299  			Code:   res.StatusCode,
  2300  			Header: res.Header,
  2301  		})
  2302  	}
  2303  	if err != nil {
  2304  		return nil, err
  2305  	}
  2306  	defer googleapi.CloseBody(res)
  2307  	if err := googleapi.CheckResponse(res); err != nil {
  2308  		return nil, gensupport.WrapError(err)
  2309  	}
  2310  	ret := &ListCustomClassesResponse{
  2311  		ServerResponse: googleapi.ServerResponse{
  2312  			Header:         res.Header,
  2313  			HTTPStatusCode: res.StatusCode,
  2314  		},
  2315  	}
  2316  	target := &ret
  2317  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2318  		return nil, err
  2319  	}
  2320  	return ret, nil
  2321  }
  2322  
  2323  // Pages invokes f for each page of results.
  2324  // A non-nil error returned from f will halt the iteration.
  2325  // The provided context supersedes any context provided to the Context method.
  2326  func (c *ProjectsLocationsCustomClassesListCall) Pages(ctx context.Context, f func(*ListCustomClassesResponse) error) error {
  2327  	c.ctx_ = ctx
  2328  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2329  	for {
  2330  		x, err := c.Do()
  2331  		if err != nil {
  2332  			return err
  2333  		}
  2334  		if err := f(x); err != nil {
  2335  			return err
  2336  		}
  2337  		if x.NextPageToken == "" {
  2338  			return nil
  2339  		}
  2340  		c.PageToken(x.NextPageToken)
  2341  	}
  2342  }
  2343  
  2344  type ProjectsLocationsCustomClassesPatchCall struct {
  2345  	s           *Service
  2346  	name        string
  2347  	customclass *CustomClass
  2348  	urlParams_  gensupport.URLParams
  2349  	ctx_        context.Context
  2350  	header_     http.Header
  2351  }
  2352  
  2353  // Patch: Update a custom class.
  2354  //
  2355  // - name: The resource name of the custom class.
  2356  func (r *ProjectsLocationsCustomClassesService) Patch(name string, customclass *CustomClass) *ProjectsLocationsCustomClassesPatchCall {
  2357  	c := &ProjectsLocationsCustomClassesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2358  	c.name = name
  2359  	c.customclass = customclass
  2360  	return c
  2361  }
  2362  
  2363  // UpdateMask sets the optional parameter "updateMask": The list of fields to
  2364  // be updated.
  2365  func (c *ProjectsLocationsCustomClassesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsCustomClassesPatchCall {
  2366  	c.urlParams_.Set("updateMask", updateMask)
  2367  	return c
  2368  }
  2369  
  2370  // Fields allows partial responses to be retrieved. See
  2371  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2372  // details.
  2373  func (c *ProjectsLocationsCustomClassesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsCustomClassesPatchCall {
  2374  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2375  	return c
  2376  }
  2377  
  2378  // Context sets the context to be used in this call's Do method.
  2379  func (c *ProjectsLocationsCustomClassesPatchCall) Context(ctx context.Context) *ProjectsLocationsCustomClassesPatchCall {
  2380  	c.ctx_ = ctx
  2381  	return c
  2382  }
  2383  
  2384  // Header returns a http.Header that can be modified by the caller to add
  2385  // headers to the request.
  2386  func (c *ProjectsLocationsCustomClassesPatchCall) Header() http.Header {
  2387  	if c.header_ == nil {
  2388  		c.header_ = make(http.Header)
  2389  	}
  2390  	return c.header_
  2391  }
  2392  
  2393  func (c *ProjectsLocationsCustomClassesPatchCall) doRequest(alt string) (*http.Response, error) {
  2394  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2395  	var body io.Reader = nil
  2396  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.customclass)
  2397  	if err != nil {
  2398  		return nil, err
  2399  	}
  2400  	c.urlParams_.Set("alt", alt)
  2401  	c.urlParams_.Set("prettyPrint", "false")
  2402  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2403  	urls += "?" + c.urlParams_.Encode()
  2404  	req, err := http.NewRequest("PATCH", urls, body)
  2405  	if err != nil {
  2406  		return nil, err
  2407  	}
  2408  	req.Header = reqHeaders
  2409  	googleapi.Expand(req.URL, map[string]string{
  2410  		"name": c.name,
  2411  	})
  2412  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2413  }
  2414  
  2415  // Do executes the "speech.projects.locations.customClasses.patch" call.
  2416  // Any non-2xx status code is an error. Response headers are in either
  2417  // *CustomClass.ServerResponse.Header or (if a response was returned at all) in
  2418  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2419  // whether the returned error was because http.StatusNotModified was returned.
  2420  func (c *ProjectsLocationsCustomClassesPatchCall) Do(opts ...googleapi.CallOption) (*CustomClass, error) {
  2421  	gensupport.SetOptions(c.urlParams_, opts...)
  2422  	res, err := c.doRequest("json")
  2423  	if res != nil && res.StatusCode == http.StatusNotModified {
  2424  		if res.Body != nil {
  2425  			res.Body.Close()
  2426  		}
  2427  		return nil, gensupport.WrapError(&googleapi.Error{
  2428  			Code:   res.StatusCode,
  2429  			Header: res.Header,
  2430  		})
  2431  	}
  2432  	if err != nil {
  2433  		return nil, err
  2434  	}
  2435  	defer googleapi.CloseBody(res)
  2436  	if err := googleapi.CheckResponse(res); err != nil {
  2437  		return nil, gensupport.WrapError(err)
  2438  	}
  2439  	ret := &CustomClass{
  2440  		ServerResponse: googleapi.ServerResponse{
  2441  			Header:         res.Header,
  2442  			HTTPStatusCode: res.StatusCode,
  2443  		},
  2444  	}
  2445  	target := &ret
  2446  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2447  		return nil, err
  2448  	}
  2449  	return ret, nil
  2450  }
  2451  
  2452  type ProjectsLocationsPhraseSetsCreateCall struct {
  2453  	s                      *Service
  2454  	parent                 string
  2455  	createphrasesetrequest *CreatePhraseSetRequest
  2456  	urlParams_             gensupport.URLParams
  2457  	ctx_                   context.Context
  2458  	header_                http.Header
  2459  }
  2460  
  2461  // Create: Create a set of phrase hints. Each item in the set can be a single
  2462  // word or a multi-word phrase. The items in the PhraseSet are favored by the
  2463  // recognition model when you send a call that includes the PhraseSet.
  2464  //
  2465  //   - parent: The parent resource where this phrase set will be created. Format:
  2466  //     `projects/{project}/locations/{location}` Speech-to-Text supports three
  2467  //     locations: `global`, `us` (US North America), and `eu` (Europe). If you
  2468  //     are calling the `speech.googleapis.com` endpoint, use the `global`
  2469  //     location. To specify a region, use a regional endpoint
  2470  //     (https://cloud.google.com/speech-to-text/docs/endpoints) with matching
  2471  //     `us` or `eu` location value.
  2472  func (r *ProjectsLocationsPhraseSetsService) Create(parent string, createphrasesetrequest *CreatePhraseSetRequest) *ProjectsLocationsPhraseSetsCreateCall {
  2473  	c := &ProjectsLocationsPhraseSetsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2474  	c.parent = parent
  2475  	c.createphrasesetrequest = createphrasesetrequest
  2476  	return c
  2477  }
  2478  
  2479  // Fields allows partial responses to be retrieved. See
  2480  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2481  // details.
  2482  func (c *ProjectsLocationsPhraseSetsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsPhraseSetsCreateCall {
  2483  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2484  	return c
  2485  }
  2486  
  2487  // Context sets the context to be used in this call's Do method.
  2488  func (c *ProjectsLocationsPhraseSetsCreateCall) Context(ctx context.Context) *ProjectsLocationsPhraseSetsCreateCall {
  2489  	c.ctx_ = ctx
  2490  	return c
  2491  }
  2492  
  2493  // Header returns a http.Header that can be modified by the caller to add
  2494  // headers to the request.
  2495  func (c *ProjectsLocationsPhraseSetsCreateCall) Header() http.Header {
  2496  	if c.header_ == nil {
  2497  		c.header_ = make(http.Header)
  2498  	}
  2499  	return c.header_
  2500  }
  2501  
  2502  func (c *ProjectsLocationsPhraseSetsCreateCall) doRequest(alt string) (*http.Response, error) {
  2503  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2504  	var body io.Reader = nil
  2505  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.createphrasesetrequest)
  2506  	if err != nil {
  2507  		return nil, err
  2508  	}
  2509  	c.urlParams_.Set("alt", alt)
  2510  	c.urlParams_.Set("prettyPrint", "false")
  2511  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/phraseSets")
  2512  	urls += "?" + c.urlParams_.Encode()
  2513  	req, err := http.NewRequest("POST", urls, body)
  2514  	if err != nil {
  2515  		return nil, err
  2516  	}
  2517  	req.Header = reqHeaders
  2518  	googleapi.Expand(req.URL, map[string]string{
  2519  		"parent": c.parent,
  2520  	})
  2521  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2522  }
  2523  
  2524  // Do executes the "speech.projects.locations.phraseSets.create" call.
  2525  // Any non-2xx status code is an error. Response headers are in either
  2526  // *PhraseSet.ServerResponse.Header or (if a response was returned at all) in
  2527  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2528  // whether the returned error was because http.StatusNotModified was returned.
  2529  func (c *ProjectsLocationsPhraseSetsCreateCall) Do(opts ...googleapi.CallOption) (*PhraseSet, error) {
  2530  	gensupport.SetOptions(c.urlParams_, opts...)
  2531  	res, err := c.doRequest("json")
  2532  	if res != nil && res.StatusCode == http.StatusNotModified {
  2533  		if res.Body != nil {
  2534  			res.Body.Close()
  2535  		}
  2536  		return nil, gensupport.WrapError(&googleapi.Error{
  2537  			Code:   res.StatusCode,
  2538  			Header: res.Header,
  2539  		})
  2540  	}
  2541  	if err != nil {
  2542  		return nil, err
  2543  	}
  2544  	defer googleapi.CloseBody(res)
  2545  	if err := googleapi.CheckResponse(res); err != nil {
  2546  		return nil, gensupport.WrapError(err)
  2547  	}
  2548  	ret := &PhraseSet{
  2549  		ServerResponse: googleapi.ServerResponse{
  2550  			Header:         res.Header,
  2551  			HTTPStatusCode: res.StatusCode,
  2552  		},
  2553  	}
  2554  	target := &ret
  2555  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2556  		return nil, err
  2557  	}
  2558  	return ret, nil
  2559  }
  2560  
  2561  type ProjectsLocationsPhraseSetsDeleteCall struct {
  2562  	s          *Service
  2563  	name       string
  2564  	urlParams_ gensupport.URLParams
  2565  	ctx_       context.Context
  2566  	header_    http.Header
  2567  }
  2568  
  2569  // Delete: Delete a phrase set.
  2570  //
  2571  //   - name: The name of the phrase set to delete. Format:
  2572  //     `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
  2573  func (r *ProjectsLocationsPhraseSetsService) Delete(name string) *ProjectsLocationsPhraseSetsDeleteCall {
  2574  	c := &ProjectsLocationsPhraseSetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2575  	c.name = name
  2576  	return c
  2577  }
  2578  
  2579  // Fields allows partial responses to be retrieved. See
  2580  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2581  // details.
  2582  func (c *ProjectsLocationsPhraseSetsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsPhraseSetsDeleteCall {
  2583  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2584  	return c
  2585  }
  2586  
  2587  // Context sets the context to be used in this call's Do method.
  2588  func (c *ProjectsLocationsPhraseSetsDeleteCall) Context(ctx context.Context) *ProjectsLocationsPhraseSetsDeleteCall {
  2589  	c.ctx_ = ctx
  2590  	return c
  2591  }
  2592  
  2593  // Header returns a http.Header that can be modified by the caller to add
  2594  // headers to the request.
  2595  func (c *ProjectsLocationsPhraseSetsDeleteCall) Header() http.Header {
  2596  	if c.header_ == nil {
  2597  		c.header_ = make(http.Header)
  2598  	}
  2599  	return c.header_
  2600  }
  2601  
  2602  func (c *ProjectsLocationsPhraseSetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2603  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2604  	var body io.Reader = nil
  2605  	c.urlParams_.Set("alt", alt)
  2606  	c.urlParams_.Set("prettyPrint", "false")
  2607  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2608  	urls += "?" + c.urlParams_.Encode()
  2609  	req, err := http.NewRequest("DELETE", urls, body)
  2610  	if err != nil {
  2611  		return nil, err
  2612  	}
  2613  	req.Header = reqHeaders
  2614  	googleapi.Expand(req.URL, map[string]string{
  2615  		"name": c.name,
  2616  	})
  2617  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2618  }
  2619  
  2620  // Do executes the "speech.projects.locations.phraseSets.delete" call.
  2621  // Any non-2xx status code is an error. Response headers are in either
  2622  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  2623  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2624  // whether the returned error was because http.StatusNotModified was returned.
  2625  func (c *ProjectsLocationsPhraseSetsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2626  	gensupport.SetOptions(c.urlParams_, opts...)
  2627  	res, err := c.doRequest("json")
  2628  	if res != nil && res.StatusCode == http.StatusNotModified {
  2629  		if res.Body != nil {
  2630  			res.Body.Close()
  2631  		}
  2632  		return nil, gensupport.WrapError(&googleapi.Error{
  2633  			Code:   res.StatusCode,
  2634  			Header: res.Header,
  2635  		})
  2636  	}
  2637  	if err != nil {
  2638  		return nil, err
  2639  	}
  2640  	defer googleapi.CloseBody(res)
  2641  	if err := googleapi.CheckResponse(res); err != nil {
  2642  		return nil, gensupport.WrapError(err)
  2643  	}
  2644  	ret := &Empty{
  2645  		ServerResponse: googleapi.ServerResponse{
  2646  			Header:         res.Header,
  2647  			HTTPStatusCode: res.StatusCode,
  2648  		},
  2649  	}
  2650  	target := &ret
  2651  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2652  		return nil, err
  2653  	}
  2654  	return ret, nil
  2655  }
  2656  
  2657  type ProjectsLocationsPhraseSetsGetCall struct {
  2658  	s            *Service
  2659  	name         string
  2660  	urlParams_   gensupport.URLParams
  2661  	ifNoneMatch_ string
  2662  	ctx_         context.Context
  2663  	header_      http.Header
  2664  }
  2665  
  2666  // Get: Get a phrase set.
  2667  //
  2668  //   - name: The name of the phrase set to retrieve. Format:
  2669  //     `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
  2670  //     Speech-to-Text supports three locations: `global`, `us` (US North
  2671  //     America), and `eu` (Europe). If you are calling the
  2672  //     `speech.googleapis.com` endpoint, use the `global` location. To specify a
  2673  //     region, use a regional endpoint
  2674  //     (https://cloud.google.com/speech-to-text/docs/endpoints) with matching
  2675  //     `us` or `eu` location value.
  2676  func (r *ProjectsLocationsPhraseSetsService) Get(name string) *ProjectsLocationsPhraseSetsGetCall {
  2677  	c := &ProjectsLocationsPhraseSetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2678  	c.name = name
  2679  	return c
  2680  }
  2681  
  2682  // Fields allows partial responses to be retrieved. See
  2683  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2684  // details.
  2685  func (c *ProjectsLocationsPhraseSetsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsPhraseSetsGetCall {
  2686  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2687  	return c
  2688  }
  2689  
  2690  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2691  // object's ETag matches the given value. This is useful for getting updates
  2692  // only after the object has changed since the last request.
  2693  func (c *ProjectsLocationsPhraseSetsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsPhraseSetsGetCall {
  2694  	c.ifNoneMatch_ = entityTag
  2695  	return c
  2696  }
  2697  
  2698  // Context sets the context to be used in this call's Do method.
  2699  func (c *ProjectsLocationsPhraseSetsGetCall) Context(ctx context.Context) *ProjectsLocationsPhraseSetsGetCall {
  2700  	c.ctx_ = ctx
  2701  	return c
  2702  }
  2703  
  2704  // Header returns a http.Header that can be modified by the caller to add
  2705  // headers to the request.
  2706  func (c *ProjectsLocationsPhraseSetsGetCall) Header() http.Header {
  2707  	if c.header_ == nil {
  2708  		c.header_ = make(http.Header)
  2709  	}
  2710  	return c.header_
  2711  }
  2712  
  2713  func (c *ProjectsLocationsPhraseSetsGetCall) doRequest(alt string) (*http.Response, error) {
  2714  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2715  	if c.ifNoneMatch_ != "" {
  2716  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2717  	}
  2718  	var body io.Reader = nil
  2719  	c.urlParams_.Set("alt", alt)
  2720  	c.urlParams_.Set("prettyPrint", "false")
  2721  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2722  	urls += "?" + c.urlParams_.Encode()
  2723  	req, err := http.NewRequest("GET", urls, body)
  2724  	if err != nil {
  2725  		return nil, err
  2726  	}
  2727  	req.Header = reqHeaders
  2728  	googleapi.Expand(req.URL, map[string]string{
  2729  		"name": c.name,
  2730  	})
  2731  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2732  }
  2733  
  2734  // Do executes the "speech.projects.locations.phraseSets.get" call.
  2735  // Any non-2xx status code is an error. Response headers are in either
  2736  // *PhraseSet.ServerResponse.Header or (if a response was returned at all) in
  2737  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2738  // whether the returned error was because http.StatusNotModified was returned.
  2739  func (c *ProjectsLocationsPhraseSetsGetCall) Do(opts ...googleapi.CallOption) (*PhraseSet, error) {
  2740  	gensupport.SetOptions(c.urlParams_, opts...)
  2741  	res, err := c.doRequest("json")
  2742  	if res != nil && res.StatusCode == http.StatusNotModified {
  2743  		if res.Body != nil {
  2744  			res.Body.Close()
  2745  		}
  2746  		return nil, gensupport.WrapError(&googleapi.Error{
  2747  			Code:   res.StatusCode,
  2748  			Header: res.Header,
  2749  		})
  2750  	}
  2751  	if err != nil {
  2752  		return nil, err
  2753  	}
  2754  	defer googleapi.CloseBody(res)
  2755  	if err := googleapi.CheckResponse(res); err != nil {
  2756  		return nil, gensupport.WrapError(err)
  2757  	}
  2758  	ret := &PhraseSet{
  2759  		ServerResponse: googleapi.ServerResponse{
  2760  			Header:         res.Header,
  2761  			HTTPStatusCode: res.StatusCode,
  2762  		},
  2763  	}
  2764  	target := &ret
  2765  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2766  		return nil, err
  2767  	}
  2768  	return ret, nil
  2769  }
  2770  
  2771  type ProjectsLocationsPhraseSetsListCall struct {
  2772  	s            *Service
  2773  	parent       string
  2774  	urlParams_   gensupport.URLParams
  2775  	ifNoneMatch_ string
  2776  	ctx_         context.Context
  2777  	header_      http.Header
  2778  }
  2779  
  2780  // List: List phrase sets.
  2781  //
  2782  //   - parent: The parent, which owns this collection of phrase set. Format:
  2783  //     `projects/{project}/locations/{location}` Speech-to-Text supports three
  2784  //     locations: `global`, `us` (US North America), and `eu` (Europe). If you
  2785  //     are calling the `speech.googleapis.com` endpoint, use the `global`
  2786  //     location. To specify a region, use a regional endpoint
  2787  //     (https://cloud.google.com/speech-to-text/docs/endpoints) with matching
  2788  //     `us` or `eu` location value.
  2789  func (r *ProjectsLocationsPhraseSetsService) List(parent string) *ProjectsLocationsPhraseSetsListCall {
  2790  	c := &ProjectsLocationsPhraseSetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2791  	c.parent = parent
  2792  	return c
  2793  }
  2794  
  2795  // PageSize sets the optional parameter "pageSize": The maximum number of
  2796  // phrase sets to return. The service may return fewer than this value. If
  2797  // unspecified, at most 50 phrase sets will be returned. The maximum value is
  2798  // 1000; values above 1000 will be coerced to 1000.
  2799  func (c *ProjectsLocationsPhraseSetsListCall) PageSize(pageSize int64) *ProjectsLocationsPhraseSetsListCall {
  2800  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2801  	return c
  2802  }
  2803  
  2804  // PageToken sets the optional parameter "pageToken": A page token, received
  2805  // from a previous `ListPhraseSet` call. Provide this to retrieve the
  2806  // subsequent page. When paginating, all other parameters provided to
  2807  // `ListPhraseSet` must match the call that provided the page token.
  2808  func (c *ProjectsLocationsPhraseSetsListCall) PageToken(pageToken string) *ProjectsLocationsPhraseSetsListCall {
  2809  	c.urlParams_.Set("pageToken", pageToken)
  2810  	return c
  2811  }
  2812  
  2813  // Fields allows partial responses to be retrieved. See
  2814  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2815  // details.
  2816  func (c *ProjectsLocationsPhraseSetsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsPhraseSetsListCall {
  2817  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2818  	return c
  2819  }
  2820  
  2821  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2822  // object's ETag matches the given value. This is useful for getting updates
  2823  // only after the object has changed since the last request.
  2824  func (c *ProjectsLocationsPhraseSetsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsPhraseSetsListCall {
  2825  	c.ifNoneMatch_ = entityTag
  2826  	return c
  2827  }
  2828  
  2829  // Context sets the context to be used in this call's Do method.
  2830  func (c *ProjectsLocationsPhraseSetsListCall) Context(ctx context.Context) *ProjectsLocationsPhraseSetsListCall {
  2831  	c.ctx_ = ctx
  2832  	return c
  2833  }
  2834  
  2835  // Header returns a http.Header that can be modified by the caller to add
  2836  // headers to the request.
  2837  func (c *ProjectsLocationsPhraseSetsListCall) Header() http.Header {
  2838  	if c.header_ == nil {
  2839  		c.header_ = make(http.Header)
  2840  	}
  2841  	return c.header_
  2842  }
  2843  
  2844  func (c *ProjectsLocationsPhraseSetsListCall) doRequest(alt string) (*http.Response, error) {
  2845  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2846  	if c.ifNoneMatch_ != "" {
  2847  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2848  	}
  2849  	var body io.Reader = nil
  2850  	c.urlParams_.Set("alt", alt)
  2851  	c.urlParams_.Set("prettyPrint", "false")
  2852  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/phraseSets")
  2853  	urls += "?" + c.urlParams_.Encode()
  2854  	req, err := http.NewRequest("GET", urls, body)
  2855  	if err != nil {
  2856  		return nil, err
  2857  	}
  2858  	req.Header = reqHeaders
  2859  	googleapi.Expand(req.URL, map[string]string{
  2860  		"parent": c.parent,
  2861  	})
  2862  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2863  }
  2864  
  2865  // Do executes the "speech.projects.locations.phraseSets.list" call.
  2866  // Any non-2xx status code is an error. Response headers are in either
  2867  // *ListPhraseSetResponse.ServerResponse.Header or (if a response was returned
  2868  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2869  // check whether the returned error was because http.StatusNotModified was
  2870  // returned.
  2871  func (c *ProjectsLocationsPhraseSetsListCall) Do(opts ...googleapi.CallOption) (*ListPhraseSetResponse, error) {
  2872  	gensupport.SetOptions(c.urlParams_, opts...)
  2873  	res, err := c.doRequest("json")
  2874  	if res != nil && res.StatusCode == http.StatusNotModified {
  2875  		if res.Body != nil {
  2876  			res.Body.Close()
  2877  		}
  2878  		return nil, gensupport.WrapError(&googleapi.Error{
  2879  			Code:   res.StatusCode,
  2880  			Header: res.Header,
  2881  		})
  2882  	}
  2883  	if err != nil {
  2884  		return nil, err
  2885  	}
  2886  	defer googleapi.CloseBody(res)
  2887  	if err := googleapi.CheckResponse(res); err != nil {
  2888  		return nil, gensupport.WrapError(err)
  2889  	}
  2890  	ret := &ListPhraseSetResponse{
  2891  		ServerResponse: googleapi.ServerResponse{
  2892  			Header:         res.Header,
  2893  			HTTPStatusCode: res.StatusCode,
  2894  		},
  2895  	}
  2896  	target := &ret
  2897  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2898  		return nil, err
  2899  	}
  2900  	return ret, nil
  2901  }
  2902  
  2903  // Pages invokes f for each page of results.
  2904  // A non-nil error returned from f will halt the iteration.
  2905  // The provided context supersedes any context provided to the Context method.
  2906  func (c *ProjectsLocationsPhraseSetsListCall) Pages(ctx context.Context, f func(*ListPhraseSetResponse) error) error {
  2907  	c.ctx_ = ctx
  2908  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2909  	for {
  2910  		x, err := c.Do()
  2911  		if err != nil {
  2912  			return err
  2913  		}
  2914  		if err := f(x); err != nil {
  2915  			return err
  2916  		}
  2917  		if x.NextPageToken == "" {
  2918  			return nil
  2919  		}
  2920  		c.PageToken(x.NextPageToken)
  2921  	}
  2922  }
  2923  
  2924  type ProjectsLocationsPhraseSetsPatchCall struct {
  2925  	s          *Service
  2926  	name       string
  2927  	phraseset  *PhraseSet
  2928  	urlParams_ gensupport.URLParams
  2929  	ctx_       context.Context
  2930  	header_    http.Header
  2931  }
  2932  
  2933  // Patch: Update a phrase set.
  2934  //
  2935  // - name: The resource name of the phrase set.
  2936  func (r *ProjectsLocationsPhraseSetsService) Patch(name string, phraseset *PhraseSet) *ProjectsLocationsPhraseSetsPatchCall {
  2937  	c := &ProjectsLocationsPhraseSetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2938  	c.name = name
  2939  	c.phraseset = phraseset
  2940  	return c
  2941  }
  2942  
  2943  // UpdateMask sets the optional parameter "updateMask": The list of fields to
  2944  // be updated.
  2945  func (c *ProjectsLocationsPhraseSetsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsPhraseSetsPatchCall {
  2946  	c.urlParams_.Set("updateMask", updateMask)
  2947  	return c
  2948  }
  2949  
  2950  // Fields allows partial responses to be retrieved. See
  2951  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2952  // details.
  2953  func (c *ProjectsLocationsPhraseSetsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsPhraseSetsPatchCall {
  2954  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2955  	return c
  2956  }
  2957  
  2958  // Context sets the context to be used in this call's Do method.
  2959  func (c *ProjectsLocationsPhraseSetsPatchCall) Context(ctx context.Context) *ProjectsLocationsPhraseSetsPatchCall {
  2960  	c.ctx_ = ctx
  2961  	return c
  2962  }
  2963  
  2964  // Header returns a http.Header that can be modified by the caller to add
  2965  // headers to the request.
  2966  func (c *ProjectsLocationsPhraseSetsPatchCall) Header() http.Header {
  2967  	if c.header_ == nil {
  2968  		c.header_ = make(http.Header)
  2969  	}
  2970  	return c.header_
  2971  }
  2972  
  2973  func (c *ProjectsLocationsPhraseSetsPatchCall) doRequest(alt string) (*http.Response, error) {
  2974  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2975  	var body io.Reader = nil
  2976  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.phraseset)
  2977  	if err != nil {
  2978  		return nil, err
  2979  	}
  2980  	c.urlParams_.Set("alt", alt)
  2981  	c.urlParams_.Set("prettyPrint", "false")
  2982  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2983  	urls += "?" + c.urlParams_.Encode()
  2984  	req, err := http.NewRequest("PATCH", urls, body)
  2985  	if err != nil {
  2986  		return nil, err
  2987  	}
  2988  	req.Header = reqHeaders
  2989  	googleapi.Expand(req.URL, map[string]string{
  2990  		"name": c.name,
  2991  	})
  2992  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2993  }
  2994  
  2995  // Do executes the "speech.projects.locations.phraseSets.patch" call.
  2996  // Any non-2xx status code is an error. Response headers are in either
  2997  // *PhraseSet.ServerResponse.Header or (if a response was returned at all) in
  2998  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2999  // whether the returned error was because http.StatusNotModified was returned.
  3000  func (c *ProjectsLocationsPhraseSetsPatchCall) Do(opts ...googleapi.CallOption) (*PhraseSet, error) {
  3001  	gensupport.SetOptions(c.urlParams_, opts...)
  3002  	res, err := c.doRequest("json")
  3003  	if res != nil && res.StatusCode == http.StatusNotModified {
  3004  		if res.Body != nil {
  3005  			res.Body.Close()
  3006  		}
  3007  		return nil, gensupport.WrapError(&googleapi.Error{
  3008  			Code:   res.StatusCode,
  3009  			Header: res.Header,
  3010  		})
  3011  	}
  3012  	if err != nil {
  3013  		return nil, err
  3014  	}
  3015  	defer googleapi.CloseBody(res)
  3016  	if err := googleapi.CheckResponse(res); err != nil {
  3017  		return nil, gensupport.WrapError(err)
  3018  	}
  3019  	ret := &PhraseSet{
  3020  		ServerResponse: googleapi.ServerResponse{
  3021  			Header:         res.Header,
  3022  			HTTPStatusCode: res.StatusCode,
  3023  		},
  3024  	}
  3025  	target := &ret
  3026  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3027  		return nil, err
  3028  	}
  3029  	return ret, nil
  3030  }
  3031  
  3032  type SpeechLongrunningrecognizeCall struct {
  3033  	s                           *Service
  3034  	longrunningrecognizerequest *LongRunningRecognizeRequest
  3035  	urlParams_                  gensupport.URLParams
  3036  	ctx_                        context.Context
  3037  	header_                     http.Header
  3038  }
  3039  
  3040  // Longrunningrecognize: Performs asynchronous speech recognition: receive
  3041  // results via the google.longrunning.Operations interface. Returns either an
  3042  // `Operation.error` or an `Operation.response` which contains a
  3043  // `LongRunningRecognizeResponse` message. For more information on asynchronous
  3044  // speech recognition, see the how-to
  3045  // (https://cloud.google.com/speech-to-text/docs/async-recognize).
  3046  func (r *SpeechService) Longrunningrecognize(longrunningrecognizerequest *LongRunningRecognizeRequest) *SpeechLongrunningrecognizeCall {
  3047  	c := &SpeechLongrunningrecognizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3048  	c.longrunningrecognizerequest = longrunningrecognizerequest
  3049  	return c
  3050  }
  3051  
  3052  // Fields allows partial responses to be retrieved. See
  3053  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3054  // details.
  3055  func (c *SpeechLongrunningrecognizeCall) Fields(s ...googleapi.Field) *SpeechLongrunningrecognizeCall {
  3056  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3057  	return c
  3058  }
  3059  
  3060  // Context sets the context to be used in this call's Do method.
  3061  func (c *SpeechLongrunningrecognizeCall) Context(ctx context.Context) *SpeechLongrunningrecognizeCall {
  3062  	c.ctx_ = ctx
  3063  	return c
  3064  }
  3065  
  3066  // Header returns a http.Header that can be modified by the caller to add
  3067  // headers to the request.
  3068  func (c *SpeechLongrunningrecognizeCall) Header() http.Header {
  3069  	if c.header_ == nil {
  3070  		c.header_ = make(http.Header)
  3071  	}
  3072  	return c.header_
  3073  }
  3074  
  3075  func (c *SpeechLongrunningrecognizeCall) doRequest(alt string) (*http.Response, error) {
  3076  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3077  	var body io.Reader = nil
  3078  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.longrunningrecognizerequest)
  3079  	if err != nil {
  3080  		return nil, err
  3081  	}
  3082  	c.urlParams_.Set("alt", alt)
  3083  	c.urlParams_.Set("prettyPrint", "false")
  3084  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/speech:longrunningrecognize")
  3085  	urls += "?" + c.urlParams_.Encode()
  3086  	req, err := http.NewRequest("POST", urls, body)
  3087  	if err != nil {
  3088  		return nil, err
  3089  	}
  3090  	req.Header = reqHeaders
  3091  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3092  }
  3093  
  3094  // Do executes the "speech.speech.longrunningrecognize" call.
  3095  // Any non-2xx status code is an error. Response headers are in either
  3096  // *Operation.ServerResponse.Header or (if a response was returned at all) in
  3097  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3098  // whether the returned error was because http.StatusNotModified was returned.
  3099  func (c *SpeechLongrunningrecognizeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3100  	gensupport.SetOptions(c.urlParams_, opts...)
  3101  	res, err := c.doRequest("json")
  3102  	if res != nil && res.StatusCode == http.StatusNotModified {
  3103  		if res.Body != nil {
  3104  			res.Body.Close()
  3105  		}
  3106  		return nil, gensupport.WrapError(&googleapi.Error{
  3107  			Code:   res.StatusCode,
  3108  			Header: res.Header,
  3109  		})
  3110  	}
  3111  	if err != nil {
  3112  		return nil, err
  3113  	}
  3114  	defer googleapi.CloseBody(res)
  3115  	if err := googleapi.CheckResponse(res); err != nil {
  3116  		return nil, gensupport.WrapError(err)
  3117  	}
  3118  	ret := &Operation{
  3119  		ServerResponse: googleapi.ServerResponse{
  3120  			Header:         res.Header,
  3121  			HTTPStatusCode: res.StatusCode,
  3122  		},
  3123  	}
  3124  	target := &ret
  3125  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3126  		return nil, err
  3127  	}
  3128  	return ret, nil
  3129  }
  3130  
  3131  type SpeechRecognizeCall struct {
  3132  	s                *Service
  3133  	recognizerequest *RecognizeRequest
  3134  	urlParams_       gensupport.URLParams
  3135  	ctx_             context.Context
  3136  	header_          http.Header
  3137  }
  3138  
  3139  // Recognize: Performs synchronous speech recognition: receive results after
  3140  // all audio has been sent and processed.
  3141  func (r *SpeechService) Recognize(recognizerequest *RecognizeRequest) *SpeechRecognizeCall {
  3142  	c := &SpeechRecognizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3143  	c.recognizerequest = recognizerequest
  3144  	return c
  3145  }
  3146  
  3147  // Fields allows partial responses to be retrieved. See
  3148  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3149  // details.
  3150  func (c *SpeechRecognizeCall) Fields(s ...googleapi.Field) *SpeechRecognizeCall {
  3151  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3152  	return c
  3153  }
  3154  
  3155  // Context sets the context to be used in this call's Do method.
  3156  func (c *SpeechRecognizeCall) Context(ctx context.Context) *SpeechRecognizeCall {
  3157  	c.ctx_ = ctx
  3158  	return c
  3159  }
  3160  
  3161  // Header returns a http.Header that can be modified by the caller to add
  3162  // headers to the request.
  3163  func (c *SpeechRecognizeCall) Header() http.Header {
  3164  	if c.header_ == nil {
  3165  		c.header_ = make(http.Header)
  3166  	}
  3167  	return c.header_
  3168  }
  3169  
  3170  func (c *SpeechRecognizeCall) doRequest(alt string) (*http.Response, error) {
  3171  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3172  	var body io.Reader = nil
  3173  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.recognizerequest)
  3174  	if err != nil {
  3175  		return nil, err
  3176  	}
  3177  	c.urlParams_.Set("alt", alt)
  3178  	c.urlParams_.Set("prettyPrint", "false")
  3179  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/speech:recognize")
  3180  	urls += "?" + c.urlParams_.Encode()
  3181  	req, err := http.NewRequest("POST", urls, body)
  3182  	if err != nil {
  3183  		return nil, err
  3184  	}
  3185  	req.Header = reqHeaders
  3186  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3187  }
  3188  
  3189  // Do executes the "speech.speech.recognize" call.
  3190  // Any non-2xx status code is an error. Response headers are in either
  3191  // *RecognizeResponse.ServerResponse.Header or (if a response was returned at
  3192  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3193  // check whether the returned error was because http.StatusNotModified was
  3194  // returned.
  3195  func (c *SpeechRecognizeCall) Do(opts ...googleapi.CallOption) (*RecognizeResponse, error) {
  3196  	gensupport.SetOptions(c.urlParams_, opts...)
  3197  	res, err := c.doRequest("json")
  3198  	if res != nil && res.StatusCode == http.StatusNotModified {
  3199  		if res.Body != nil {
  3200  			res.Body.Close()
  3201  		}
  3202  		return nil, gensupport.WrapError(&googleapi.Error{
  3203  			Code:   res.StatusCode,
  3204  			Header: res.Header,
  3205  		})
  3206  	}
  3207  	if err != nil {
  3208  		return nil, err
  3209  	}
  3210  	defer googleapi.CloseBody(res)
  3211  	if err := googleapi.CheckResponse(res); err != nil {
  3212  		return nil, gensupport.WrapError(err)
  3213  	}
  3214  	ret := &RecognizeResponse{
  3215  		ServerResponse: googleapi.ServerResponse{
  3216  			Header:         res.Header,
  3217  			HTTPStatusCode: res.StatusCode,
  3218  		},
  3219  	}
  3220  	target := &ret
  3221  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3222  		return nil, err
  3223  	}
  3224  	return ret, nil
  3225  }
  3226  

View as plain text