The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      JSON parse error: Missing a closing quotation mark in string. in row 899
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1757)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
                  for _, table in generator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 899
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
import React from 'react' import Header from './header' function About() { return ( <div> <Header title="关于我" introduction="This is what i do" /> <div className="container"> <div className="row"> <div className="col-lg-8 offset-lg-2 col-md-10 offset-md-1"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum molestiae debitis nobis, quod sapiente qui voluptatum, placeat magni repudiandae accusantium fugit quas labore non rerum possimus, corrupti enim modi! Et.</p> </div> </div> </div> </div> ) } export default About
{ "content_hash": "fe9266913c86500ca2c4011e2e0ed46a", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 257, "avg_line_length": 50.36363636363637, "alnum_prop": 0.703971119133574, "repo_name": "dadiaoguai/blog-react-demo-front", "id": "c02ae77030635d870de746c88b1d74cf25ad2987", "size": "1114", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/components/front/about.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "170878" }, { "name": "HTML", "bytes": "846" }, { "name": "JavaScript", "bytes": "96884" } ] }
using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Http.Description; using TimeTrackingAPI.Models; namespace TimeTrackingAPI.Controllers { public class ScheduleController : ApiController { private TimeTrackingEntities db = new TimeTrackingEntities(); // GET api/Schedule public IQueryable<Schedule> GetSchedules() { return db.Schedules; } // GET api/Schedule/5 [ResponseType(typeof(Schedule))] public IHttpActionResult GetSchedule(int id) { Schedule schedule = db.Schedules.Find(id); if (schedule == null) { return NotFound(); } return Ok(schedule); } // PUT api/Schedule/5 public IHttpActionResult PutSchedule(int id, Schedule schedule) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != schedule.fldScheduleId) { return BadRequest(); } db.Entry(schedule).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ScheduleExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); } // POST api/Schedule [ResponseType(typeof(Schedule))] public IHttpActionResult PostSchedule(Schedule schedule) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Schedules.Add(schedule); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = schedule.fldScheduleId }, schedule); } // DELETE api/Schedule/5 [ResponseType(typeof(Schedule))] public IHttpActionResult DeleteSchedule(int id) { Schedule schedule = db.Schedules.Find(id); if (schedule == null) { return NotFound(); } db.Schedules.Remove(schedule); db.SaveChanges(); return Ok(schedule); } protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); } private bool ScheduleExists(int id) { return db.Schedules.Count(e => e.fldScheduleId == id) > 0; } } }
{ "content_hash": "a38603aa9b1c7ffecff6a239fd893d68", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 95, "avg_line_length": 26.017094017094017, "alnum_prop": 0.4914586070959264, "repo_name": "SiyiStephanieYao/Task-Time-Manager", "id": "a49a2d922c949c0f4562c3b6e778b64673aceb94", "size": "3046", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "TimeTrackingAPI/Controllers/ScheduleController.cs", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "110" }, { "name": "C#", "bytes": "108196" }, { "name": "CSS", "bytes": "801126" }, { "name": "JavaScript", "bytes": "2396455" } ] }
using System; using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network { /// <summary> Creates or updates the specified Azure Firewall. </summary> public partial class AzureFirewallsCreateOrUpdateOperation : Operation<AzureFirewall>, IOperationSource<AzureFirewall> { private readonly ArmOperationHelpers<AzureFirewall> _operation; /// <summary> Initializes a new instance of AzureFirewallsCreateOrUpdateOperation for mocking. </summary> protected AzureFirewallsCreateOrUpdateOperation() { } internal AzureFirewallsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new ArmOperationHelpers<AzureFirewall>(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.AzureAsyncOperation, "AzureFirewallsCreateOrUpdateOperation"); } /// <inheritdoc /> public override string Id => _operation.Id; /// <inheritdoc /> public override AzureFirewall Value => _operation.Value; /// <inheritdoc /> public override bool HasCompleted => _operation.HasCompleted; /// <inheritdoc /> public override bool HasValue => _operation.HasValue; /// <inheritdoc /> public override Response GetRawResponse() => _operation.GetRawResponse(); /// <inheritdoc /> public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); /// <inheritdoc /> public override ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// <inheritdoc /> public override ValueTask<Response<AzureFirewall>> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// <inheritdoc /> public override ValueTask<Response<AzureFirewall>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); AzureFirewall IOperationSource<AzureFirewall>.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); return AzureFirewall.DeserializeAzureFirewall(document.RootElement); } async ValueTask<AzureFirewall> IOperationSource<AzureFirewall>.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); return AzureFirewall.DeserializeAzureFirewall(document.RootElement); } } }
{ "content_hash": "07002af5760c3aa045c825a85980d94b", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 228, "avg_line_length": 47.353846153846156, "alnum_prop": 0.7361923326835608, "repo_name": "jackmagic313/azure-sdk-for-net", "id": "f5054afeb477f0b17e60b3b15ba37686e55b89f3", "size": "3216", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallsCreateOrUpdateOperation.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "15958" }, { "name": "C#", "bytes": "175000108" }, { "name": "CSS", "bytes": "5585" }, { "name": "HTML", "bytes": "225966" }, { "name": "JavaScript", "bytes": "13014" }, { "name": "PowerShell", "bytes": "201417" }, { "name": "Shell", "bytes": "13061" }, { "name": "Smarty", "bytes": "11127" }, { "name": "TypeScript", "bytes": "141835" } ] }
define('getSpreadsheetFromFile', ['papaparse', 'xlsx' ], function (Papa, xlsx, __createReactClass) { return (f, callback) => { if (! f) return callback(null, null); if (! (window.File && window.FileReader && window.FileList && window.Blob)) return callback(null, null); if (f.name.match(/\.csv$/i)) { Papa.parse(f, { error: (err) => { console.log("Error parsing CSV file", err); }, complete: (results) => { let data = results.data; // The parser we're using will yield [""] as the last // line if the file ends with a newline. Remove all // such empty rows from end of file. let i; for (i = data.length-1; i >= 0 && (data[i].length == 1 && data[i][0] == ""); --i) ; data.length = i + 1; callback(null, { Sheet1: data }); } }); } else if (f.name.match(/\.xlsx$/i)) { let reader = new FileReader(); reader.readAsArrayBuffer(f); reader.onerror = callback; reader.onloadend = () => { let bstr = arrayBufferToBString(reader.result); let workbook = xlsx.read(bstr, { type: 'binary' }); callback(null, excelWorkbookToJson(workbook)) }; } else { return callback(new Error("Spreadsheet file \u2018" + f.name + "\u2019 has unrecognized extension")); } } });
{ "content_hash": "b8be4348a71d48deab3458ba0429a366", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 113, "avg_line_length": 40.4390243902439, "alnum_prop": 0.45476477683956573, "repo_name": "addrummond/nodeibexfarm", "id": "98fdd6123d078325604826660ce7ea77dd78d2f9", "size": "1658", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "prepublic/javascripts/getSpreadsheetFromFile.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "25036" }, { "name": "Dockerfile", "bytes": "3381" }, { "name": "HTML", "bytes": "5120" }, { "name": "JavaScript", "bytes": "1480632" }, { "name": "Makefile", "bytes": "2091" }, { "name": "PLpgSQL", "bytes": "7624" }, { "name": "Shell", "bytes": "12576" }, { "name": "TSQL", "bytes": "1639" } ] }
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ** This file is automatically generated by gapic-generator-typescript. ** // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** /* global window */ import type * as gax from 'google-gax'; import type { Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, } from 'google-gax'; import {Transform, PassThrough} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v2/speech_client_config.json`. * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './speech_client_config.json'; const version = require('../../../package.json').version; /** * Enables speech transcription and resource management. * @class * @memberof v2 */ export class SpeechClient { private _terminated = false; private _opts: ClientOptions; private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, stream: {}, longrunning: {}, batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; speechStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of SpeechClient. * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] * @param {string} [options.email] - Account email address. Required when * using a .pem or .p12 keyFilename. * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or * .p12 key downloaded from the Google Developers Console. If you provide * a path to a JSON file, the projectId option below is not necessary. * NOTE: .pem and .p12 require you to specify options.email as well. * @param {number} [options.port] - The port on which to connect to * the remote host. * @param {string} [options.projectId] - The project ID from the Google * Developer's Console, e.g. 'grape-spaceship-123'. We will also check * the environment variable GCLOUD_PROJECT for your project ID. If your * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you * need to avoid loading the default gRPC version and want to use the fallback * HTTP implementation. Load only fallback version and pass it to the constructor: * ``` * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC * const client = new SpeechClient({fallback: 'rest'}, gax); * ``` */ constructor( opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SpeechClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } // Load google-gax module synchronously if needed if (!gaxInstance) { gaxInstance = require('google-gax') as typeof gax; } // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. this._opts = opts; // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } else if (opts.fallback === 'rest') { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { configPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/config' ), cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' ), cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' ), customClassPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/customClasses/{custom_class}' ), locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), phraseSetPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/phraseSets/{phrase_set}' ), projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), recognizerPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/recognizers/{recognizer}' ), }; // Some of the methods on this service return "paged" results, // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { listRecognizers: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'recognizers' ), listCustomClasses: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'customClasses' ), listPhraseSets: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'phraseSets' ), }; // Some of the methods on this service provide streaming responses. // Provide descriptors for these. this.descriptors.stream = { streamingRecognize: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest' ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback === 'rest') { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = [ { selector: 'google.longrunning.Operations.CancelOperation', post: '/v2/{name=projects/*/locations/*/operations/*}:cancel', body: '*', }, { selector: 'google.longrunning.Operations.DeleteOperation', delete: '/v2/{name=projects/*/locations/*/operations/*}', }, { selector: 'google.longrunning.Operations.GetOperation', get: '/v2/{name=projects/*/locations/*/operations/*}', }, { selector: 'google.longrunning.Operations.ListOperations', get: '/v2/{name=projects/*/locations/*}/operations', }, ]; } this.operationsClient = this._gaxModule .lro(lroOptions) .operationsClient(opts); const createRecognizerResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.Recognizer' ) as gax.protobuf.Type; const createRecognizerMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const updateRecognizerResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.Recognizer' ) as gax.protobuf.Type; const updateRecognizerMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const deleteRecognizerResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.Recognizer' ) as gax.protobuf.Type; const deleteRecognizerMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const undeleteRecognizerResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.Recognizer' ) as gax.protobuf.Type; const undeleteRecognizerMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const batchRecognizeResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.BatchRecognizeResponse' ) as gax.protobuf.Type; const batchRecognizeMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const createCustomClassResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.CustomClass' ) as gax.protobuf.Type; const createCustomClassMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const updateCustomClassResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.CustomClass' ) as gax.protobuf.Type; const updateCustomClassMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const deleteCustomClassResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.CustomClass' ) as gax.protobuf.Type; const deleteCustomClassMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const undeleteCustomClassResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.CustomClass' ) as gax.protobuf.Type; const undeleteCustomClassMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const createPhraseSetResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.PhraseSet' ) as gax.protobuf.Type; const createPhraseSetMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const updatePhraseSetResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.PhraseSet' ) as gax.protobuf.Type; const updatePhraseSetMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const deletePhraseSetResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.PhraseSet' ) as gax.protobuf.Type; const deletePhraseSetMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; const undeletePhraseSetResponse = protoFilesRoot.lookup( '.google.cloud.speech.v2.PhraseSet' ) as gax.protobuf.Type; const undeletePhraseSetMetadata = protoFilesRoot.lookup( '.google.cloud.speech.v2.OperationMetadata' ) as gax.protobuf.Type; this.descriptors.longrunning = { createRecognizer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createRecognizerResponse.decode.bind(createRecognizerResponse), createRecognizerMetadata.decode.bind(createRecognizerMetadata) ), updateRecognizer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateRecognizerResponse.decode.bind(updateRecognizerResponse), updateRecognizerMetadata.decode.bind(updateRecognizerMetadata) ), deleteRecognizer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteRecognizerResponse.decode.bind(deleteRecognizerResponse), deleteRecognizerMetadata.decode.bind(deleteRecognizerMetadata) ), undeleteRecognizer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, undeleteRecognizerResponse.decode.bind(undeleteRecognizerResponse), undeleteRecognizerMetadata.decode.bind(undeleteRecognizerMetadata) ), batchRecognize: new this._gaxModule.LongrunningDescriptor( this.operationsClient, batchRecognizeResponse.decode.bind(batchRecognizeResponse), batchRecognizeMetadata.decode.bind(batchRecognizeMetadata) ), createCustomClass: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createCustomClassResponse.decode.bind(createCustomClassResponse), createCustomClassMetadata.decode.bind(createCustomClassMetadata) ), updateCustomClass: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateCustomClassResponse.decode.bind(updateCustomClassResponse), updateCustomClassMetadata.decode.bind(updateCustomClassMetadata) ), deleteCustomClass: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteCustomClassResponse.decode.bind(deleteCustomClassResponse), deleteCustomClassMetadata.decode.bind(deleteCustomClassMetadata) ), undeleteCustomClass: new this._gaxModule.LongrunningDescriptor( this.operationsClient, undeleteCustomClassResponse.decode.bind(undeleteCustomClassResponse), undeleteCustomClassMetadata.decode.bind(undeleteCustomClassMetadata) ), createPhraseSet: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createPhraseSetResponse.decode.bind(createPhraseSetResponse), createPhraseSetMetadata.decode.bind(createPhraseSetMetadata) ), updatePhraseSet: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updatePhraseSetResponse.decode.bind(updatePhraseSetResponse), updatePhraseSetMetadata.decode.bind(updatePhraseSetMetadata) ), deletePhraseSet: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deletePhraseSetResponse.decode.bind(deletePhraseSetResponse), deletePhraseSetMetadata.decode.bind(deletePhraseSetMetadata) ), undeletePhraseSet: new this._gaxModule.LongrunningDescriptor( this.operationsClient, undeletePhraseSetResponse.decode.bind(undeletePhraseSetResponse), undeletePhraseSetMetadata.decode.bind(undeletePhraseSetMetadata) ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.speech.v2.Speech', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')} ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. this.warn = this._gaxModule.warn; } /** * Initialize the client. * Performs asynchronous operations (such as authentication) and prepares the client. * This function will be called automatically when any class method is called for the * first time, but if you need to initialize it before calling an actual method, * feel free to call initialize() directly. * * You can await on this method if you want to make sure the client is initialized. * * @returns {Promise} A promise that resolves to an authenticated service stub. */ initialize() { // If the client stub promise is already initialized, return immediately. if (this.speechStub) { return this.speechStub; } // Put together the "service stub" for // google.cloud.speech.v2.Speech. this.speechStub = this._gaxGrpc.createStub( this._opts.fallback ? (this._protos as protobuf.Root).lookupService( 'google.cloud.speech.v2.Speech' ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.speech.v2.Speech, this._opts, this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. const speechStubMethods = [ 'createRecognizer', 'listRecognizers', 'getRecognizer', 'updateRecognizer', 'deleteRecognizer', 'undeleteRecognizer', 'recognize', 'streamingRecognize', 'batchRecognize', 'getConfig', 'updateConfig', 'createCustomClass', 'listCustomClasses', 'getCustomClass', 'updateCustomClass', 'deleteCustomClass', 'undeleteCustomClass', 'createPhraseSet', 'listPhraseSets', 'getPhraseSet', 'updatePhraseSet', 'deletePhraseSet', 'undeletePhraseSet', ]; for (const methodName of speechStubMethods) { const callPromise = this.speechStub.then( stub => (...args: Array<{}>) => { if (this._terminated) { if (methodName in this.descriptors.stream) { const stream = new PassThrough(); setImmediate(() => { stream.emit( 'error', new this._gaxModule.GoogleError( 'The client has already been closed.' ) ); }); return stream; } return Promise.reject('The client has already been closed.'); } const func = stub[methodName]; return func.apply(stub, args); }, (err: Error | null | undefined) => () => { throw err; } ); const descriptor = this.descriptors.page[methodName] || this.descriptors.stream[methodName] || this.descriptors.longrunning[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; } return this.speechStub; } /** * The DNS address for this API service. * @returns {string} The DNS address for this service. */ static get servicePath() { return 'speech.googleapis.com'; } /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'speech.googleapis.com'; } /** * The port for this API service. * @returns {number} The default port for this service. */ static get port() { return 443; } /** * The scopes needed to make gRPC calls for every method defined * in this service. * @returns {string[]} List of default scopes. */ static get scopes() { return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise<string>; getProjectId(callback: Callback<string, undefined, undefined>): void; /** * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback<string, undefined, undefined> ): Promise<string> | void { if (callback) { this.auth.getProjectId(callback); return; } return this.auth.getProjectId(); } // ------------------- // -- Service calls -- // ------------------- /** * Returns the requested * {@link google.cloud.speech.v2.Recognizer|Recognizer}. Fails with * {@link google.rpc.Code.NOT_FOUND|NOT_FOUND} if the requested recognizer doesn't * exist. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the Recognizer to retrieve. The expected format is * `projects/{project}/locations/{location}/recognizers/{recognizer}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Recognizer]{@link google.cloud.speech.v2.Recognizer}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.get_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_GetRecognizer_async */ getRecognizer( request?: protos.google.cloud.speech.v2.IGetRecognizerRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | undefined, {} | undefined ] >; getRecognizer( request: protos.google.cloud.speech.v2.IGetRecognizerRequest, options: CallOptions, callback: Callback< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined > ): void; getRecognizer( request: protos.google.cloud.speech.v2.IGetRecognizerRequest, callback: Callback< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined > ): void; getRecognizer( request?: protos.google.cloud.speech.v2.IGetRecognizerRequest, optionsOrCallback?: | CallOptions | Callback< protos.google.cloud.speech.v2.IRecognizer, | protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined >, callback?: Callback< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | null | undefined, {} | null | undefined > ): Promise< [ protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IGetRecognizerRequest | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getRecognizer(request, options, callback); } /** * Performs synchronous Speech recognition: receive results after all audio * has been sent and processed. * * @param {Object} request * The request object that will be sent. * @param {string} request.recognizer * Required. The name of the Recognizer to use during recognition. The * expected format is * `projects/{project}/locations/{location}/recognizers/{recognizer}`. * @param {google.cloud.speech.v2.RecognitionConfig} request.config * Features and audio metadata to use for the Automatic Speech Recognition. * This field in combination with the * {@link google.cloud.speech.v2.RecognizeRequest.config_mask|config_mask} field * can be used to override parts of the * {@link google.cloud.speech.v2.Recognizer.default_recognition_config|default_recognition_config} * of the Recognizer resource. * @param {google.protobuf.FieldMask} request.configMask * The list of fields in * {@link google.cloud.speech.v2.RecognizeRequest.config|config} that override the * values in the * {@link google.cloud.speech.v2.Recognizer.default_recognition_config|default_recognition_config} * of the recognizer during this recognition request. If no mask is provided, * all non-default valued fields in * {@link google.cloud.speech.v2.RecognizeRequest.config|config} override the * values in the recognizer for this recognition request. If a mask is * provided, only the fields listed in the mask override the config in the * recognizer for this recognition request. If a wildcard (`*`) is provided, * {@link google.cloud.speech.v2.RecognizeRequest.config|config} completely * overrides and replaces the config in the recognizer for this recognition * request. * @param {Buffer} request.content * The audio data bytes encoded as specified in * {@link google.cloud.speech.v2.RecognitionConfig|RecognitionConfig}. As * with all bytes fields, proto buffers use a pure binary representation, * whereas JSON representations use base64. * @param {string} request.uri * URI that points to a file that contains audio data bytes as specified in * {@link google.cloud.speech.v2.RecognitionConfig|RecognitionConfig}. The file * must not be compressed (for example, gzip). Currently, only Google Cloud * Storage URIs are supported, which must be specified in the following * format: `gs://bucket_name/object_name` (other URI formats return * {@link google.rpc.Code.INVALID_ARGUMENT|INVALID_ARGUMENT}). For more * information, see [Request * URIs](https://cloud.google.com/storage/docs/reference-uris). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [RecognizeResponse]{@link google.cloud.speech.v2.RecognizeResponse}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.recognize.js</caption> * region_tag:speech_v2_generated_Speech_Recognize_async */ recognize( request?: protos.google.cloud.speech.v2.IRecognizeRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | undefined, {} | undefined ] >; recognize( request: protos.google.cloud.speech.v2.IRecognizeRequest, options: CallOptions, callback: Callback< protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined > ): void; recognize( request: protos.google.cloud.speech.v2.IRecognizeRequest, callback: Callback< protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined > ): void; recognize( request?: protos.google.cloud.speech.v2.IRecognizeRequest, optionsOrCallback?: | CallOptions | Callback< protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined >, callback?: Callback< protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | null | undefined, {} | null | undefined > ): Promise< [ protos.google.cloud.speech.v2.IRecognizeResponse, protos.google.cloud.speech.v2.IRecognizeRequest | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ recognizer: request.recognizer ?? '', }); this.initialize(); return this.innerApiCalls.recognize(request, options, callback); } /** * Returns the requested {@link google.cloud.speech.v2.Config|Config}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the config to retrieve. There is exactly one config * resource per project per location. The expected format is * `projects/{project}/locations/{location}/config`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Config]{@link google.cloud.speech.v2.Config}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.get_config.js</caption> * region_tag:speech_v2_generated_Speech_GetConfig_async */ getConfig( request?: protos.google.cloud.speech.v2.IGetConfigRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | undefined, {} | undefined ] >; getConfig( request: protos.google.cloud.speech.v2.IGetConfigRequest, options: CallOptions, callback: Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined > ): void; getConfig( request: protos.google.cloud.speech.v2.IGetConfigRequest, callback: Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined > ): void; getConfig( request?: protos.google.cloud.speech.v2.IGetConfigRequest, optionsOrCallback?: | CallOptions | Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined >, callback?: Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | null | undefined, {} | null | undefined > ): Promise< [ protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IGetConfigRequest | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getConfig(request, options, callback); } /** * Updates the {@link google.cloud.speech.v2.Config|Config}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.Config} request.config * Required. The config to update. * * The config's `name` field is used to identify the config to be updated. * The expected format is `projects/{project}/locations/{location}/config`. * @param {google.protobuf.FieldMask} request.updateMask * The list of fields to be updated. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Config]{@link google.cloud.speech.v2.Config}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_config.js</caption> * region_tag:speech_v2_generated_Speech_UpdateConfig_async */ updateConfig( request?: protos.google.cloud.speech.v2.IUpdateConfigRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | undefined, {} | undefined ] >; updateConfig( request: protos.google.cloud.speech.v2.IUpdateConfigRequest, options: CallOptions, callback: Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined > ): void; updateConfig( request: protos.google.cloud.speech.v2.IUpdateConfigRequest, callback: Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined > ): void; updateConfig( request?: protos.google.cloud.speech.v2.IUpdateConfigRequest, optionsOrCallback?: | CallOptions | Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined >, callback?: Callback< protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | null | undefined, {} | null | undefined > ): Promise< [ protos.google.cloud.speech.v2.IConfig, protos.google.cloud.speech.v2.IUpdateConfigRequest | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ 'config.name': request.config!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateConfig(request, options, callback); } /** * Returns the requested * {@link google.cloud.speech.v2.CustomClass|CustomClass}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the CustomClass to retrieve. The expected format is * `projects/{project}/locations/{location}/customClasses/{custom_class}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [CustomClass]{@link google.cloud.speech.v2.CustomClass}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.get_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_GetCustomClass_async */ getCustomClass( request?: protos.google.cloud.speech.v2.IGetCustomClassRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | undefined, {} | undefined ] >; getCustomClass( request: protos.google.cloud.speech.v2.IGetCustomClassRequest, options: CallOptions, callback: Callback< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined > ): void; getCustomClass( request: protos.google.cloud.speech.v2.IGetCustomClassRequest, callback: Callback< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined > ): void; getCustomClass( request?: protos.google.cloud.speech.v2.IGetCustomClassRequest, optionsOrCallback?: | CallOptions | Callback< protos.google.cloud.speech.v2.ICustomClass, | protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined >, callback?: Callback< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | null | undefined, {} | null | undefined > ): Promise< [ protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IGetCustomClassRequest | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getCustomClass(request, options, callback); } /** * Returns the requested * {@link google.cloud.speech.v2.PhraseSet|PhraseSet}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the PhraseSet to retrieve. The expected format is * `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [PhraseSet]{@link google.cloud.speech.v2.PhraseSet}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.get_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_GetPhraseSet_async */ getPhraseSet( request?: protos.google.cloud.speech.v2.IGetPhraseSetRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | undefined, {} | undefined ] >; getPhraseSet( request: protos.google.cloud.speech.v2.IGetPhraseSetRequest, options: CallOptions, callback: Callback< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined > ): void; getPhraseSet( request: protos.google.cloud.speech.v2.IGetPhraseSetRequest, callback: Callback< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined > ): void; getPhraseSet( request?: protos.google.cloud.speech.v2.IGetPhraseSetRequest, optionsOrCallback?: | CallOptions | Callback< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined >, callback?: Callback< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | null | undefined, {} | null | undefined > ): Promise< [ protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IGetPhraseSetRequest | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getPhraseSet(request, options, callback); } /** * Performs bidirectional streaming speech recognition: receive results while * sending audio. This method is only available via the gRPC API (not REST). * * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which is both readable and writable. It accepts objects * representing [StreamingRecognizeRequest]{@link google.cloud.speech.v2.StreamingRecognizeRequest} for write() method, and * will emit objects representing [StreamingRecognizeResponse]{@link google.cloud.speech.v2.StreamingRecognizeResponse} on 'data' event asynchronously. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.streaming_recognize.js</caption> * region_tag:speech_v2_generated_Speech_StreamingRecognize_async */ _streamingRecognize(options?: CallOptions): gax.CancellableStream { this.initialize(); return this.innerApiCalls.streamingRecognize(null, options); } /** * Creates a {@link google.cloud.speech.v2.Recognizer|Recognizer}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.Recognizer} request.recognizer * Required. The Recognizer to create. * @param {boolean} request.validateOnly * If set, validate the request and preview the Recognizer, but do not * actually create it. * @param {string} request.recognizerId * The ID to use for the Recognizer, which will become the final component of * the Recognizer's resource name. * * This value should be 4-63 characters, and valid characters * are /{@link 0-9|a-z}-/. * @param {string} request.parent * Required. The project and location where this Recognizer will be created. * The expected format is `projects/{project}/locations/{location}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.create_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_CreateRecognizer_async */ createRecognizer( request?: protos.google.cloud.speech.v2.ICreateRecognizerRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; createRecognizer( request: protos.google.cloud.speech.v2.ICreateRecognizerRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; createRecognizer( request: protos.google.cloud.speech.v2.ICreateRecognizerRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; createRecognizer( request?: protos.google.cloud.speech.v2.ICreateRecognizerRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createRecognizer(request, options, callback); } /** * Check the status of the long running operation returned by `createRecognizer()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.create_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_CreateRecognizer_async */ async checkCreateRecognizerProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createRecognizer, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Updates the {@link google.cloud.speech.v2.Recognizer|Recognizer}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.Recognizer} request.recognizer * Required. The Recognizer to update. * * The Recognizer's `name` field is used to identify the Recognizer to update. * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`. * @param {google.protobuf.FieldMask} request.updateMask * The list of fields to update. If empty, all non-default valued fields are * considered for update. Use `*` to update the entire Recognizer resource. * @param {boolean} request.validateOnly * If set, validate the request and preview the updated Recognizer, but do not * actually update it. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_UpdateRecognizer_async */ updateRecognizer( request?: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; updateRecognizer( request: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; updateRecognizer( request: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; updateRecognizer( request?: protos.google.cloud.speech.v2.IUpdateRecognizerRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ 'recognizer.name': request.recognizer!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateRecognizer(request, options, callback); } /** * Check the status of the long running operation returned by `updateRecognizer()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_UpdateRecognizer_async */ async checkUpdateRecognizerProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updateRecognizer, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Deletes the {@link google.cloud.speech.v2.Recognizer|Recognizer}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the Recognizer to delete. * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}` * @param {boolean} request.validateOnly * If set, validate the request and preview the deleted Recognizer, but do not * actually delete it. * @param {boolean} request.allowMissing * If set to true, and the Recognizer is not found, the request will succeed * and be a no-op (no Operation is recorded in this case). * @param {string} request.etag * This checksum is computed by the server based on the value of other * fields. This may be sent on update, undelete, and delete requests to ensure * the client has an up-to-date value before proceeding. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.delete_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_DeleteRecognizer_async */ deleteRecognizer( request?: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; deleteRecognizer( request: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; deleteRecognizer( request: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; deleteRecognizer( request?: protos.google.cloud.speech.v2.IDeleteRecognizerRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteRecognizer(request, options, callback); } /** * Check the status of the long running operation returned by `deleteRecognizer()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.delete_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_DeleteRecognizer_async */ async checkDeleteRecognizerProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteRecognizer, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Undeletes the {@link google.cloud.speech.v2.Recognizer|Recognizer}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the Recognizer to undelete. * Format: `projects/{project}/locations/{location}/recognizers/{recognizer}` * @param {boolean} request.validateOnly * If set, validate the request and preview the undeleted Recognizer, but do * not actually undelete it. * @param {string} request.etag * This checksum is computed by the server based on the value of other * fields. This may be sent on update, undelete, and delete requests to ensure * the client has an up-to-date value before proceeding. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.undelete_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_UndeleteRecognizer_async */ undeleteRecognizer( request?: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; undeleteRecognizer( request: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; undeleteRecognizer( request: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; undeleteRecognizer( request?: protos.google.cloud.speech.v2.IUndeleteRecognizerRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IRecognizer, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.undeleteRecognizer(request, options, callback); } /** * Check the status of the long running operation returned by `undeleteRecognizer()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.undelete_recognizer.js</caption> * region_tag:speech_v2_generated_Speech_UndeleteRecognizer_async */ async checkUndeleteRecognizerProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.undeleteRecognizer, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.Recognizer, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Performs batch asynchronous speech recognition: send a request with N * audio files and receive a long running operation that can be polled to see * when the transcriptions are finished. * * @param {Object} request * The request object that will be sent. * @param {string} request.recognizer * Required. Resource name of the recognizer to be used for ASR. * @param {google.cloud.speech.v2.RecognitionConfig} request.config * Features and audio metadata to use for the Automatic Speech Recognition. * This field in combination with the * {@link google.cloud.speech.v2.BatchRecognizeRequest.config_mask|config_mask} * field can be used to override parts of the * {@link google.cloud.speech.v2.Recognizer.default_recognition_config|default_recognition_config} * of the Recognizer resource. * @param {google.protobuf.FieldMask} request.configMask * The list of fields in * {@link google.cloud.speech.v2.BatchRecognizeRequest.config|config} that override * the values in the * {@link google.cloud.speech.v2.Recognizer.default_recognition_config|default_recognition_config} * of the recognizer during this recognition request. If no mask is provided, * all given fields in * {@link google.cloud.speech.v2.BatchRecognizeRequest.config|config} override the * values in the recognizer for this recognition request. If a mask is * provided, only the fields listed in the mask override the config in the * recognizer for this recognition request. If a wildcard (`*`) is provided, * {@link google.cloud.speech.v2.BatchRecognizeRequest.config|config} completely * overrides and replaces the config in the recognizer for this recognition * request. * @param {number[]} request.files * Audio files with file metadata for ASR. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.batch_recognize.js</caption> * region_tag:speech_v2_generated_Speech_BatchRecognize_async */ batchRecognize( request?: protos.google.cloud.speech.v2.IBatchRecognizeRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; batchRecognize( request: protos.google.cloud.speech.v2.IBatchRecognizeRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; batchRecognize( request: protos.google.cloud.speech.v2.IBatchRecognizeRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; batchRecognize( request?: protos.google.cloud.speech.v2.IBatchRecognizeRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IBatchRecognizeResponse, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ recognizer: request.recognizer ?? '', }); this.initialize(); return this.innerApiCalls.batchRecognize(request, options, callback); } /** * Check the status of the long running operation returned by `batchRecognize()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.batch_recognize.js</caption> * region_tag:speech_v2_generated_Speech_BatchRecognize_async */ async checkBatchRecognizeProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.BatchRecognizeResponse, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.batchRecognize, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.BatchRecognizeResponse, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Creates a {@link google.cloud.speech.v2.CustomClass|CustomClass}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.CustomClass} request.customClass * Required. The CustomClass to create. * @param {boolean} request.validateOnly * If set, validate the request and preview the CustomClass, but do not * actually create it. * @param {string} request.customClassId * The ID to use for the CustomClass, which will become the final component of * the CustomClass's resource name. * * This value should be 4-63 characters, and valid characters * are /{@link 0-9|a-z}-/. * @param {string} request.parent * Required. The project and location where this CustomClass will be created. * The expected format is `projects/{project}/locations/{location}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.create_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_CreateCustomClass_async */ createCustomClass( request?: protos.google.cloud.speech.v2.ICreateCustomClassRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; createCustomClass( request: protos.google.cloud.speech.v2.ICreateCustomClassRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; createCustomClass( request: protos.google.cloud.speech.v2.ICreateCustomClassRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; createCustomClass( request?: protos.google.cloud.speech.v2.ICreateCustomClassRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createCustomClass(request, options, callback); } /** * Check the status of the long running operation returned by `createCustomClass()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.create_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_CreateCustomClass_async */ async checkCreateCustomClassProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createCustomClass, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Updates the {@link google.cloud.speech.v2.CustomClass|CustomClass}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.CustomClass} request.customClass * Required. The CustomClass to update. * * The CustomClass's `name` field is used to identify the CustomClass to * update. Format: * `projects/{project}/locations/{location}/customClasses/{custom_class}`. * @param {google.protobuf.FieldMask} request.updateMask * The list of fields to be updated. If empty, all fields are considered for * update. * @param {boolean} request.validateOnly * If set, validate the request and preview the updated CustomClass, but do * not actually update it. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_UpdateCustomClass_async */ updateCustomClass( request?: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; updateCustomClass( request: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; updateCustomClass( request: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; updateCustomClass( request?: protos.google.cloud.speech.v2.IUpdateCustomClassRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ 'custom_class.name': request.customClass!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateCustomClass(request, options, callback); } /** * Check the status of the long running operation returned by `updateCustomClass()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_UpdateCustomClass_async */ async checkUpdateCustomClassProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updateCustomClass, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Deletes the {@link google.cloud.speech.v2.CustomClass|CustomClass}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the CustomClass to delete. * Format: * `projects/{project}/locations/{location}/customClasses/{custom_class}` * @param {boolean} request.validateOnly * If set, validate the request and preview the deleted CustomClass, but do * not actually delete it. * @param {boolean} request.allowMissing * If set to true, and the CustomClass is not found, the request will succeed * and be a no-op (no Operation is recorded in this case). * @param {string} request.etag * This checksum is computed by the server based on the value of other * fields. This may be sent on update, undelete, and delete requests to ensure * the client has an up-to-date value before proceeding. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.delete_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_DeleteCustomClass_async */ deleteCustomClass( request?: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; deleteCustomClass( request: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; deleteCustomClass( request: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; deleteCustomClass( request?: protos.google.cloud.speech.v2.IDeleteCustomClassRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteCustomClass(request, options, callback); } /** * Check the status of the long running operation returned by `deleteCustomClass()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.delete_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_DeleteCustomClass_async */ async checkDeleteCustomClassProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deleteCustomClass, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Undeletes the {@link google.cloud.speech.v2.CustomClass|CustomClass}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the CustomClass to undelete. * Format: * `projects/{project}/locations/{location}/customClasses/{custom_class}` * @param {boolean} request.validateOnly * If set, validate the request and preview the undeleted CustomClass, but do * not actually undelete it. * @param {string} request.etag * This checksum is computed by the server based on the value of other * fields. This may be sent on update, undelete, and delete requests to ensure * the client has an up-to-date value before proceeding. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.undelete_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_UndeleteCustomClass_async */ undeleteCustomClass( request?: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; undeleteCustomClass( request: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; undeleteCustomClass( request: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; undeleteCustomClass( request?: protos.google.cloud.speech.v2.IUndeleteCustomClassRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.ICustomClass, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.undeleteCustomClass(request, options, callback); } /** * Check the status of the long running operation returned by `undeleteCustomClass()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.undelete_custom_class.js</caption> * region_tag:speech_v2_generated_Speech_UndeleteCustomClass_async */ async checkUndeleteCustomClassProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.undeleteCustomClass, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.CustomClass, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Creates a {@link google.cloud.speech.v2.PhraseSet|PhraseSet}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.PhraseSet} request.phraseSet * Required. The PhraseSet to create. * @param {boolean} request.validateOnly * If set, validate the request and preview the PhraseSet, but do not * actually create it. * @param {string} request.phraseSetId * The ID to use for the PhraseSet, which will become the final component of * the PhraseSet's resource name. * * This value should be 4-63 characters, and valid characters * are /{@link 0-9|a-z}-/. * @param {string} request.parent * Required. The project and location where this PhraseSet will be created. * The expected format is `projects/{project}/locations/{location}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.create_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_CreatePhraseSet_async */ createPhraseSet( request?: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; createPhraseSet( request: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; createPhraseSet( request: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; createPhraseSet( request?: protos.google.cloud.speech.v2.ICreatePhraseSetRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createPhraseSet(request, options, callback); } /** * Check the status of the long running operation returned by `createPhraseSet()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.create_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_CreatePhraseSet_async */ async checkCreatePhraseSetProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.createPhraseSet, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Updates the {@link google.cloud.speech.v2.PhraseSet|PhraseSet}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.speech.v2.PhraseSet} request.phraseSet * Required. The PhraseSet to update. * * The PhraseSet's `name` field is used to identify the PhraseSet to update. * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`. * @param {google.protobuf.FieldMask} request.updateMask * The list of fields to update. If empty, all non-default valued fields are * considered for update. Use `*` to update the entire PhraseSet resource. * @param {boolean} request.validateOnly * If set, validate the request and preview the updated PhraseSet, but do not * actually update it. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_UpdatePhraseSet_async */ updatePhraseSet( request?: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; updatePhraseSet( request: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; updatePhraseSet( request: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; updatePhraseSet( request?: protos.google.cloud.speech.v2.IUpdatePhraseSetRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ 'phrase_set.name': request.phraseSet!.name ?? '', }); this.initialize(); return this.innerApiCalls.updatePhraseSet(request, options, callback); } /** * Check the status of the long running operation returned by `updatePhraseSet()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.update_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_UpdatePhraseSet_async */ async checkUpdatePhraseSetProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.updatePhraseSet, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Deletes the {@link google.cloud.speech.v2.PhraseSet|PhraseSet}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the PhraseSet to delete. * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}` * @param {boolean} request.validateOnly * If set, validate the request and preview the deleted PhraseSet, but do not * actually delete it. * @param {boolean} request.allowMissing * If set to true, and the PhraseSet is not found, the request will succeed * and be a no-op (no Operation is recorded in this case). * @param {string} request.etag * This checksum is computed by the server based on the value of other * fields. This may be sent on update, undelete, and delete requests to ensure * the client has an up-to-date value before proceeding. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.delete_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_DeletePhraseSet_async */ deletePhraseSet( request?: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; deletePhraseSet( request: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; deletePhraseSet( request: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; deletePhraseSet( request?: protos.google.cloud.speech.v2.IDeletePhraseSetRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deletePhraseSet(request, options, callback); } /** * Check the status of the long running operation returned by `deletePhraseSet()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.delete_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_DeletePhraseSet_async */ async checkDeletePhraseSetProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.deletePhraseSet, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Undeletes the {@link google.cloud.speech.v2.PhraseSet|PhraseSet}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. The name of the PhraseSet to undelete. * Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}` * @param {boolean} request.validateOnly * If set, validate the request and preview the undeleted PhraseSet, but do * not actually undelete it. * @param {string} request.etag * This checksum is computed by the server based on the value of other * fields. This may be sent on update, undelete, and delete requests to ensure * the client has an up-to-date value before proceeding. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.undelete_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_UndeletePhraseSet_async */ undeletePhraseSet( request?: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, options?: CallOptions ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] >; undeletePhraseSet( request: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, options: CallOptions, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; undeletePhraseSet( request: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, callback: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): void; undeletePhraseSet( request?: protos.google.cloud.speech.v2.IUndeletePhraseSetRequest, optionsOrCallback?: | CallOptions | Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined >, callback?: Callback< LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined > ): Promise< [ LROperation< protos.google.cloud.speech.v2.IPhraseSet, protos.google.cloud.speech.v2.IOperationMetadata >, protos.google.longrunning.IOperation | undefined, {} | undefined ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.undeletePhraseSet(request, options, callback); } /** * Check the status of the long running operation returned by `undeletePhraseSet()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.undelete_phrase_set.js</caption> * region_tag:speech_v2_generated_Speech_UndeletePhraseSet_async */ async checkUndeletePhraseSetProgress( name: string ): Promise< LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata > > { const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( {name} ); const [operation] = await this.operationsClient.getOperation(request); const decodeOperation = new this._gaxModule.Operation( operation, this.descriptors.longrunning.undeletePhraseSet, this._gaxModule.createDefaultBackoffSettings() ); return decodeOperation as LROperation< protos.google.cloud.speech.v2.PhraseSet, protos.google.cloud.speech.v2.OperationMetadata >; } /** * Lists Recognizers. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of Recognizers to list. The expected * format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * The maximum number of Recognizers to return. The service may return fewer * than this value. If unspecified, at most 20 Recognizers will be returned. * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListRecognizers|ListRecognizers} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListRecognizers|ListRecognizers} must match * the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [Recognizer]{@link google.cloud.speech.v2.Recognizer}. * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. * Note that it can affect your quota. * We recommend using `listRecognizersAsync()` * method described below for async iteration which you can stop as needed. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ listRecognizers( request?: protos.google.cloud.speech.v2.IListRecognizersRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IRecognizer[], protos.google.cloud.speech.v2.IListRecognizersRequest | null, protos.google.cloud.speech.v2.IListRecognizersResponse ] >; listRecognizers( request: protos.google.cloud.speech.v2.IListRecognizersRequest, options: CallOptions, callback: PaginationCallback< protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer > ): void; listRecognizers( request: protos.google.cloud.speech.v2.IListRecognizersRequest, callback: PaginationCallback< protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer > ): void; listRecognizers( request?: protos.google.cloud.speech.v2.IListRecognizersRequest, optionsOrCallback?: | CallOptions | PaginationCallback< protos.google.cloud.speech.v2.IListRecognizersRequest, | protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer >, callback?: PaginationCallback< protos.google.cloud.speech.v2.IListRecognizersRequest, protos.google.cloud.speech.v2.IListRecognizersResponse | null | undefined, protos.google.cloud.speech.v2.IRecognizer > ): Promise< [ protos.google.cloud.speech.v2.IRecognizer[], protos.google.cloud.speech.v2.IListRecognizersRequest | null, protos.google.cloud.speech.v2.IListRecognizersResponse ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listRecognizers(request, options, callback); } /** * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of Recognizers to list. The expected * format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * The maximum number of Recognizers to return. The service may return fewer * than this value. If unspecified, at most 20 Recognizers will be returned. * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListRecognizers|ListRecognizers} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListRecognizers|ListRecognizers} must match * the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [Recognizer]{@link google.cloud.speech.v2.Recognizer} on 'data' event. * The client library will perform auto-pagination by default: it will call the API as many * times as needed. Note that it can affect your quota. * We recommend using `listRecognizersAsync()` * method described below for async iteration which you can stop as needed. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ listRecognizersStream( request?: protos.google.cloud.speech.v2.IListRecognizersRequest, options?: CallOptions ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listRecognizers']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listRecognizers.createStream( this.innerApiCalls.listRecognizers as GaxCall, request, callSettings ); } /** * Equivalent to `listRecognizers`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of Recognizers to list. The expected * format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * The maximum number of Recognizers to return. The service may return fewer * than this value. If unspecified, at most 20 Recognizers will be returned. * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListRecognizers|ListRecognizers} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListRecognizers|ListRecognizers} must match * the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). * When you iterate the returned iterable, each element will be an object representing * [Recognizer]{@link google.cloud.speech.v2.Recognizer}. The API will be called under the hood as needed, once per the page, * so you can stop the iteration when you don't need more results. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.list_recognizers.js</caption> * region_tag:speech_v2_generated_Speech_ListRecognizers_async */ listRecognizersAsync( request?: protos.google.cloud.speech.v2.IListRecognizersRequest, options?: CallOptions ): AsyncIterable<protos.google.cloud.speech.v2.IRecognizer> { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listRecognizers']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listRecognizers.asyncIterate( this.innerApiCalls['listRecognizers'] as GaxCall, request as {}, callSettings ) as AsyncIterable<protos.google.cloud.speech.v2.IRecognizer>; } /** * Lists CustomClasses. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of CustomClass resources to list. The * expected format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * Number of results per requests. A valid page_size ranges from 0 to 20 * inclusive. If the page_size is zero or unspecified, a page size of 5 will * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note * that a call might return fewer results than the requested page size. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListCustomClasses|ListCustomClasses} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListCustomClasses|ListCustomClasses} must * match the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [CustomClass]{@link google.cloud.speech.v2.CustomClass}. * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. * Note that it can affect your quota. * We recommend using `listCustomClassesAsync()` * method described below for async iteration which you can stop as needed. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ listCustomClasses( request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.ICustomClass[], protos.google.cloud.speech.v2.IListCustomClassesRequest | null, protos.google.cloud.speech.v2.IListCustomClassesResponse ] >; listCustomClasses( request: protos.google.cloud.speech.v2.IListCustomClassesRequest, options: CallOptions, callback: PaginationCallback< protos.google.cloud.speech.v2.IListCustomClassesRequest, | protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass > ): void; listCustomClasses( request: protos.google.cloud.speech.v2.IListCustomClassesRequest, callback: PaginationCallback< protos.google.cloud.speech.v2.IListCustomClassesRequest, | protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass > ): void; listCustomClasses( request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, optionsOrCallback?: | CallOptions | PaginationCallback< protos.google.cloud.speech.v2.IListCustomClassesRequest, | protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass >, callback?: PaginationCallback< protos.google.cloud.speech.v2.IListCustomClassesRequest, | protos.google.cloud.speech.v2.IListCustomClassesResponse | null | undefined, protos.google.cloud.speech.v2.ICustomClass > ): Promise< [ protos.google.cloud.speech.v2.ICustomClass[], protos.google.cloud.speech.v2.IListCustomClassesRequest | null, protos.google.cloud.speech.v2.IListCustomClassesResponse ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listCustomClasses(request, options, callback); } /** * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of CustomClass resources to list. The * expected format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * Number of results per requests. A valid page_size ranges from 0 to 20 * inclusive. If the page_size is zero or unspecified, a page size of 5 will * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note * that a call might return fewer results than the requested page size. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListCustomClasses|ListCustomClasses} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListCustomClasses|ListCustomClasses} must * match the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [CustomClass]{@link google.cloud.speech.v2.CustomClass} on 'data' event. * The client library will perform auto-pagination by default: it will call the API as many * times as needed. Note that it can affect your quota. * We recommend using `listCustomClassesAsync()` * method described below for async iteration which you can stop as needed. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ listCustomClassesStream( request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, options?: CallOptions ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCustomClasses']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCustomClasses.createStream( this.innerApiCalls.listCustomClasses as GaxCall, request, callSettings ); } /** * Equivalent to `listCustomClasses`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of CustomClass resources to list. The * expected format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * Number of results per requests. A valid page_size ranges from 0 to 20 * inclusive. If the page_size is zero or unspecified, a page size of 5 will * be chosen. If the page size exceeds 20, it will be coerced down to 20. Note * that a call might return fewer results than the requested page size. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListCustomClasses|ListCustomClasses} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListCustomClasses|ListCustomClasses} must * match the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). * When you iterate the returned iterable, each element will be an object representing * [CustomClass]{@link google.cloud.speech.v2.CustomClass}. The API will be called under the hood as needed, once per the page, * so you can stop the iteration when you don't need more results. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.list_custom_classes.js</caption> * region_tag:speech_v2_generated_Speech_ListCustomClasses_async */ listCustomClassesAsync( request?: protos.google.cloud.speech.v2.IListCustomClassesRequest, options?: CallOptions ): AsyncIterable<protos.google.cloud.speech.v2.ICustomClass> { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listCustomClasses']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listCustomClasses.asyncIterate( this.innerApiCalls['listCustomClasses'] as GaxCall, request as {}, callSettings ) as AsyncIterable<protos.google.cloud.speech.v2.ICustomClass>; } /** * Lists PhraseSets. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of PhraseSet resources to list. The * expected format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * The maximum number of PhraseSets to return. The service may return fewer * than this value. If unspecified, at most 20 PhraseSets will be returned. * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListPhraseSets|ListPhraseSets} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListPhraseSets|ListPhraseSets} must match * the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [PhraseSet]{@link google.cloud.speech.v2.PhraseSet}. * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. * Note that it can affect your quota. * We recommend using `listPhraseSetsAsync()` * method described below for async iteration which you can stop as needed. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ listPhraseSets( request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options?: CallOptions ): Promise< [ protos.google.cloud.speech.v2.IPhraseSet[], protos.google.cloud.speech.v2.IListPhraseSetsRequest | null, protos.google.cloud.speech.v2.IListPhraseSetsResponse ] >; listPhraseSets( request: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options: CallOptions, callback: PaginationCallback< protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet > ): void; listPhraseSets( request: protos.google.cloud.speech.v2.IListPhraseSetsRequest, callback: PaginationCallback< protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet > ): void; listPhraseSets( request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< protos.google.cloud.speech.v2.IListPhraseSetsRequest, | protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet >, callback?: PaginationCallback< protos.google.cloud.speech.v2.IListPhraseSetsRequest, protos.google.cloud.speech.v2.IListPhraseSetsResponse | null | undefined, protos.google.cloud.speech.v2.IPhraseSet > ): Promise< [ protos.google.cloud.speech.v2.IPhraseSet[], protos.google.cloud.speech.v2.IListPhraseSetsRequest | null, protos.google.cloud.speech.v2.IListPhraseSetsResponse ] > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listPhraseSets(request, options, callback); } /** * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of PhraseSet resources to list. The * expected format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * The maximum number of PhraseSets to return. The service may return fewer * than this value. If unspecified, at most 20 PhraseSets will be returned. * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListPhraseSets|ListPhraseSets} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListPhraseSets|ListPhraseSets} must match * the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [PhraseSet]{@link google.cloud.speech.v2.PhraseSet} on 'data' event. * The client library will perform auto-pagination by default: it will call the API as many * times as needed. Note that it can affect your quota. * We recommend using `listPhraseSetsAsync()` * method described below for async iteration which you can stop as needed. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ listPhraseSetsStream( request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options?: CallOptions ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listPhraseSets']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listPhraseSets.createStream( this.innerApiCalls.listPhraseSets as GaxCall, request, callSettings ); } /** * Equivalent to `listPhraseSets`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The project and location of PhraseSet resources to list. The * expected format is `projects/{project}/locations/{location}`. * @param {number} request.pageSize * The maximum number of PhraseSets to return. The service may return fewer * than this value. If unspecified, at most 20 PhraseSets will be returned. * The maximum value is 20; values above 20 will be coerced to 20. * @param {string} request.pageToken * A page token, received from a previous * {@link google.cloud.speech.v2.Speech.ListPhraseSets|ListPhraseSets} call. * Provide this to retrieve the subsequent page. * * When paginating, all other parameters provided to * {@link google.cloud.speech.v2.Speech.ListPhraseSets|ListPhraseSets} must match * the call that provided the page token. * @param {boolean} request.showDeleted * Whether, or not, to show resources that have been deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). * When you iterate the returned iterable, each element will be an object representing * [PhraseSet]{@link google.cloud.speech.v2.PhraseSet}. The API will be called under the hood as needed, once per the page, * so you can stop the iteration when you don't need more results. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. * @example <caption>include:samples/generated/v2/speech.list_phrase_sets.js</caption> * region_tag:speech_v2_generated_Speech_ListPhraseSets_async */ listPhraseSetsAsync( request?: protos.google.cloud.speech.v2.IListPhraseSetsRequest, options?: CallOptions ): AsyncIterable<protos.google.cloud.speech.v2.IPhraseSet> { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listPhraseSets']; const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listPhraseSets.asyncIterate( this.innerApiCalls['listPhraseSets'] as GaxCall, request as {}, callSettings ) as AsyncIterable<protos.google.cloud.speech.v2.IPhraseSet>; } /** * 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. * * @param {Object} request - The request object that will be sent. * @param {string} request.name - The name of the operation resource. * @param {Object=} options * Optional parameters. You can override the default settings for this call, * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the * details. * @param {function(?Error, ?Object)=} callback * The function which will be called with the result of the API call. * * The second parameter to the callback is an object representing * [google.longrunning.Operation]{@link * external:"google.longrunning.Operation"}. * @return {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * [google.longrunning.Operation]{@link * external:"google.longrunning.Operation"}. The promise has a method named * "cancel" which cancels the ongoing API call. * * @example * ``` * const client = longrunning.operationsClient(); * const name = ''; * const [response] = await client.getOperation({name}); * // doThingsWith(response) * ``` */ getOperation( request: protos.google.longrunning.GetOperationRequest, options?: | gax.CallOptions | Callback< protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined >, callback?: Callback< protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined > ): Promise<[protos.google.longrunning.Operation]> { return this.operationsClient.getOperation(request, options, callback); } /** * Lists operations that match the specified filter in the request. If the * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. * * For-await-of syntax is used with the iterable to recursively get response element on-demand. * * @param {Object} request - The request object that will be sent. * @param {string} request.name - The name of the operation collection. * @param {string} request.filter - The standard list filter. * @param {number=} request.pageSize - * The maximum number of resources contained in the underlying API * response. If page streaming is performed per-resource, this * parameter does not affect the return value. If page streaming is * performed per-page, this determines the maximum number of * resources in a page. * @param {Object=} options * Optional parameters. You can override the default settings for this call, * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the * details. * @returns {Object} * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. * * @example * ``` * const client = longrunning.operationsClient(); * for await (const response of client.listOperationsAsync(request)); * // doThingsWith(response) * ``` */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions ): AsyncIterable<protos.google.longrunning.ListOperationsResponse> { return this.operationsClient.listOperationsAsync(request, options); } /** * Starts asynchronous cancellation on a long-running operation. The server * makes a best effort to cancel the operation, but success is not * guaranteed. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. Clients can use * {@link Operations.GetOperation} or * other methods to check whether the cancellation succeeded or whether the * operation completed despite cancellation. On successful cancellation, * the operation is not deleted; instead, it becomes an operation with * an {@link Operation.error} value with a {@link google.rpc.Status.code} of * 1, corresponding to `Code.CANCELLED`. * * @param {Object} request - The request object that will be sent. * @param {string} request.name - The name of the operation resource to be cancelled. * @param {Object=} options * Optional parameters. You can override the default settings for this call, * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the * details. * @param {function(?Error)=} callback * The function which will be called with the result of the API call. * @return {Promise} - The promise which resolves when API call finishes. * The promise has a method named "cancel" which cancels the ongoing API * call. * * @example * ``` * const client = longrunning.operationsClient(); * await client.cancelOperation({name: ''}); * ``` */ cancelOperation( request: protos.google.longrunning.CancelOperationRequest, options?: | gax.CallOptions | Callback< protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null >, callback?: Callback< protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null > ): Promise<protos.google.protobuf.Empty> { return this.operationsClient.cancelOperation(request, options, callback); } /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the * operation. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. * * @param {Object} request - The request object that will be sent. * @param {string} request.name - The name of the operation resource to be deleted. * @param {Object=} options * Optional parameters. You can override the default settings for this call, * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the * details. * @param {function(?Error)=} callback * The function which will be called with the result of the API call. * @return {Promise} - The promise which resolves when API call finishes. * The promise has a method named "cancel" which cancels the ongoing API * call. * * @example * ``` * const client = longrunning.operationsClient(); * await client.deleteOperation({name: ''}); * ``` */ deleteOperation( request: protos.google.longrunning.DeleteOperationRequest, options?: | gax.CallOptions | Callback< protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined >, callback?: Callback< protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined > ): Promise<protos.google.protobuf.Empty> { return this.operationsClient.deleteOperation(request, options, callback); } // -------------------- // -- Path templates -- // -------------------- /** * Return a fully-qualified config resource name string. * * @param {string} project * @param {string} location * @returns {string} Resource name string. */ configPath(project: string, location: string) { return this.pathTemplates.configPathTemplate.render({ project: project, location: location, }); } /** * Parse the project from Config resource. * * @param {string} configName * A fully-qualified path representing Config resource. * @returns {string} A string representing the project. */ matchProjectFromConfigName(configName: string) { return this.pathTemplates.configPathTemplate.match(configName).project; } /** * Parse the location from Config resource. * * @param {string} configName * A fully-qualified path representing Config resource. * @returns {string} A string representing the location. */ matchLocationFromConfigName(configName: string) { return this.pathTemplates.configPathTemplate.match(configName).location; } /** * Return a fully-qualified cryptoKey resource name string. * * @param {string} project * @param {string} location * @param {string} key_ring * @param {string} crypto_key * @returns {string} Resource name string. */ cryptoKeyPath( project: string, location: string, keyRing: string, cryptoKey: string ) { return this.pathTemplates.cryptoKeyPathTemplate.render({ project: project, location: location, key_ring: keyRing, crypto_key: cryptoKey, }); } /** * Parse the project from CryptoKey resource. * * @param {string} cryptoKeyName * A fully-qualified path representing CryptoKey resource. * @returns {string} A string representing the project. */ matchProjectFromCryptoKeyName(cryptoKeyName: string) { return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) .project; } /** * Parse the location from CryptoKey resource. * * @param {string} cryptoKeyName * A fully-qualified path representing CryptoKey resource. * @returns {string} A string representing the location. */ matchLocationFromCryptoKeyName(cryptoKeyName: string) { return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) .location; } /** * Parse the key_ring from CryptoKey resource. * * @param {string} cryptoKeyName * A fully-qualified path representing CryptoKey resource. * @returns {string} A string representing the key_ring. */ matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) .key_ring; } /** * Parse the crypto_key from CryptoKey resource. * * @param {string} cryptoKeyName * A fully-qualified path representing CryptoKey resource. * @returns {string} A string representing the crypto_key. */ matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) .crypto_key; } /** * Return a fully-qualified cryptoKeyVersion resource name string. * * @param {string} project * @param {string} location * @param {string} key_ring * @param {string} crypto_key * @param {string} crypto_key_version * @returns {string} Resource name string. */ cryptoKeyVersionPath( project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string ) { return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ project: project, location: location, key_ring: keyRing, crypto_key: cryptoKey, crypto_key_version: cryptoKeyVersion, }); } /** * Parse the project from CryptoKeyVersion resource. * * @param {string} cryptoKeyVersionName * A fully-qualified path representing CryptoKeyVersion resource. * @returns {string} A string representing the project. */ matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { return this.pathTemplates.cryptoKeyVersionPathTemplate.match( cryptoKeyVersionName ).project; } /** * Parse the location from CryptoKeyVersion resource. * * @param {string} cryptoKeyVersionName * A fully-qualified path representing CryptoKeyVersion resource. * @returns {string} A string representing the location. */ matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { return this.pathTemplates.cryptoKeyVersionPathTemplate.match( cryptoKeyVersionName ).location; } /** * Parse the key_ring from CryptoKeyVersion resource. * * @param {string} cryptoKeyVersionName * A fully-qualified path representing CryptoKeyVersion resource. * @returns {string} A string representing the key_ring. */ matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { return this.pathTemplates.cryptoKeyVersionPathTemplate.match( cryptoKeyVersionName ).key_ring; } /** * Parse the crypto_key from CryptoKeyVersion resource. * * @param {string} cryptoKeyVersionName * A fully-qualified path representing CryptoKeyVersion resource. * @returns {string} A string representing the crypto_key. */ matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { return this.pathTemplates.cryptoKeyVersionPathTemplate.match( cryptoKeyVersionName ).crypto_key; } /** * Parse the crypto_key_version from CryptoKeyVersion resource. * * @param {string} cryptoKeyVersionName * A fully-qualified path representing CryptoKeyVersion resource. * @returns {string} A string representing the crypto_key_version. */ matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { return this.pathTemplates.cryptoKeyVersionPathTemplate.match( cryptoKeyVersionName ).crypto_key_version; } /** * Return a fully-qualified customClass resource name string. * * @param {string} project * @param {string} location * @param {string} custom_class * @returns {string} Resource name string. */ customClassPath(project: string, location: string, customClass: string) { return this.pathTemplates.customClassPathTemplate.render({ project: project, location: location, custom_class: customClass, }); } /** * Parse the project from CustomClass resource. * * @param {string} customClassName * A fully-qualified path representing CustomClass resource. * @returns {string} A string representing the project. */ matchProjectFromCustomClassName(customClassName: string) { return this.pathTemplates.customClassPathTemplate.match(customClassName) .project; } /** * Parse the location from CustomClass resource. * * @param {string} customClassName * A fully-qualified path representing CustomClass resource. * @returns {string} A string representing the location. */ matchLocationFromCustomClassName(customClassName: string) { return this.pathTemplates.customClassPathTemplate.match(customClassName) .location; } /** * Parse the custom_class from CustomClass resource. * * @param {string} customClassName * A fully-qualified path representing CustomClass resource. * @returns {string} A string representing the custom_class. */ matchCustomClassFromCustomClassName(customClassName: string) { return this.pathTemplates.customClassPathTemplate.match(customClassName) .custom_class; } /** * Return a fully-qualified location resource name string. * * @param {string} project * @param {string} location * @returns {string} Resource name string. */ locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, }); } /** * Parse the project from Location resource. * * @param {string} locationName * A fully-qualified path representing Location resource. * @returns {string} A string representing the project. */ matchProjectFromLocationName(locationName: string) { return this.pathTemplates.locationPathTemplate.match(locationName).project; } /** * Parse the location from Location resource. * * @param {string} locationName * A fully-qualified path representing Location resource. * @returns {string} A string representing the location. */ matchLocationFromLocationName(locationName: string) { return this.pathTemplates.locationPathTemplate.match(locationName).location; } /** * Return a fully-qualified phraseSet resource name string. * * @param {string} project * @param {string} location * @param {string} phrase_set * @returns {string} Resource name string. */ phraseSetPath(project: string, location: string, phraseSet: string) { return this.pathTemplates.phraseSetPathTemplate.render({ project: project, location: location, phrase_set: phraseSet, }); } /** * Parse the project from PhraseSet resource. * * @param {string} phraseSetName * A fully-qualified path representing PhraseSet resource. * @returns {string} A string representing the project. */ matchProjectFromPhraseSetName(phraseSetName: string) { return this.pathTemplates.phraseSetPathTemplate.match(phraseSetName) .project; } /** * Parse the location from PhraseSet resource. * * @param {string} phraseSetName * A fully-qualified path representing PhraseSet resource. * @returns {string} A string representing the location. */ matchLocationFromPhraseSetName(phraseSetName: string) { return this.pathTemplates.phraseSetPathTemplate.match(phraseSetName) .location; } /** * Parse the phrase_set from PhraseSet resource. * * @param {string} phraseSetName * A fully-qualified path representing PhraseSet resource. * @returns {string} A string representing the phrase_set. */ matchPhraseSetFromPhraseSetName(phraseSetName: string) { return this.pathTemplates.phraseSetPathTemplate.match(phraseSetName) .phrase_set; } /** * Return a fully-qualified project resource name string. * * @param {string} project * @returns {string} Resource name string. */ projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); } /** * Parse the project from Project resource. * * @param {string} projectName * A fully-qualified path representing Project resource. * @returns {string} A string representing the project. */ matchProjectFromProjectName(projectName: string) { return this.pathTemplates.projectPathTemplate.match(projectName).project; } /** * Return a fully-qualified recognizer resource name string. * * @param {string} project * @param {string} location * @param {string} recognizer * @returns {string} Resource name string. */ recognizerPath(project: string, location: string, recognizer: string) { return this.pathTemplates.recognizerPathTemplate.render({ project: project, location: location, recognizer: recognizer, }); } /** * Parse the project from Recognizer resource. * * @param {string} recognizerName * A fully-qualified path representing Recognizer resource. * @returns {string} A string representing the project. */ matchProjectFromRecognizerName(recognizerName: string) { return this.pathTemplates.recognizerPathTemplate.match(recognizerName) .project; } /** * Parse the location from Recognizer resource. * * @param {string} recognizerName * A fully-qualified path representing Recognizer resource. * @returns {string} A string representing the location. */ matchLocationFromRecognizerName(recognizerName: string) { return this.pathTemplates.recognizerPathTemplate.match(recognizerName) .location; } /** * Parse the recognizer from Recognizer resource. * * @param {string} recognizerName * A fully-qualified path representing Recognizer resource. * @returns {string} A string representing the recognizer. */ matchRecognizerFromRecognizerName(recognizerName: string) { return this.pathTemplates.recognizerPathTemplate.match(recognizerName) .recognizer; } /** * Terminate the gRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise<void> { if (this.speechStub && !this._terminated) { return this.speechStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); }); } return Promise.resolve(); } } import {ImprovedStreamingClient} from '../helpers'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface SpeechClient extends ImprovedStreamingClient {}
{ "content_hash": "11e56ad2c64309fe3cb2b35cf9436458", "timestamp": "", "source": "github", "line_count": 4379, "max_line_length": 155, "avg_line_length": 39.58323818223339, "alnum_prop": 0.6873280064614763, "repo_name": "googleapis/nodejs-speech", "id": "fb4813a3b966e0b858ec1b1db8360ff4dbb885be", "size": "173335", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/v2/speech_client.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "15492" }, { "name": "Python", "bytes": "1754" }, { "name": "TypeScript", "bytes": "815261" } ] }
var express = require('express'); var router = express.Router(); var multer = require('multer'); var upload = multer({ dest: './uploads/' }); var Meows = require('../modules/meows'); var Kitties = require('../modules/kitties'); router.post('/signin', upload.single('file'), Kitties.signInKitty); router.get('/kitty/:id', Kitties.findKitty); router.get('/kitties', Kitties.findAllKitties); router.get('/crew/add/:id', Kitties.addKittyToCrew); router.get('/crew/remove/:id', Kitties.removeKittyFromCrew); router.get('/meows/:id', Meows.findKittyMeows); router.post('/meows', Meows.addMeow); router.get('/meow/:id', Meows.findMeowById); module.exports = router;
{ "content_hash": "5f34ad4d1afc3cf5a1d9e23d2678a5b9", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 67, "avg_line_length": 30.272727272727273, "alnum_prop": 0.7057057057057057, "repo_name": "mpuica/kitty-talk", "id": "85df7e8751838f7478fb71cbfa815af510a299e5", "size": "696", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/routes/routes.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "575" }, { "name": "HTML", "bytes": "6328" }, { "name": "JavaScript", "bytes": "25229" } ] }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2015 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <string name="app_name">triangle</string> </resources>
{ "content_hash": "699775888c78290f84c3ee828041359d", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 72, "avg_line_length": 38.44444444444444, "alnum_prop": 0.7630057803468208, "repo_name": "google/fplbase", "id": "b47efede6acf35daec4abca59568450241868179", "size": "692", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "samples/triangle/res/values/strings.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "20360" }, { "name": "C++", "bytes": "678418" }, { "name": "CMake", "bytes": "73729" }, { "name": "Java", "bytes": "86612" }, { "name": "Makefile", "bytes": "15018" }, { "name": "Objective-C++", "bytes": "1152" }, { "name": "Python", "bytes": "1803" } ] }
import type { Middleware } from './index' const mediaType = 'application/json' const charset = 'charset=utf-8' export const CONTENT_TYPE_JSON = `${mediaType};${charset}` const isJson = (contentType: string) => contentType === mediaType || contentType.startsWith(`${mediaType};`) const alreadyEncoded = (body: unknown) => typeof body === 'string' /** * Automatically encode your objects into JSON * * Example: * client.User.all({ body: { name: 'bob' } }) * // => body: {"name":"bob"} * // => header: "Content-Type=application/json;charset=utf-8" */ const EncodeJsonMiddleware: Middleware = () => ({ async prepareRequest(next) { const request = await next() try { const body = request.body() const contentType = request.header('content-type') if (body) { const shouldEncodeBody = contentType == null || (typeof contentType === 'string' && isJson(contentType) && !alreadyEncoded(body)) const encodedBody = shouldEncodeBody ? JSON.stringify(body) : body return request.enhance({ headers: { 'content-type': contentType == null ? CONTENT_TYPE_JSON : contentType }, body: encodedBody, }) } } catch (e) {} // eslint-disable-line no-empty return request }, }) export default EncodeJsonMiddleware
{ "content_hash": "9be1faf7c9737dabe28bc89f182eb5f9", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 93, "avg_line_length": 31.38095238095238, "alnum_prop": 0.633535660091047, "repo_name": "tulios/mappersmith", "id": "c018fcd5dc438524d49de1a0b832237ea9c93c8f", "size": "1318", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/middleware/encode-json.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "151844" }, { "name": "Shell", "bytes": "245" }, { "name": "TypeScript", "bytes": "188888" } ] }
<?php class Google_Service_Bigquery_QueryRequest extends Google_Model { protected $defaultDatasetType = 'Google_Service_Bigquery_DatasetReference'; protected $defaultDatasetDataType = ''; public $dryRun; public $kind; public $maxResults; public $preserveNulls; public $query; public $timeoutMs; public $useLegacySql; public $useQueryCache; public function setDefaultDataset(Google_Service_Bigquery_DatasetReference $defaultDataset) { $this->defaultDataset = $defaultDataset; } public function getDefaultDataset() { return $this->defaultDataset; } public function setDryRun($dryRun) { $this->dryRun = $dryRun; } public function getDryRun() { return $this->dryRun; } public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setMaxResults($maxResults) { $this->maxResults = $maxResults; } public function getMaxResults() { return $this->maxResults; } public function setPreserveNulls($preserveNulls) { $this->preserveNulls = $preserveNulls; } public function getPreserveNulls() { return $this->preserveNulls; } public function setQuery($query) { $this->query = $query; } public function getQuery() { return $this->query; } public function setTimeoutMs($timeoutMs) { $this->timeoutMs = $timeoutMs; } public function getTimeoutMs() { return $this->timeoutMs; } public function setUseLegacySql($useLegacySql) { $this->useLegacySql = $useLegacySql; } public function getUseLegacySql() { return $this->useLegacySql; } public function setUseQueryCache($useQueryCache) { $this->useQueryCache = $useQueryCache; } public function getUseQueryCache() { return $this->useQueryCache; } }
{ "content_hash": "c06e9c43199c3a8cdd5a11081d75b32b", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 93, "avg_line_length": 20.674157303370787, "alnum_prop": 0.6842391304347826, "repo_name": "zahoorkhan/google-api-php-client", "id": "4f8eaf493893b6b4871e8e0ef05f0412349a3c7b", "size": "2430", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "vendor/google/apiclient-services/Google/Service/Bigquery/QueryRequest.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "7447749" } ] }
"import logging\nfrom typing import Any\nimport sys\n\nimport click\n\n\nLOG_STRING = click.style(\"(...TRUNCATED)
{"content_hash":"800238d70096ffde94727b1b08453c60","timestamp":"","source":"github","line_count":96,(...TRUNCATED)
End of preview.