...

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

Documentation: google.golang.org/api/texttospeech/v1beta1

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

View as plain text