...

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

Documentation: google.golang.org/api/texttospeech/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 texttospeech provides access to the Cloud Text-to-Speech API.
     8  //
     9  // This package is DEPRECATED. Use package cloud.google.com/go/texttospeech/apiv1 instead.
    10  //
    11  // For product documentation, see: https://cloud.google.com/text-to-speech/
    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/texttospeech/v1"
    29  //	...
    30  //	ctx := context.Background()
    31  //	texttospeechService, err := texttospeech.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  //	texttospeechService, err := texttospeech.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  //	texttospeechService, err := texttospeech.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    51  //
    52  // See [google.golang.org/api/option.ClientOption] for details on options.
    53  package texttospeech // import "google.golang.org/api/texttospeech/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 = "texttospeech:v1"
    92  const apiName = "texttospeech"
    93  const apiVersion = "v1"
    94  const basePath = "https://texttospeech.googleapis.com/"
    95  const basePathTemplate = "https://texttospeech.UNIVERSE_DOMAIN/"
    96  const mtlsBasePath = "https://texttospeech.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.Text = NewTextService(s)
   143  	s.Voices = NewVoicesService(s)
   144  	return s, nil
   145  }
   146  
   147  type Service struct {
   148  	client    *http.Client
   149  	BasePath  string // API endpoint base URL
   150  	UserAgent string // optional additional User-Agent fragment
   151  
   152  	Operations *OperationsService
   153  
   154  	Projects *ProjectsService
   155  
   156  	Text *TextService
   157  
   158  	Voices *VoicesService
   159  }
   160  
   161  func (s *Service) userAgent() string {
   162  	if s.UserAgent == "" {
   163  		return googleapi.UserAgent
   164  	}
   165  	return googleapi.UserAgent + " " + s.UserAgent
   166  }
   167  
   168  func NewOperationsService(s *Service) *OperationsService {
   169  	rs := &OperationsService{s: s}
   170  	return rs
   171  }
   172  
   173  type OperationsService struct {
   174  	s *Service
   175  }
   176  
   177  func NewProjectsService(s *Service) *ProjectsService {
   178  	rs := &ProjectsService{s: s}
   179  	rs.Locations = NewProjectsLocationsService(s)
   180  	return rs
   181  }
   182  
   183  type ProjectsService struct {
   184  	s *Service
   185  
   186  	Locations *ProjectsLocationsService
   187  }
   188  
   189  func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
   190  	rs := &ProjectsLocationsService{s: s}
   191  	rs.Operations = NewProjectsLocationsOperationsService(s)
   192  	return rs
   193  }
   194  
   195  type ProjectsLocationsService struct {
   196  	s *Service
   197  
   198  	Operations *ProjectsLocationsOperationsService
   199  }
   200  
   201  func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
   202  	rs := &ProjectsLocationsOperationsService{s: s}
   203  	return rs
   204  }
   205  
   206  type ProjectsLocationsOperationsService struct {
   207  	s *Service
   208  }
   209  
   210  func NewTextService(s *Service) *TextService {
   211  	rs := &TextService{s: s}
   212  	return rs
   213  }
   214  
   215  type TextService struct {
   216  	s *Service
   217  }
   218  
   219  func NewVoicesService(s *Service) *VoicesService {
   220  	rs := &VoicesService{s: s}
   221  	return rs
   222  }
   223  
   224  type VoicesService struct {
   225  	s *Service
   226  }
   227  
   228  // AudioConfig: Description of audio data to be synthesized.
   229  type AudioConfig struct {
   230  	// AudioEncoding: Required. The format of the audio byte stream.
   231  	//
   232  	// Possible values:
   233  	//   "AUDIO_ENCODING_UNSPECIFIED" - Not specified. Will return result
   234  	// google.rpc.Code.INVALID_ARGUMENT.
   235  	//   "LINEAR16" - Uncompressed 16-bit signed little-endian samples (Linear
   236  	// PCM). Audio content returned as LINEAR16 also contains a WAV header.
   237  	//   "MP3" - MP3 audio at 32kbps.
   238  	//   "OGG_OPUS" - Opus encoded audio wrapped in an ogg container. The result
   239  	// will be a file which can be played natively on Android, and in browsers (at
   240  	// least Chrome and Firefox). The quality of the encoding is considerably
   241  	// higher than MP3 while using approximately the same bitrate.
   242  	//   "MULAW" - 8-bit samples that compand 14-bit audio samples using G.711
   243  	// PCMU/mu-law. Audio content returned as MULAW also contains a WAV header.
   244  	//   "ALAW" - 8-bit samples that compand 14-bit audio samples using G.711
   245  	// PCMU/A-law. Audio content returned as ALAW also contains a WAV header.
   246  	AudioEncoding string `json:"audioEncoding,omitempty"`
   247  	// EffectsProfileId: Optional. Input only. An identifier which selects 'audio
   248  	// effects' profiles that are applied on (post synthesized) text to speech.
   249  	// Effects are applied on top of each other in the order they are given. See
   250  	// audio profiles (https://cloud.google.com/text-to-speech/docs/audio-profiles)
   251  	// for current supported profile ids.
   252  	EffectsProfileId []string `json:"effectsProfileId,omitempty"`
   253  	// Pitch: Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20
   254  	// means increase 20 semitones from the original pitch. -20 means decrease 20
   255  	// semitones from the original pitch.
   256  	Pitch float64 `json:"pitch,omitempty"`
   257  	// SampleRateHertz: Optional. The synthesis sample rate (in hertz) for this
   258  	// audio. When this is specified in SynthesizeSpeechRequest, if this is
   259  	// different from the voice's natural sample rate, then the synthesizer will
   260  	// honor this request by converting to the desired sample rate (which might
   261  	// result in worse audio quality), unless the specified sample rate is not
   262  	// supported for the encoding chosen, in which case it will fail the request
   263  	// and return google.rpc.Code.INVALID_ARGUMENT.
   264  	SampleRateHertz int64 `json:"sampleRateHertz,omitempty"`
   265  	// SpeakingRate: Optional. Input only. Speaking rate/speed, in the range [0.25,
   266  	// 4.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is
   267  	// twice as fast, and 0.5 is half as fast. If unset(0.0), defaults to the
   268  	// native 1.0 speed. Any other values < 0.25 or > 4.0 will return an error.
   269  	SpeakingRate float64 `json:"speakingRate,omitempty"`
   270  	// VolumeGainDb: Optional. Input only. Volume gain (in dB) of the normal native
   271  	// volume supported by the specific voice, in the range [-96.0, 16.0]. If
   272  	// unset, or set to a value of 0.0 (dB), will play at normal native signal
   273  	// amplitude. A value of -6.0 (dB) will play at approximately half the
   274  	// amplitude of the normal native signal amplitude. A value of +6.0 (dB) will
   275  	// play at approximately twice the amplitude of the normal native signal
   276  	// amplitude. Strongly recommend not to exceed +10 (dB) as there's usually no
   277  	// effective increase in loudness for any value greater than that.
   278  	VolumeGainDb float64 `json:"volumeGainDb,omitempty"`
   279  	// ForceSendFields is a list of field names (e.g. "AudioEncoding") to
   280  	// unconditionally include in API requests. By default, fields with empty or
   281  	// default values are omitted from API requests. See
   282  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   283  	// details.
   284  	ForceSendFields []string `json:"-"`
   285  	// NullFields is a list of field names (e.g. "AudioEncoding") to include in API
   286  	// requests with the JSON null value. By default, fields with empty values are
   287  	// omitted from API requests. See
   288  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   289  	NullFields []string `json:"-"`
   290  }
   291  
   292  func (s *AudioConfig) MarshalJSON() ([]byte, error) {
   293  	type NoMethod AudioConfig
   294  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   295  }
   296  
   297  func (s *AudioConfig) UnmarshalJSON(data []byte) error {
   298  	type NoMethod AudioConfig
   299  	var s1 struct {
   300  		Pitch        gensupport.JSONFloat64 `json:"pitch"`
   301  		SpeakingRate gensupport.JSONFloat64 `json:"speakingRate"`
   302  		VolumeGainDb gensupport.JSONFloat64 `json:"volumeGainDb"`
   303  		*NoMethod
   304  	}
   305  	s1.NoMethod = (*NoMethod)(s)
   306  	if err := json.Unmarshal(data, &s1); err != nil {
   307  		return err
   308  	}
   309  	s.Pitch = float64(s1.Pitch)
   310  	s.SpeakingRate = float64(s1.SpeakingRate)
   311  	s.VolumeGainDb = float64(s1.VolumeGainDb)
   312  	return nil
   313  }
   314  
   315  // CancelOperationRequest: The request message for Operations.CancelOperation.
   316  type CancelOperationRequest struct {
   317  }
   318  
   319  // CustomVoiceParams: Description of the custom voice to be synthesized.
   320  type CustomVoiceParams struct {
   321  	// Model: Required. The name of the AutoML model that synthesizes the custom
   322  	// voice.
   323  	Model string `json:"model,omitempty"`
   324  	// ReportedUsage: Optional. Deprecated. The usage of the synthesized audio to
   325  	// be reported.
   326  	//
   327  	// Possible values:
   328  	//   "REPORTED_USAGE_UNSPECIFIED" - Request with reported usage unspecified
   329  	// will be rejected.
   330  	//   "REALTIME" - For scenarios where the synthesized audio is not downloadable
   331  	// and can only be used once. For example, real-time request in IVR system.
   332  	//   "OFFLINE" - For scenarios where the synthesized audio is downloadable and
   333  	// can be reused. For example, the synthesized audio is downloaded, stored in
   334  	// customer service system and played repeatedly.
   335  	ReportedUsage string `json:"reportedUsage,omitempty"`
   336  	// ForceSendFields is a list of field names (e.g. "Model") to unconditionally
   337  	// include in API requests. By default, fields with empty or default values are
   338  	// omitted from API requests. See
   339  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   340  	// details.
   341  	ForceSendFields []string `json:"-"`
   342  	// NullFields is a list of field names (e.g. "Model") to include in API
   343  	// requests with the JSON null value. By default, fields with empty values are
   344  	// omitted from API requests. See
   345  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   346  	NullFields []string `json:"-"`
   347  }
   348  
   349  func (s *CustomVoiceParams) MarshalJSON() ([]byte, error) {
   350  	type NoMethod CustomVoiceParams
   351  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   352  }
   353  
   354  // Empty: A generic empty message that you can re-use to avoid defining
   355  // duplicated empty messages in your APIs. A typical example is to use it as
   356  // the request or the response type of an API method. For instance: service Foo
   357  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   358  type Empty struct {
   359  	// ServerResponse contains the HTTP response code and headers from the server.
   360  	googleapi.ServerResponse `json:"-"`
   361  }
   362  
   363  // GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata: Metadata for response
   364  // returned by the `SynthesizeLongAudio` method.
   365  type GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata struct {
   366  	// LastUpdateTime: Deprecated. Do not use.
   367  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
   368  	// ProgressPercentage: The progress of the most recent processing update in
   369  	// percentage, ie. 70.0%.
   370  	ProgressPercentage float64 `json:"progressPercentage,omitempty"`
   371  	// StartTime: Time when the request was received.
   372  	StartTime string `json:"startTime,omitempty"`
   373  	// ForceSendFields is a list of field names (e.g. "LastUpdateTime") to
   374  	// unconditionally include in API requests. By default, fields with empty or
   375  	// default values are omitted from API requests. See
   376  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   377  	// details.
   378  	ForceSendFields []string `json:"-"`
   379  	// NullFields is a list of field names (e.g. "LastUpdateTime") to include in
   380  	// API requests with the JSON null value. By default, fields with empty values
   381  	// are omitted from API requests. See
   382  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   383  	NullFields []string `json:"-"`
   384  }
   385  
   386  func (s *GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata) MarshalJSON() ([]byte, error) {
   387  	type NoMethod GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata
   388  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   389  }
   390  
   391  func (s *GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata) UnmarshalJSON(data []byte) error {
   392  	type NoMethod GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata
   393  	var s1 struct {
   394  		ProgressPercentage gensupport.JSONFloat64 `json:"progressPercentage"`
   395  		*NoMethod
   396  	}
   397  	s1.NoMethod = (*NoMethod)(s)
   398  	if err := json.Unmarshal(data, &s1); err != nil {
   399  		return err
   400  	}
   401  	s.ProgressPercentage = float64(s1.ProgressPercentage)
   402  	return nil
   403  }
   404  
   405  // ListOperationsResponse: The response message for Operations.ListOperations.
   406  type ListOperationsResponse struct {
   407  	// NextPageToken: The standard List next-page token.
   408  	NextPageToken string `json:"nextPageToken,omitempty"`
   409  	// Operations: A list of operations that matches the specified filter in the
   410  	// request.
   411  	Operations []*Operation `json:"operations,omitempty"`
   412  
   413  	// ServerResponse contains the HTTP response code and headers from the server.
   414  	googleapi.ServerResponse `json:"-"`
   415  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   416  	// unconditionally include in API requests. By default, fields with empty or
   417  	// default values are omitted from API requests. See
   418  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   419  	// details.
   420  	ForceSendFields []string `json:"-"`
   421  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   422  	// requests with the JSON null value. By default, fields with empty values are
   423  	// omitted from API requests. See
   424  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   425  	NullFields []string `json:"-"`
   426  }
   427  
   428  func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
   429  	type NoMethod ListOperationsResponse
   430  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   431  }
   432  
   433  // ListVoicesResponse: The message returned to the client by the `ListVoices`
   434  // method.
   435  type ListVoicesResponse struct {
   436  	// Voices: The list of voices.
   437  	Voices []*Voice `json:"voices,omitempty"`
   438  
   439  	// ServerResponse contains the HTTP response code and headers from the server.
   440  	googleapi.ServerResponse `json:"-"`
   441  	// ForceSendFields is a list of field names (e.g. "Voices") to unconditionally
   442  	// include in API requests. By default, fields with empty or default values are
   443  	// omitted from API requests. See
   444  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   445  	// details.
   446  	ForceSendFields []string `json:"-"`
   447  	// NullFields is a list of field names (e.g. "Voices") to include in API
   448  	// requests with the JSON null value. By default, fields with empty values are
   449  	// omitted from API requests. See
   450  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   451  	NullFields []string `json:"-"`
   452  }
   453  
   454  func (s *ListVoicesResponse) MarshalJSON() ([]byte, error) {
   455  	type NoMethod ListVoicesResponse
   456  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   457  }
   458  
   459  // Operation: This resource represents a long-running operation that is the
   460  // result of a network API call.
   461  type Operation struct {
   462  	// Done: If the value is `false`, it means the operation is still in progress.
   463  	// If `true`, the operation is completed, and either `error` or `response` is
   464  	// available.
   465  	Done bool `json:"done,omitempty"`
   466  	// Error: The error result of the operation in case of failure or cancellation.
   467  	Error *Status `json:"error,omitempty"`
   468  	// Metadata: Service-specific metadata associated with the operation. It
   469  	// typically contains progress information and common metadata such as create
   470  	// time. Some services might not provide such metadata. Any method that returns
   471  	// a long-running operation should document the metadata type, if any.
   472  	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
   473  	// Name: The server-assigned name, which is only unique within the same service
   474  	// that originally returns it. If you use the default HTTP mapping, the `name`
   475  	// should be a resource name ending with `operations/{unique_id}`.
   476  	Name string `json:"name,omitempty"`
   477  	// Response: The normal, successful response of the operation. If the original
   478  	// method returns no data on success, such as `Delete`, the response is
   479  	// `google.protobuf.Empty`. If the original method is standard
   480  	// `Get`/`Create`/`Update`, the response should be the resource. For other
   481  	// methods, the response should have the type `XxxResponse`, where `Xxx` is the
   482  	// original method name. For example, if the original method name is
   483  	// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
   484  	Response googleapi.RawMessage `json:"response,omitempty"`
   485  
   486  	// ServerResponse contains the HTTP response code and headers from the server.
   487  	googleapi.ServerResponse `json:"-"`
   488  	// ForceSendFields is a list of field names (e.g. "Done") to unconditionally
   489  	// include in API requests. By default, fields with empty or default values are
   490  	// omitted from API requests. See
   491  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   492  	// details.
   493  	ForceSendFields []string `json:"-"`
   494  	// NullFields is a list of field names (e.g. "Done") to include in API requests
   495  	// with the JSON null value. By default, fields with empty values are omitted
   496  	// from API requests. See
   497  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   498  	NullFields []string `json:"-"`
   499  }
   500  
   501  func (s *Operation) MarshalJSON() ([]byte, error) {
   502  	type NoMethod Operation
   503  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   504  }
   505  
   506  // Status: The `Status` type defines a logical error model that is suitable for
   507  // different programming environments, including REST APIs and RPC APIs. It is
   508  // used by gRPC (https://github.com/grpc). Each `Status` message contains three
   509  // pieces of data: error code, error message, and error details. You can find
   510  // out more about this error model and how to work with it in the API Design
   511  // Guide (https://cloud.google.com/apis/design/errors).
   512  type Status struct {
   513  	// Code: The status code, which should be an enum value of google.rpc.Code.
   514  	Code int64 `json:"code,omitempty"`
   515  	// Details: A list of messages that carry the error details. There is a common
   516  	// set of message types for APIs to use.
   517  	Details []googleapi.RawMessage `json:"details,omitempty"`
   518  	// Message: A developer-facing error message, which should be in English. Any
   519  	// user-facing error message should be localized and sent in the
   520  	// google.rpc.Status.details field, or localized by the client.
   521  	Message string `json:"message,omitempty"`
   522  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
   523  	// include in API requests. By default, fields with empty or default values are
   524  	// omitted from API requests. See
   525  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   526  	// details.
   527  	ForceSendFields []string `json:"-"`
   528  	// NullFields is a list of field names (e.g. "Code") to include in API requests
   529  	// with the JSON null value. By default, fields with empty values are omitted
   530  	// from API requests. See
   531  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   532  	NullFields []string `json:"-"`
   533  }
   534  
   535  func (s *Status) MarshalJSON() ([]byte, error) {
   536  	type NoMethod Status
   537  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   538  }
   539  
   540  // SynthesisInput: Contains text input to be synthesized. Either `text` or
   541  // `ssml` must be supplied. Supplying both or neither returns
   542  // google.rpc.Code.INVALID_ARGUMENT. The input size is limited to 5000 bytes.
   543  type SynthesisInput struct {
   544  	// Ssml: The SSML document to be synthesized. The SSML document must be valid
   545  	// and well-formed. Otherwise the RPC will fail and return
   546  	// google.rpc.Code.INVALID_ARGUMENT. For more information, see SSML
   547  	// (https://cloud.google.com/text-to-speech/docs/ssml).
   548  	Ssml string `json:"ssml,omitempty"`
   549  	// Text: The raw text to be synthesized.
   550  	Text string `json:"text,omitempty"`
   551  	// ForceSendFields is a list of field names (e.g. "Ssml") to unconditionally
   552  	// include in API requests. By default, fields with empty or default values are
   553  	// omitted from API requests. See
   554  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   555  	// details.
   556  	ForceSendFields []string `json:"-"`
   557  	// NullFields is a list of field names (e.g. "Ssml") to include in API requests
   558  	// with the JSON null value. By default, fields with empty values are omitted
   559  	// from API requests. See
   560  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   561  	NullFields []string `json:"-"`
   562  }
   563  
   564  func (s *SynthesisInput) MarshalJSON() ([]byte, error) {
   565  	type NoMethod SynthesisInput
   566  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   567  }
   568  
   569  // SynthesizeLongAudioMetadata: Metadata for response returned by the
   570  // `SynthesizeLongAudio` method.
   571  type SynthesizeLongAudioMetadata struct {
   572  	// LastUpdateTime: Deprecated. Do not use.
   573  	LastUpdateTime string `json:"lastUpdateTime,omitempty"`
   574  	// ProgressPercentage: The progress of the most recent processing update in
   575  	// percentage, ie. 70.0%.
   576  	ProgressPercentage float64 `json:"progressPercentage,omitempty"`
   577  	// StartTime: Time when the request was received.
   578  	StartTime string `json:"startTime,omitempty"`
   579  	// ForceSendFields is a list of field names (e.g. "LastUpdateTime") to
   580  	// unconditionally include in API requests. By default, fields with empty or
   581  	// default values are omitted from API requests. See
   582  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   583  	// details.
   584  	ForceSendFields []string `json:"-"`
   585  	// NullFields is a list of field names (e.g. "LastUpdateTime") to include in
   586  	// API requests with the JSON null value. By default, fields with empty values
   587  	// are omitted from API requests. See
   588  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   589  	NullFields []string `json:"-"`
   590  }
   591  
   592  func (s *SynthesizeLongAudioMetadata) MarshalJSON() ([]byte, error) {
   593  	type NoMethod SynthesizeLongAudioMetadata
   594  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   595  }
   596  
   597  func (s *SynthesizeLongAudioMetadata) UnmarshalJSON(data []byte) error {
   598  	type NoMethod SynthesizeLongAudioMetadata
   599  	var s1 struct {
   600  		ProgressPercentage gensupport.JSONFloat64 `json:"progressPercentage"`
   601  		*NoMethod
   602  	}
   603  	s1.NoMethod = (*NoMethod)(s)
   604  	if err := json.Unmarshal(data, &s1); err != nil {
   605  		return err
   606  	}
   607  	s.ProgressPercentage = float64(s1.ProgressPercentage)
   608  	return nil
   609  }
   610  
   611  // SynthesizeLongAudioRequest: The top-level message sent by the client for the
   612  // `SynthesizeLongAudio` method.
   613  type SynthesizeLongAudioRequest struct {
   614  	// AudioConfig: Required. The configuration of the synthesized audio.
   615  	AudioConfig *AudioConfig `json:"audioConfig,omitempty"`
   616  	// Input: Required. The Synthesizer requires either plain text or SSML as
   617  	// input. While Long Audio is in preview, SSML is temporarily unsupported.
   618  	Input *SynthesisInput `json:"input,omitempty"`
   619  	// OutputGcsUri: Required. Specifies a Cloud Storage URI for the synthesis
   620  	// results. Must be specified in the format: `gs://bucket_name/object_name`,
   621  	// and the bucket must already exist.
   622  	OutputGcsUri string `json:"outputGcsUri,omitempty"`
   623  	// Voice: Required. The desired voice of the synthesized audio.
   624  	Voice *VoiceSelectionParams `json:"voice,omitempty"`
   625  	// ForceSendFields is a list of field names (e.g. "AudioConfig") to
   626  	// unconditionally include in API requests. By default, fields with empty or
   627  	// default values are omitted from API requests. See
   628  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   629  	// details.
   630  	ForceSendFields []string `json:"-"`
   631  	// NullFields is a list of field names (e.g. "AudioConfig") to include in API
   632  	// requests with the JSON null value. By default, fields with empty values are
   633  	// omitted from API requests. See
   634  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   635  	NullFields []string `json:"-"`
   636  }
   637  
   638  func (s *SynthesizeLongAudioRequest) MarshalJSON() ([]byte, error) {
   639  	type NoMethod SynthesizeLongAudioRequest
   640  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   641  }
   642  
   643  // SynthesizeSpeechRequest: The top-level message sent by the client for the
   644  // `SynthesizeSpeech` method.
   645  type SynthesizeSpeechRequest struct {
   646  	// AudioConfig: Required. The configuration of the synthesized audio.
   647  	AudioConfig *AudioConfig `json:"audioConfig,omitempty"`
   648  	// Input: Required. The Synthesizer requires either plain text or SSML as
   649  	// input.
   650  	Input *SynthesisInput `json:"input,omitempty"`
   651  	// Voice: Required. The desired voice of the synthesized audio.
   652  	Voice *VoiceSelectionParams `json:"voice,omitempty"`
   653  	// ForceSendFields is a list of field names (e.g. "AudioConfig") to
   654  	// unconditionally include in API requests. By default, fields with empty or
   655  	// default values are omitted from API requests. See
   656  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   657  	// details.
   658  	ForceSendFields []string `json:"-"`
   659  	// NullFields is a list of field names (e.g. "AudioConfig") to include in API
   660  	// requests with the JSON null value. By default, fields with empty values are
   661  	// omitted from API requests. See
   662  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   663  	NullFields []string `json:"-"`
   664  }
   665  
   666  func (s *SynthesizeSpeechRequest) MarshalJSON() ([]byte, error) {
   667  	type NoMethod SynthesizeSpeechRequest
   668  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   669  }
   670  
   671  // SynthesizeSpeechResponse: The message returned to the client by the
   672  // `SynthesizeSpeech` method.
   673  type SynthesizeSpeechResponse struct {
   674  	// AudioContent: The audio data bytes encoded as specified in the request,
   675  	// including the header for encodings that are wrapped in containers (e.g. MP3,
   676  	// OGG_OPUS). For LINEAR16 audio, we include the WAV header. Note: as with all
   677  	// bytes fields, protobuffers use a pure binary representation, whereas JSON
   678  	// representations use base64.
   679  	AudioContent string `json:"audioContent,omitempty"`
   680  
   681  	// ServerResponse contains the HTTP response code and headers from the server.
   682  	googleapi.ServerResponse `json:"-"`
   683  	// ForceSendFields is a list of field names (e.g. "AudioContent") to
   684  	// unconditionally include in API requests. By default, fields with empty or
   685  	// default values are omitted from API requests. See
   686  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   687  	// details.
   688  	ForceSendFields []string `json:"-"`
   689  	// NullFields is a list of field names (e.g. "AudioContent") to include in API
   690  	// requests with the JSON null value. By default, fields with empty values are
   691  	// omitted from API requests. See
   692  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   693  	NullFields []string `json:"-"`
   694  }
   695  
   696  func (s *SynthesizeSpeechResponse) MarshalJSON() ([]byte, error) {
   697  	type NoMethod SynthesizeSpeechResponse
   698  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   699  }
   700  
   701  // Voice: Description of a voice supported by the TTS service.
   702  type Voice struct {
   703  	// LanguageCodes: The languages that this voice supports, expressed as BCP-47
   704  	// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. "en-US",
   705  	// "es-419", "cmn-tw").
   706  	LanguageCodes []string `json:"languageCodes,omitempty"`
   707  	// Name: The name of this voice. Each distinct voice has a unique name.
   708  	Name string `json:"name,omitempty"`
   709  	// NaturalSampleRateHertz: The natural sample rate (in hertz) for this voice.
   710  	NaturalSampleRateHertz int64 `json:"naturalSampleRateHertz,omitempty"`
   711  	// SsmlGender: The gender of this voice.
   712  	//
   713  	// Possible values:
   714  	//   "SSML_VOICE_GENDER_UNSPECIFIED" - An unspecified gender. In
   715  	// VoiceSelectionParams, this means that the client doesn't care which gender
   716  	// the selected voice will have. In the Voice field of ListVoicesResponse, this
   717  	// may mean that the voice doesn't fit any of the other categories in this
   718  	// enum, or that the gender of the voice isn't known.
   719  	//   "MALE" - A male voice.
   720  	//   "FEMALE" - A female voice.
   721  	//   "NEUTRAL" - A gender-neutral voice. This voice is not yet supported.
   722  	SsmlGender string `json:"ssmlGender,omitempty"`
   723  	// ForceSendFields is a list of field names (e.g. "LanguageCodes") to
   724  	// unconditionally include in API requests. By default, fields with empty or
   725  	// default values are omitted from API requests. See
   726  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   727  	// details.
   728  	ForceSendFields []string `json:"-"`
   729  	// NullFields is a list of field names (e.g. "LanguageCodes") to include in API
   730  	// requests with the JSON null value. By default, fields with empty values are
   731  	// omitted from API requests. See
   732  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   733  	NullFields []string `json:"-"`
   734  }
   735  
   736  func (s *Voice) MarshalJSON() ([]byte, error) {
   737  	type NoMethod Voice
   738  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   739  }
   740  
   741  // VoiceSelectionParams: Description of which voice to use for a synthesis
   742  // request.
   743  type VoiceSelectionParams struct {
   744  	// CustomVoice: The configuration for a custom voice. If
   745  	// [CustomVoiceParams.model] is set, the service will choose the custom voice
   746  	// matching the specified configuration.
   747  	CustomVoice *CustomVoiceParams `json:"customVoice,omitempty"`
   748  	// LanguageCode: Required. The language (and potentially also the region) of
   749  	// the voice expressed as a BCP-47
   750  	// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. "en-US".
   751  	// This should not include a script tag (e.g. use "cmn-cn" rather than
   752  	// "cmn-Hant-cn"), because the script will be inferred from the input provided
   753  	// in the SynthesisInput. The TTS service will use this parameter to help
   754  	// choose an appropriate voice. Note that the TTS service may choose a voice
   755  	// with a slightly different language code than the one selected; it may
   756  	// substitute a different region (e.g. using en-US rather than en-CA if there
   757  	// isn't a Canadian voice available), or even a different language, e.g. using
   758  	// "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".
   759  	LanguageCode string `json:"languageCode,omitempty"`
   760  	// Name: The name of the voice. If both the name and the gender are not set,
   761  	// the service will choose a voice based on the other parameters such as
   762  	// language_code.
   763  	Name string `json:"name,omitempty"`
   764  	// SsmlGender: The preferred gender of the voice. If not set, the service will
   765  	// choose a voice based on the other parameters such as language_code and name.
   766  	// Note that this is only a preference, not requirement; if a voice of the
   767  	// appropriate gender is not available, the synthesizer should substitute a
   768  	// voice with a different gender rather than failing the request.
   769  	//
   770  	// Possible values:
   771  	//   "SSML_VOICE_GENDER_UNSPECIFIED" - An unspecified gender. In
   772  	// VoiceSelectionParams, this means that the client doesn't care which gender
   773  	// the selected voice will have. In the Voice field of ListVoicesResponse, this
   774  	// may mean that the voice doesn't fit any of the other categories in this
   775  	// enum, or that the gender of the voice isn't known.
   776  	//   "MALE" - A male voice.
   777  	//   "FEMALE" - A female voice.
   778  	//   "NEUTRAL" - A gender-neutral voice. This voice is not yet supported.
   779  	SsmlGender string `json:"ssmlGender,omitempty"`
   780  	// ForceSendFields is a list of field names (e.g. "CustomVoice") to
   781  	// unconditionally include in API requests. By default, fields with empty or
   782  	// default values are omitted from API requests. See
   783  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   784  	// details.
   785  	ForceSendFields []string `json:"-"`
   786  	// NullFields is a list of field names (e.g. "CustomVoice") to include in API
   787  	// requests with the JSON null value. By default, fields with empty values are
   788  	// omitted from API requests. See
   789  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   790  	NullFields []string `json:"-"`
   791  }
   792  
   793  func (s *VoiceSelectionParams) MarshalJSON() ([]byte, error) {
   794  	type NoMethod VoiceSelectionParams
   795  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   796  }
   797  
   798  type OperationsCancelCall struct {
   799  	s                      *Service
   800  	name                   string
   801  	canceloperationrequest *CancelOperationRequest
   802  	urlParams_             gensupport.URLParams
   803  	ctx_                   context.Context
   804  	header_                http.Header
   805  }
   806  
   807  // Cancel: Starts asynchronous cancellation on a long-running operation. The
   808  // server makes a best effort to cancel the operation, but success is not
   809  // guaranteed. If the server doesn't support this method, it returns
   810  // `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
   811  // other methods to check whether the cancellation succeeded or whether the
   812  // operation completed despite cancellation. On successful cancellation, the
   813  // operation is not deleted; instead, it becomes an operation with an
   814  // Operation.error value with a google.rpc.Status.code of 1, corresponding to
   815  // `Code.CANCELLED`.
   816  //
   817  // - name: The name of the operation resource to be cancelled.
   818  func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
   819  	c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   820  	c.name = name
   821  	c.canceloperationrequest = canceloperationrequest
   822  	return c
   823  }
   824  
   825  // Fields allows partial responses to be retrieved. See
   826  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   827  // details.
   828  func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
   829  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   830  	return c
   831  }
   832  
   833  // Context sets the context to be used in this call's Do method.
   834  func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
   835  	c.ctx_ = ctx
   836  	return c
   837  }
   838  
   839  // Header returns a http.Header that can be modified by the caller to add
   840  // headers to the request.
   841  func (c *OperationsCancelCall) Header() http.Header {
   842  	if c.header_ == nil {
   843  		c.header_ = make(http.Header)
   844  	}
   845  	return c.header_
   846  }
   847  
   848  func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
   849  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   850  	var body io.Reader = nil
   851  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
   852  	if err != nil {
   853  		return nil, err
   854  	}
   855  	c.urlParams_.Set("alt", alt)
   856  	c.urlParams_.Set("prettyPrint", "false")
   857  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
   858  	urls += "?" + c.urlParams_.Encode()
   859  	req, err := http.NewRequest("POST", urls, body)
   860  	if err != nil {
   861  		return nil, err
   862  	}
   863  	req.Header = reqHeaders
   864  	googleapi.Expand(req.URL, map[string]string{
   865  		"name": c.name,
   866  	})
   867  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   868  }
   869  
   870  // Do executes the "texttospeech.operations.cancel" call.
   871  // Any non-2xx status code is an error. Response headers are in either
   872  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   873  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   874  // whether the returned error was because http.StatusNotModified was returned.
   875  func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   876  	gensupport.SetOptions(c.urlParams_, opts...)
   877  	res, err := c.doRequest("json")
   878  	if res != nil && res.StatusCode == http.StatusNotModified {
   879  		if res.Body != nil {
   880  			res.Body.Close()
   881  		}
   882  		return nil, gensupport.WrapError(&googleapi.Error{
   883  			Code:   res.StatusCode,
   884  			Header: res.Header,
   885  		})
   886  	}
   887  	if err != nil {
   888  		return nil, err
   889  	}
   890  	defer googleapi.CloseBody(res)
   891  	if err := googleapi.CheckResponse(res); err != nil {
   892  		return nil, gensupport.WrapError(err)
   893  	}
   894  	ret := &Empty{
   895  		ServerResponse: googleapi.ServerResponse{
   896  			Header:         res.Header,
   897  			HTTPStatusCode: res.StatusCode,
   898  		},
   899  	}
   900  	target := &ret
   901  	if err := gensupport.DecodeResponse(target, res); err != nil {
   902  		return nil, err
   903  	}
   904  	return ret, nil
   905  }
   906  
   907  type OperationsDeleteCall struct {
   908  	s          *Service
   909  	name       string
   910  	urlParams_ gensupport.URLParams
   911  	ctx_       context.Context
   912  	header_    http.Header
   913  }
   914  
   915  // Delete: Deletes a long-running operation. This method indicates that the
   916  // client is no longer interested in the operation result. It does not cancel
   917  // the operation. If the server doesn't support this method, it returns
   918  // `google.rpc.Code.UNIMPLEMENTED`.
   919  //
   920  // - name: The name of the operation resource to be deleted.
   921  func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
   922  	c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   923  	c.name = name
   924  	return c
   925  }
   926  
   927  // Fields allows partial responses to be retrieved. See
   928  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   929  // details.
   930  func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
   931  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   932  	return c
   933  }
   934  
   935  // Context sets the context to be used in this call's Do method.
   936  func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
   937  	c.ctx_ = ctx
   938  	return c
   939  }
   940  
   941  // Header returns a http.Header that can be modified by the caller to add
   942  // headers to the request.
   943  func (c *OperationsDeleteCall) Header() http.Header {
   944  	if c.header_ == nil {
   945  		c.header_ = make(http.Header)
   946  	}
   947  	return c.header_
   948  }
   949  
   950  func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
   951  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   952  	var body io.Reader = nil
   953  	c.urlParams_.Set("alt", alt)
   954  	c.urlParams_.Set("prettyPrint", "false")
   955  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   956  	urls += "?" + c.urlParams_.Encode()
   957  	req, err := http.NewRequest("DELETE", urls, body)
   958  	if err != nil {
   959  		return nil, err
   960  	}
   961  	req.Header = reqHeaders
   962  	googleapi.Expand(req.URL, map[string]string{
   963  		"name": c.name,
   964  	})
   965  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   966  }
   967  
   968  // Do executes the "texttospeech.operations.delete" call.
   969  // Any non-2xx status code is an error. Response headers are in either
   970  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   971  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   972  // whether the returned error was because http.StatusNotModified was returned.
   973  func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   974  	gensupport.SetOptions(c.urlParams_, opts...)
   975  	res, err := c.doRequest("json")
   976  	if res != nil && res.StatusCode == http.StatusNotModified {
   977  		if res.Body != nil {
   978  			res.Body.Close()
   979  		}
   980  		return nil, gensupport.WrapError(&googleapi.Error{
   981  			Code:   res.StatusCode,
   982  			Header: res.Header,
   983  		})
   984  	}
   985  	if err != nil {
   986  		return nil, err
   987  	}
   988  	defer googleapi.CloseBody(res)
   989  	if err := googleapi.CheckResponse(res); err != nil {
   990  		return nil, gensupport.WrapError(err)
   991  	}
   992  	ret := &Empty{
   993  		ServerResponse: googleapi.ServerResponse{
   994  			Header:         res.Header,
   995  			HTTPStatusCode: res.StatusCode,
   996  		},
   997  	}
   998  	target := &ret
   999  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1000  		return nil, err
  1001  	}
  1002  	return ret, nil
  1003  }
  1004  
  1005  type ProjectsLocationsSynthesizeLongAudioCall struct {
  1006  	s                          *Service
  1007  	parent                     string
  1008  	synthesizelongaudiorequest *SynthesizeLongAudioRequest
  1009  	urlParams_                 gensupport.URLParams
  1010  	ctx_                       context.Context
  1011  	header_                    http.Header
  1012  }
  1013  
  1014  // SynthesizeLongAudio: Synthesizes long form text asynchronously.
  1015  //
  1016  //   - parent: The resource states of the request in the form of
  1017  //     `projects/*/locations/*`.
  1018  func (r *ProjectsLocationsService) SynthesizeLongAudio(parent string, synthesizelongaudiorequest *SynthesizeLongAudioRequest) *ProjectsLocationsSynthesizeLongAudioCall {
  1019  	c := &ProjectsLocationsSynthesizeLongAudioCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1020  	c.parent = parent
  1021  	c.synthesizelongaudiorequest = synthesizelongaudiorequest
  1022  	return c
  1023  }
  1024  
  1025  // Fields allows partial responses to be retrieved. See
  1026  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1027  // details.
  1028  func (c *ProjectsLocationsSynthesizeLongAudioCall) Fields(s ...googleapi.Field) *ProjectsLocationsSynthesizeLongAudioCall {
  1029  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1030  	return c
  1031  }
  1032  
  1033  // Context sets the context to be used in this call's Do method.
  1034  func (c *ProjectsLocationsSynthesizeLongAudioCall) Context(ctx context.Context) *ProjectsLocationsSynthesizeLongAudioCall {
  1035  	c.ctx_ = ctx
  1036  	return c
  1037  }
  1038  
  1039  // Header returns a http.Header that can be modified by the caller to add
  1040  // headers to the request.
  1041  func (c *ProjectsLocationsSynthesizeLongAudioCall) Header() http.Header {
  1042  	if c.header_ == nil {
  1043  		c.header_ = make(http.Header)
  1044  	}
  1045  	return c.header_
  1046  }
  1047  
  1048  func (c *ProjectsLocationsSynthesizeLongAudioCall) doRequest(alt string) (*http.Response, error) {
  1049  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1050  	var body io.Reader = nil
  1051  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.synthesizelongaudiorequest)
  1052  	if err != nil {
  1053  		return nil, err
  1054  	}
  1055  	c.urlParams_.Set("alt", alt)
  1056  	c.urlParams_.Set("prettyPrint", "false")
  1057  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:synthesizeLongAudio")
  1058  	urls += "?" + c.urlParams_.Encode()
  1059  	req, err := http.NewRequest("POST", urls, body)
  1060  	if err != nil {
  1061  		return nil, err
  1062  	}
  1063  	req.Header = reqHeaders
  1064  	googleapi.Expand(req.URL, map[string]string{
  1065  		"parent": c.parent,
  1066  	})
  1067  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1068  }
  1069  
  1070  // Do executes the "texttospeech.projects.locations.synthesizeLongAudio" call.
  1071  // Any non-2xx status code is an error. Response headers are in either
  1072  // *Operation.ServerResponse.Header or (if a response was returned at all) in
  1073  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1074  // whether the returned error was because http.StatusNotModified was returned.
  1075  func (c *ProjectsLocationsSynthesizeLongAudioCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1076  	gensupport.SetOptions(c.urlParams_, opts...)
  1077  	res, err := c.doRequest("json")
  1078  	if res != nil && res.StatusCode == http.StatusNotModified {
  1079  		if res.Body != nil {
  1080  			res.Body.Close()
  1081  		}
  1082  		return nil, gensupport.WrapError(&googleapi.Error{
  1083  			Code:   res.StatusCode,
  1084  			Header: res.Header,
  1085  		})
  1086  	}
  1087  	if err != nil {
  1088  		return nil, err
  1089  	}
  1090  	defer googleapi.CloseBody(res)
  1091  	if err := googleapi.CheckResponse(res); err != nil {
  1092  		return nil, gensupport.WrapError(err)
  1093  	}
  1094  	ret := &Operation{
  1095  		ServerResponse: googleapi.ServerResponse{
  1096  			Header:         res.Header,
  1097  			HTTPStatusCode: res.StatusCode,
  1098  		},
  1099  	}
  1100  	target := &ret
  1101  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1102  		return nil, err
  1103  	}
  1104  	return ret, nil
  1105  }
  1106  
  1107  type ProjectsLocationsOperationsGetCall struct {
  1108  	s            *Service
  1109  	name         string
  1110  	urlParams_   gensupport.URLParams
  1111  	ifNoneMatch_ string
  1112  	ctx_         context.Context
  1113  	header_      http.Header
  1114  }
  1115  
  1116  // Get: Gets the latest state of a long-running operation. Clients can use this
  1117  // method to poll the operation result at intervals as recommended by the API
  1118  // service.
  1119  //
  1120  // - name: The name of the operation resource.
  1121  func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
  1122  	c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1123  	c.name = name
  1124  	return c
  1125  }
  1126  
  1127  // Fields allows partial responses to be retrieved. See
  1128  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1129  // details.
  1130  func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
  1131  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1132  	return c
  1133  }
  1134  
  1135  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1136  // object's ETag matches the given value. This is useful for getting updates
  1137  // only after the object has changed since the last request.
  1138  func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
  1139  	c.ifNoneMatch_ = entityTag
  1140  	return c
  1141  }
  1142  
  1143  // Context sets the context to be used in this call's Do method.
  1144  func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
  1145  	c.ctx_ = ctx
  1146  	return c
  1147  }
  1148  
  1149  // Header returns a http.Header that can be modified by the caller to add
  1150  // headers to the request.
  1151  func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
  1152  	if c.header_ == nil {
  1153  		c.header_ = make(http.Header)
  1154  	}
  1155  	return c.header_
  1156  }
  1157  
  1158  func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1159  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1160  	if c.ifNoneMatch_ != "" {
  1161  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1162  	}
  1163  	var body io.Reader = nil
  1164  	c.urlParams_.Set("alt", alt)
  1165  	c.urlParams_.Set("prettyPrint", "false")
  1166  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1167  	urls += "?" + c.urlParams_.Encode()
  1168  	req, err := http.NewRequest("GET", urls, body)
  1169  	if err != nil {
  1170  		return nil, err
  1171  	}
  1172  	req.Header = reqHeaders
  1173  	googleapi.Expand(req.URL, map[string]string{
  1174  		"name": c.name,
  1175  	})
  1176  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1177  }
  1178  
  1179  // Do executes the "texttospeech.projects.locations.operations.get" call.
  1180  // Any non-2xx status code is an error. Response headers are in either
  1181  // *Operation.ServerResponse.Header or (if a response was returned at all) in
  1182  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1183  // whether the returned error was because http.StatusNotModified was returned.
  1184  func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1185  	gensupport.SetOptions(c.urlParams_, opts...)
  1186  	res, err := c.doRequest("json")
  1187  	if res != nil && res.StatusCode == http.StatusNotModified {
  1188  		if res.Body != nil {
  1189  			res.Body.Close()
  1190  		}
  1191  		return nil, gensupport.WrapError(&googleapi.Error{
  1192  			Code:   res.StatusCode,
  1193  			Header: res.Header,
  1194  		})
  1195  	}
  1196  	if err != nil {
  1197  		return nil, err
  1198  	}
  1199  	defer googleapi.CloseBody(res)
  1200  	if err := googleapi.CheckResponse(res); err != nil {
  1201  		return nil, gensupport.WrapError(err)
  1202  	}
  1203  	ret := &Operation{
  1204  		ServerResponse: googleapi.ServerResponse{
  1205  			Header:         res.Header,
  1206  			HTTPStatusCode: res.StatusCode,
  1207  		},
  1208  	}
  1209  	target := &ret
  1210  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1211  		return nil, err
  1212  	}
  1213  	return ret, nil
  1214  }
  1215  
  1216  type ProjectsLocationsOperationsListCall struct {
  1217  	s            *Service
  1218  	name         string
  1219  	urlParams_   gensupport.URLParams
  1220  	ifNoneMatch_ string
  1221  	ctx_         context.Context
  1222  	header_      http.Header
  1223  }
  1224  
  1225  // List: Lists operations that match the specified filter in the request. If
  1226  // the server doesn't support this method, it returns `UNIMPLEMENTED`.
  1227  //
  1228  // - name: The name of the operation's parent resource.
  1229  func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
  1230  	c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1231  	c.name = name
  1232  	return c
  1233  }
  1234  
  1235  // Filter sets the optional parameter "filter": The standard list filter.
  1236  func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
  1237  	c.urlParams_.Set("filter", filter)
  1238  	return c
  1239  }
  1240  
  1241  // PageSize sets the optional parameter "pageSize": The standard list page
  1242  // size.
  1243  func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
  1244  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1245  	return c
  1246  }
  1247  
  1248  // PageToken sets the optional parameter "pageToken": The standard list page
  1249  // token.
  1250  func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
  1251  	c.urlParams_.Set("pageToken", pageToken)
  1252  	return c
  1253  }
  1254  
  1255  // Fields allows partial responses to be retrieved. See
  1256  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1257  // details.
  1258  func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
  1259  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1260  	return c
  1261  }
  1262  
  1263  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1264  // object's ETag matches the given value. This is useful for getting updates
  1265  // only after the object has changed since the last request.
  1266  func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
  1267  	c.ifNoneMatch_ = entityTag
  1268  	return c
  1269  }
  1270  
  1271  // Context sets the context to be used in this call's Do method.
  1272  func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
  1273  	c.ctx_ = ctx
  1274  	return c
  1275  }
  1276  
  1277  // Header returns a http.Header that can be modified by the caller to add
  1278  // headers to the request.
  1279  func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
  1280  	if c.header_ == nil {
  1281  		c.header_ = make(http.Header)
  1282  	}
  1283  	return c.header_
  1284  }
  1285  
  1286  func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
  1287  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1288  	if c.ifNoneMatch_ != "" {
  1289  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1290  	}
  1291  	var body io.Reader = nil
  1292  	c.urlParams_.Set("alt", alt)
  1293  	c.urlParams_.Set("prettyPrint", "false")
  1294  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
  1295  	urls += "?" + c.urlParams_.Encode()
  1296  	req, err := http.NewRequest("GET", urls, body)
  1297  	if err != nil {
  1298  		return nil, err
  1299  	}
  1300  	req.Header = reqHeaders
  1301  	googleapi.Expand(req.URL, map[string]string{
  1302  		"name": c.name,
  1303  	})
  1304  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1305  }
  1306  
  1307  // Do executes the "texttospeech.projects.locations.operations.list" call.
  1308  // Any non-2xx status code is an error. Response headers are in either
  1309  // *ListOperationsResponse.ServerResponse.Header or (if a response was returned
  1310  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1311  // check whether the returned error was because http.StatusNotModified was
  1312  // returned.
  1313  func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  1314  	gensupport.SetOptions(c.urlParams_, opts...)
  1315  	res, err := c.doRequest("json")
  1316  	if res != nil && res.StatusCode == http.StatusNotModified {
  1317  		if res.Body != nil {
  1318  			res.Body.Close()
  1319  		}
  1320  		return nil, gensupport.WrapError(&googleapi.Error{
  1321  			Code:   res.StatusCode,
  1322  			Header: res.Header,
  1323  		})
  1324  	}
  1325  	if err != nil {
  1326  		return nil, err
  1327  	}
  1328  	defer googleapi.CloseBody(res)
  1329  	if err := googleapi.CheckResponse(res); err != nil {
  1330  		return nil, gensupport.WrapError(err)
  1331  	}
  1332  	ret := &ListOperationsResponse{
  1333  		ServerResponse: googleapi.ServerResponse{
  1334  			Header:         res.Header,
  1335  			HTTPStatusCode: res.StatusCode,
  1336  		},
  1337  	}
  1338  	target := &ret
  1339  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1340  		return nil, err
  1341  	}
  1342  	return ret, nil
  1343  }
  1344  
  1345  // Pages invokes f for each page of results.
  1346  // A non-nil error returned from f will halt the iteration.
  1347  // The provided context supersedes any context provided to the Context method.
  1348  func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  1349  	c.ctx_ = ctx
  1350  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1351  	for {
  1352  		x, err := c.Do()
  1353  		if err != nil {
  1354  			return err
  1355  		}
  1356  		if err := f(x); err != nil {
  1357  			return err
  1358  		}
  1359  		if x.NextPageToken == "" {
  1360  			return nil
  1361  		}
  1362  		c.PageToken(x.NextPageToken)
  1363  	}
  1364  }
  1365  
  1366  type TextSynthesizeCall struct {
  1367  	s                       *Service
  1368  	synthesizespeechrequest *SynthesizeSpeechRequest
  1369  	urlParams_              gensupport.URLParams
  1370  	ctx_                    context.Context
  1371  	header_                 http.Header
  1372  }
  1373  
  1374  // Synthesize: Synthesizes speech synchronously: receive results after all text
  1375  // input has been processed.
  1376  func (r *TextService) Synthesize(synthesizespeechrequest *SynthesizeSpeechRequest) *TextSynthesizeCall {
  1377  	c := &TextSynthesizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1378  	c.synthesizespeechrequest = synthesizespeechrequest
  1379  	return c
  1380  }
  1381  
  1382  // Fields allows partial responses to be retrieved. See
  1383  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1384  // details.
  1385  func (c *TextSynthesizeCall) Fields(s ...googleapi.Field) *TextSynthesizeCall {
  1386  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1387  	return c
  1388  }
  1389  
  1390  // Context sets the context to be used in this call's Do method.
  1391  func (c *TextSynthesizeCall) Context(ctx context.Context) *TextSynthesizeCall {
  1392  	c.ctx_ = ctx
  1393  	return c
  1394  }
  1395  
  1396  // Header returns a http.Header that can be modified by the caller to add
  1397  // headers to the request.
  1398  func (c *TextSynthesizeCall) Header() http.Header {
  1399  	if c.header_ == nil {
  1400  		c.header_ = make(http.Header)
  1401  	}
  1402  	return c.header_
  1403  }
  1404  
  1405  func (c *TextSynthesizeCall) doRequest(alt string) (*http.Response, error) {
  1406  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1407  	var body io.Reader = nil
  1408  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.synthesizespeechrequest)
  1409  	if err != nil {
  1410  		return nil, err
  1411  	}
  1412  	c.urlParams_.Set("alt", alt)
  1413  	c.urlParams_.Set("prettyPrint", "false")
  1414  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/text:synthesize")
  1415  	urls += "?" + c.urlParams_.Encode()
  1416  	req, err := http.NewRequest("POST", urls, body)
  1417  	if err != nil {
  1418  		return nil, err
  1419  	}
  1420  	req.Header = reqHeaders
  1421  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1422  }
  1423  
  1424  // Do executes the "texttospeech.text.synthesize" call.
  1425  // Any non-2xx status code is an error. Response headers are in either
  1426  // *SynthesizeSpeechResponse.ServerResponse.Header or (if a response was
  1427  // returned at all) in error.(*googleapi.Error).Header. Use
  1428  // googleapi.IsNotModified to check whether the returned error was because
  1429  // http.StatusNotModified was returned.
  1430  func (c *TextSynthesizeCall) Do(opts ...googleapi.CallOption) (*SynthesizeSpeechResponse, error) {
  1431  	gensupport.SetOptions(c.urlParams_, opts...)
  1432  	res, err := c.doRequest("json")
  1433  	if res != nil && res.StatusCode == http.StatusNotModified {
  1434  		if res.Body != nil {
  1435  			res.Body.Close()
  1436  		}
  1437  		return nil, gensupport.WrapError(&googleapi.Error{
  1438  			Code:   res.StatusCode,
  1439  			Header: res.Header,
  1440  		})
  1441  	}
  1442  	if err != nil {
  1443  		return nil, err
  1444  	}
  1445  	defer googleapi.CloseBody(res)
  1446  	if err := googleapi.CheckResponse(res); err != nil {
  1447  		return nil, gensupport.WrapError(err)
  1448  	}
  1449  	ret := &SynthesizeSpeechResponse{
  1450  		ServerResponse: googleapi.ServerResponse{
  1451  			Header:         res.Header,
  1452  			HTTPStatusCode: res.StatusCode,
  1453  		},
  1454  	}
  1455  	target := &ret
  1456  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1457  		return nil, err
  1458  	}
  1459  	return ret, nil
  1460  }
  1461  
  1462  type VoicesListCall struct {
  1463  	s            *Service
  1464  	urlParams_   gensupport.URLParams
  1465  	ifNoneMatch_ string
  1466  	ctx_         context.Context
  1467  	header_      http.Header
  1468  }
  1469  
  1470  // List: Returns a list of Voice supported for synthesis.
  1471  func (r *VoicesService) List() *VoicesListCall {
  1472  	c := &VoicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1473  	return c
  1474  }
  1475  
  1476  // LanguageCode sets the optional parameter "languageCode": Recommended. BCP-47
  1477  // (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not
  1478  // specified, the API will return all supported voices. If specified, the
  1479  // ListVoices call will only return voices that can be used to synthesize this
  1480  // language_code. For example, if you specify "en-NZ", all "en-NZ" voices
  1481  // will be returned. If you specify "no", both "no-\*" (Norwegian) and
  1482  // "nb-\*" (Norwegian Bokmal) voices will be returned.
  1483  func (c *VoicesListCall) LanguageCode(languageCode string) *VoicesListCall {
  1484  	c.urlParams_.Set("languageCode", languageCode)
  1485  	return c
  1486  }
  1487  
  1488  // Fields allows partial responses to be retrieved. See
  1489  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1490  // details.
  1491  func (c *VoicesListCall) Fields(s ...googleapi.Field) *VoicesListCall {
  1492  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1493  	return c
  1494  }
  1495  
  1496  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1497  // object's ETag matches the given value. This is useful for getting updates
  1498  // only after the object has changed since the last request.
  1499  func (c *VoicesListCall) IfNoneMatch(entityTag string) *VoicesListCall {
  1500  	c.ifNoneMatch_ = entityTag
  1501  	return c
  1502  }
  1503  
  1504  // Context sets the context to be used in this call's Do method.
  1505  func (c *VoicesListCall) Context(ctx context.Context) *VoicesListCall {
  1506  	c.ctx_ = ctx
  1507  	return c
  1508  }
  1509  
  1510  // Header returns a http.Header that can be modified by the caller to add
  1511  // headers to the request.
  1512  func (c *VoicesListCall) Header() http.Header {
  1513  	if c.header_ == nil {
  1514  		c.header_ = make(http.Header)
  1515  	}
  1516  	return c.header_
  1517  }
  1518  
  1519  func (c *VoicesListCall) doRequest(alt string) (*http.Response, error) {
  1520  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1521  	if c.ifNoneMatch_ != "" {
  1522  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1523  	}
  1524  	var body io.Reader = nil
  1525  	c.urlParams_.Set("alt", alt)
  1526  	c.urlParams_.Set("prettyPrint", "false")
  1527  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/voices")
  1528  	urls += "?" + c.urlParams_.Encode()
  1529  	req, err := http.NewRequest("GET", urls, body)
  1530  	if err != nil {
  1531  		return nil, err
  1532  	}
  1533  	req.Header = reqHeaders
  1534  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1535  }
  1536  
  1537  // Do executes the "texttospeech.voices.list" call.
  1538  // Any non-2xx status code is an error. Response headers are in either
  1539  // *ListVoicesResponse.ServerResponse.Header or (if a response was returned at
  1540  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1541  // check whether the returned error was because http.StatusNotModified was
  1542  // returned.
  1543  func (c *VoicesListCall) Do(opts ...googleapi.CallOption) (*ListVoicesResponse, error) {
  1544  	gensupport.SetOptions(c.urlParams_, opts...)
  1545  	res, err := c.doRequest("json")
  1546  	if res != nil && res.StatusCode == http.StatusNotModified {
  1547  		if res.Body != nil {
  1548  			res.Body.Close()
  1549  		}
  1550  		return nil, gensupport.WrapError(&googleapi.Error{
  1551  			Code:   res.StatusCode,
  1552  			Header: res.Header,
  1553  		})
  1554  	}
  1555  	if err != nil {
  1556  		return nil, err
  1557  	}
  1558  	defer googleapi.CloseBody(res)
  1559  	if err := googleapi.CheckResponse(res); err != nil {
  1560  		return nil, gensupport.WrapError(err)
  1561  	}
  1562  	ret := &ListVoicesResponse{
  1563  		ServerResponse: googleapi.ServerResponse{
  1564  			Header:         res.Header,
  1565  			HTTPStatusCode: res.StatusCode,
  1566  		},
  1567  	}
  1568  	target := &ret
  1569  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1570  		return nil, err
  1571  	}
  1572  	return ret, nil
  1573  }
  1574  

View as plain text