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