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