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