googleapis / nodejs-game-servers
1 4
// Copyright 2020 Google LLC
2 4
//
3 4
// Licensed under the Apache License, Version 2.0 (the "License");
4 4
// you may not use this file except in compliance with the License.
5 4
// You may obtain a copy of the License at
6 4
//
7 4
//     https://www.apache.org/licenses/LICENSE-2.0
8 4
//
9 4
// Unless required by applicable law or agreed to in writing, software
10 4
// distributed under the License is distributed on an "AS IS" BASIS,
11 4
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 4
// See the License for the specific language governing permissions and
13 4
// limitations under the License.
14 4
//
15 4
// ** This file is automatically generated by gapic-generator-typescript. **
16 4
// ** https://github.com/googleapis/gapic-generator-typescript **
17 4
// ** All changes to this file may be overwritten. **
18 4

19 4
import * as gax from 'google-gax';
20 4
import {
21 4
  Callback,
22 4
  CallOptions,
23 4
  Descriptors,
24 4
  ClientOptions,
25 4
  LROperation,
26 4
  PaginationCallback,
27 4
  GaxCall,
28 4
} from 'google-gax';
29 4
import * as path from 'path';
30 4

31 4
import {Transform} from 'stream';
32 4
import {RequestType} from 'google-gax/build/src/apitypes';
33 4
import * as protos from '../../protos/protos';
34 4
import * as gapicConfig from './realms_service_client_config.json';
35 4
import {operationsProtos} from 'google-gax';
36 4
const version = require('../../../package.json').version;
37 4

38 4
/**
39 4
 *  A realm is a grouping of game server clusters that are considered
40 4
 *  interchangeable.
41 4
 * @class
42 4
 * @memberof v1beta
43 4
 */
44 4
export class RealmsServiceClient {
45 4
  private _terminated = false;
46 4
  private _opts: ClientOptions;
47 4
  private _gaxModule: typeof gax | typeof gax.fallback;
48 4
  private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
49 4
  private _protos: {};
50 4
  private _defaults: {[method: string]: gax.CallSettings};
51 4
  auth: gax.GoogleAuth;
52 4
  descriptors: Descriptors = {
53 4
    page: {},
54 4
    stream: {},
55 4
    longrunning: {},
56 4
    batching: {},
57 4
  };
58 4
  innerApiCalls: {[name: string]: Function};
59 4
  pathTemplates: {[name: string]: gax.PathTemplate};
60 4
  operationsClient: gax.OperationsClient;
61 4
  realmsServiceStub?: Promise<{[name: string]: Function}>;
62 4

63 4
  /**
64 4
   * Construct an instance of RealmsServiceClient.
65 4
   *
66 4
   * @param {object} [options] - The configuration object. See the subsequent
67 4
   *   parameters for more details.
68 4
   * @param {object} [options.credentials] - Credentials object.
69 4
   * @param {string} [options.credentials.client_email]
70 4
   * @param {string} [options.credentials.private_key]
71 4
   * @param {string} [options.email] - Account email address. Required when
72 4
   *     using a .pem or .p12 keyFilename.
73 4
   * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
74 4
   *     .p12 key downloaded from the Google Developers Console. If you provide
75 4
   *     a path to a JSON file, the projectId option below is not necessary.
76 4
   *     NOTE: .pem and .p12 require you to specify options.email as well.
77 4
   * @param {number} [options.port] - The port on which to connect to
78 4
   *     the remote host.
79 4
   * @param {string} [options.projectId] - The project ID from the Google
80 4
   *     Developer's Console, e.g. 'grape-spaceship-123'. We will also check
81 4
   *     the environment variable GCLOUD_PROJECT for your project ID. If your
82 4
   *     app is running in an environment which supports
83 4
   *     {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
84 4
   *     your project ID will be detected automatically.
85 4
   * @param {string} [options.apiEndpoint] - The domain name of the
86 4
   *     API remote host.
87 4
   */
88 4

89 4
  constructor(opts?: ClientOptions) {
90 4
    // Ensure that options include the service address and port.
91 4
    const staticMembers = this.constructor as typeof RealmsServiceClient;
92 4
    const servicePath =
93 4
      opts && opts.servicePath
94 4
        ? opts.servicePath
95 4
        : opts && opts.apiEndpoint
96 4
        ? opts.apiEndpoint
97 4
        : staticMembers.servicePath;
98 4
    const port = opts && opts.port ? opts.port : staticMembers.port;
99 4

100 4
    if (!opts) {
101 4
      opts = {servicePath, port};
102 4
    }
103 4
    opts.servicePath = opts.servicePath || servicePath;
104 4
    opts.port = opts.port || port;
105 4

106 4
    // users can override the config from client side, like retry codes name.
107 4
    // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546
108 4
    // The way to override client config for Showcase API:
109 4
    //
110 4
    // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}}
111 4
    // const showcaseClient = new showcaseClient({ projectId, customConfig });
112 4
    opts.clientConfig = opts.clientConfig || {};
113 4

114 4
    // If we're running in browser, it's OK to omit `fallback` since
115 4
    // google-gax has `browser` field in its `package.json`.
116 4
    // For Electron (which does not respect `browser` field),
117 4
    // pass `{fallback: true}` to the RealmsServiceClient constructor.
118 4
    this._gaxModule = opts.fallback ? gax.fallback : gax;
119 4

120 4
    // Create a `gaxGrpc` object, with any grpc-specific options
121 4
    // sent to the client.
122 4
    opts.scopes = (this.constructor as typeof RealmsServiceClient).scopes;
123 4
    this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
124 4

125 4
    // Save options to use in initialize() method.
126 4
    this._opts = opts;
127 4

128 4
    // Save the auth object to the client, for use by other methods.
129 4
    this.auth = this._gaxGrpc.auth as gax.GoogleAuth;
130 4

131 4
    // Determine the client header string.
132 4
    const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
133 4
    if (typeof process !== 'undefined' && 'versions' in process) {
134 4
      clientHeader.push(`gl-node/${process.versions.node}`);
135 4
    } else {
136 0
      clientHeader.push(`gl-web/${this._gaxModule.version}`);
137 0
    }
138 4
    if (!opts.fallback) {
139 4
      clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
140 4
    }
141 4
    if (opts.libName && opts.libVersion) {
142 0
      clientHeader.push(`${opts.libName}/${opts.libVersion}`);
143 0
    }
144 4
    // Load the applicable protos.
145 4
    // For Node.js, pass the path to JSON proto file.
146 4
    // For browsers, pass the JSON content.
147 4

148 4
    const nodejsProtoPath = path.join(
149 4
      __dirname,
150 4
      '..',
151 4
      '..',
152 4
      'protos',
153 4
      'protos.json'
154 4
    );
155 4
    this._protos = this._gaxGrpc.loadProto(
156 4
      opts.fallback
157 4
        ? // eslint-disable-next-line @typescript-eslint/no-var-requires
158 4
          require('../../protos/protos.json')
159 4
        : nodejsProtoPath
160 4
    );
161 4

162 4
    // This API contains "path templates"; forward-slash-separated
163 4
    // identifiers to uniquely identify resources within the API.
164 4
    // Create useful helper objects for these.
165 4
    this.pathTemplates = {
166 4
      gameServerClusterPathTemplate: new this._gaxModule.PathTemplate(
167 4
        'projects/{project}/locations/{location}/realms/{realm}/gameServerClusters/{cluster}'
168 4
      ),
169 4
      gameServerConfigPathTemplate: new this._gaxModule.PathTemplate(
170 4
        'projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}'
171 4
      ),
172 4
      gameServerDeploymentPathTemplate: new this._gaxModule.PathTemplate(
173 4
        'projects/{project}/locations/{location}/gameServerDeployments/{deployment}'
174 4
      ),
175 4
      gameServerDeploymentRolloutPathTemplate: new this._gaxModule.PathTemplate(
176 4
        'projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout'
177 4
      ),
178 4
      realmPathTemplate: new this._gaxModule.PathTemplate(
179 4
        'projects/{project}/locations/{location}/realms/{realm}'
180 4
      ),
181 4
    };
182 4

183 4
    // Some of the methods on this service return "paged" results,
184 4
    // (e.g. 50 results at a time, with tokens to get subsequent
185 4
    // pages). Denote the keys used for pagination and results.
186 4
    this.descriptors.page = {
187 4
      listRealms: new this._gaxModule.PageDescriptor(
188 4
        'pageToken',
189 4
        'nextPageToken',
190 4
        'realms'
191 4
      ),
192 4
    };
193 4

194 4
    // This API contains "long-running operations", which return a
195 4
    // an Operation object that allows for tracking of the operation,
196 4
    // rather than holding a request open.
197 4
    const protoFilesRoot = opts.fallback
198 4
      ? this._gaxModule.protobuf.Root.fromJSON(
199 4
          // eslint-disable-next-line @typescript-eslint/no-var-requires
200 4
          require('../../protos/protos.json')
201 4
        )
202 4
      : this._gaxModule.protobuf.loadSync(nodejsProtoPath);
203 4

204 4
    this.operationsClient = this._gaxModule
205 4
      .lro({
206 4
        auth: this.auth,
207 4
        grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
208 4
      })
209 4
      .operationsClient(opts);
210 4
    const createRealmResponse = protoFilesRoot.lookup(
211 4
      '.google.cloud.gaming.v1beta.Realm'
212 4
    ) as gax.protobuf.Type;
213 4
    const createRealmMetadata = protoFilesRoot.lookup(
214 4
      '.google.cloud.gaming.v1beta.OperationMetadata'
215 4
    ) as gax.protobuf.Type;
216 4
    const deleteRealmResponse = protoFilesRoot.lookup(
217 4
      '.google.protobuf.Empty'
218 4
    ) as gax.protobuf.Type;
219 4
    const deleteRealmMetadata = protoFilesRoot.lookup(
220 4
      '.google.cloud.gaming.v1beta.OperationMetadata'
221 4
    ) as gax.protobuf.Type;
222 4
    const updateRealmResponse = protoFilesRoot.lookup(
223 4
      '.google.cloud.gaming.v1beta.Realm'
224 4
    ) as gax.protobuf.Type;
225 4
    const updateRealmMetadata = protoFilesRoot.lookup(
226 4
      '.google.cloud.gaming.v1beta.OperationMetadata'
227 4
    ) as gax.protobuf.Type;
228 4

229 4
    this.descriptors.longrunning = {
230 4
      createRealm: new this._gaxModule.LongrunningDescriptor(
231 4
        this.operationsClient,
232 4
        createRealmResponse.decode.bind(createRealmResponse),
233 4
        createRealmMetadata.decode.bind(createRealmMetadata)
234 4
      ),
235 4
      deleteRealm: new this._gaxModule.LongrunningDescriptor(
236 4
        this.operationsClient,
237 4
        deleteRealmResponse.decode.bind(deleteRealmResponse),
238 4
        deleteRealmMetadata.decode.bind(deleteRealmMetadata)
239 4
      ),
240 4
      updateRealm: new this._gaxModule.LongrunningDescriptor(
241 4
        this.operationsClient,
242 4
        updateRealmResponse.decode.bind(updateRealmResponse),
243 4
        updateRealmMetadata.decode.bind(updateRealmMetadata)
244 4
      ),
245 4
    };
246 4

247 4
    // Put together the default options sent with requests.
248 4
    this._defaults = this._gaxGrpc.constructSettings(
249 4
      'google.cloud.gaming.v1beta.RealmsService',
250 4
      gapicConfig as gax.ClientConfig,
251 4
      opts.clientConfig || {},
252 4
      {'x-goog-api-client': clientHeader.join(' ')}
253 4
    );
254 4

255 4
    // Set up a dictionary of "inner API calls"; the core implementation
256 4
    // of calling the API is handled in `google-gax`, with this code
257 4
    // merely providing the destination and request information.
258 4
    this.innerApiCalls = {};
259 4
  }
260 4

261 4
  /**
262 4
   * Initialize the client.
263 4
   * Performs asynchronous operations (such as authentication) and prepares the client.
264 4
   * This function will be called automatically when any class method is called for the
265 4
   * first time, but if you need to initialize it before calling an actual method,
266 4
   * feel free to call initialize() directly.
267 4
   *
268 4
   * You can await on this method if you want to make sure the client is initialized.
269 4
   *
270 4
   * @returns {Promise} A promise that resolves to an authenticated service stub.
271 4
   */
272 4
  initialize() {
273 4
    // If the client stub promise is already initialized, return immediately.
274 4
    if (this.realmsServiceStub) {
275 4
      return this.realmsServiceStub;
276 4
    }
277 4

278 4
    // Put together the "service stub" for
279 4
    // google.cloud.gaming.v1beta.RealmsService.
280 4
    this.realmsServiceStub = this._gaxGrpc.createStub(
281 4
      this._opts.fallback
282 4
        ? (this._protos as protobuf.Root).lookupService(
283 0
            'google.cloud.gaming.v1beta.RealmsService'
284 4
          )
285 4
        : // eslint-disable-next-line @typescript-eslint/no-explicit-any
286 4
          (this._protos as any).google.cloud.gaming.v1beta.RealmsService,
287 4
      this._opts
288 4
    ) as Promise<{[method: string]: Function}>;
289 4

290 4
    // Iterate over each of the methods that the service provides
291 4
    // and create an API call method for each.
292 4
    const realmsServiceStubMethods = [
293 4
      'listRealms',
294 4
      'getRealm',
295 4
      'createRealm',
296 4
      'deleteRealm',
297 4
      'updateRealm',
298 4
      'previewRealmUpdate',
299 4
    ];
300 4
    for (const methodName of realmsServiceStubMethods) {
301 4
      const callPromise = this.realmsServiceStub.then(
302 4
        stub => (...args: Array<{}>) => {
303 0
          if (this._terminated) {
304 0
            return Promise.reject('The client has already been closed.');
305 0
          }
306 0
          const func = stub[methodName];
307 0
          return func.apply(stub, args);
308 4
        },
309 4
        (err: Error | null | undefined) => () => {
310 0
          throw err;
311 0
        }
312 4
      );
313 4

314 4
      const apiCall = this._gaxModule.createApiCall(
315 4
        callPromise,
316 4
        this._defaults[methodName],
317 4
        this.descriptors.page[methodName] ||
318 4
          this.descriptors.stream[methodName] ||
319 4
          this.descriptors.longrunning[methodName]
320 4
      );
321 4

322 4
      this.innerApiCalls[methodName] = apiCall;
323 4
    }
324 4

325 4
    return this.realmsServiceStub;
326 4
  }
327 4

328 4
  /**
329 4
   * The DNS address for this API service.
330 4
   */
331 4
  static get servicePath() {
332 4
    return 'gameservices.googleapis.com';
333 4
  }
334 4

335 4
  /**
336 4
   * The DNS address for this API service - same as servicePath(),
337 4
   * exists for compatibility reasons.
338 4
   */
339 4
  static get apiEndpoint() {
340 4
    return 'gameservices.googleapis.com';
341 4
  }
342 4

343 4
  /**
344 4
   * The port for this API service.
345 4
   */
346 4
  static get port() {
347 4
    return 443;
348 4
  }
349 4

350 4
  /**
351 4
   * The scopes needed to make gRPC calls for every method defined
352 4
   * in this service.
353 4
   */
354 4
  static get scopes() {
355 4
    return ['https://www.googleapis.com/auth/cloud-platform'];
356 4
  }
357 4

358 4
  getProjectId(): Promise<string>;
359 4
  getProjectId(callback: Callback<string, undefined, undefined>): void;
360 4
  /**
361 4
   * Return the project ID used by this class.
362 4
   * @param {function(Error, string)} callback - the callback to
363 4
   *   be called with the current project Id.
364 4
   */
365 4
  getProjectId(
366 4
    callback?: Callback<string, undefined, undefined>
367 4
  ): Promise<string> | void {
368 4
    if (callback) {
369 4
      this.auth.getProjectId(callback);
370 4
      return;
371 4
    }
372 4
    return this.auth.getProjectId();
373 4
  }
374 4

375 4
  // -------------------
376 4
  // -- Service calls --
377 4
  // -------------------
378 4
  getRealm(
379 4
    request: protos.google.cloud.gaming.v1beta.IGetRealmRequest,
380 4
    options?: gax.CallOptions
381 4
  ): Promise<
382 4
    [
383 4
      protos.google.cloud.gaming.v1beta.IRealm,
384 4
      protos.google.cloud.gaming.v1beta.IGetRealmRequest | undefined,
385 4
      {} | undefined
386 4
    ]
387 4
  >;
388 4
  getRealm(
389 4
    request: protos.google.cloud.gaming.v1beta.IGetRealmRequest,
390 4
    options: gax.CallOptions,
391 4
    callback: Callback<
392 4
      protos.google.cloud.gaming.v1beta.IRealm,
393 4
      protos.google.cloud.gaming.v1beta.IGetRealmRequest | null | undefined,
394 4
      {} | null | undefined
395 4
    >
396 4
  ): void;
397 4
  getRealm(
398 4
    request: protos.google.cloud.gaming.v1beta.IGetRealmRequest,
399 4
    callback: Callback<
400 4
      protos.google.cloud.gaming.v1beta.IRealm,
401 4
      protos.google.cloud.gaming.v1beta.IGetRealmRequest | null | undefined,
402 4
      {} | null | undefined
403 4
    >
404 4
  ): void;
405 4
  /**
406 4
   * Gets details of a single realm.
407 4
   *
408 4
   * @param {Object} request
409 4
   *   The request object that will be sent.
410 4
   * @param {string} request.name
411 4
   *   Required. The name of the realm to retrieve. Uses the form:
412 4
   *   `projects/{project}/locations/{location}/realms/{realm}`.
413 4
   * @param {object} [options]
414 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
415 4
   * @returns {Promise} - The promise which resolves to an array.
416 4
   *   The first element of the array is an object representing [Realm]{@link google.cloud.gaming.v1beta.Realm}.
417 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
418 4
   */
419 4
  getRealm(
420 4
    request: protos.google.cloud.gaming.v1beta.IGetRealmRequest,
421 4
    optionsOrCallback?:
422 4
      | gax.CallOptions
423 4
      | Callback<
424 4
          protos.google.cloud.gaming.v1beta.IRealm,
425 4
          protos.google.cloud.gaming.v1beta.IGetRealmRequest | null | undefined,
426 4
          {} | null | undefined
427 4
        >,
428 4
    callback?: Callback<
429 4
      protos.google.cloud.gaming.v1beta.IRealm,
430 4
      protos.google.cloud.gaming.v1beta.IGetRealmRequest | null | undefined,
431 4
      {} | null | undefined
432 4
    >
433 4
  ): Promise<
434 4
    [
435 4
      protos.google.cloud.gaming.v1beta.IRealm,
436 4
      protos.google.cloud.gaming.v1beta.IGetRealmRequest | undefined,
437 4
      {} | undefined
438 4
    ]
439 4
  > | void {
440 4
    request = request || {};
441 4
    let options: gax.CallOptions;
442 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
443 4
      callback = optionsOrCallback;
444 4
      options = {};
445 4
    } else {
446 4
      options = optionsOrCallback as gax.CallOptions;
447 4
    }
448 4
    options = options || {};
449 4
    options.otherArgs = options.otherArgs || {};
450 4
    options.otherArgs.headers = options.otherArgs.headers || {};
451 4
    options.otherArgs.headers[
452 4
      'x-goog-request-params'
453 4
    ] = gax.routingHeader.fromParams({
454 4
      name: request.name || '',
455 4
    });
456 4
    this.initialize();
457 4
    return this.innerApiCalls.getRealm(request, options, callback);
458 4
  }
459 4
  previewRealmUpdate(
460 4
    request: protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest,
461 4
    options?: gax.CallOptions
462 4
  ): Promise<
463 4
    [
464 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateResponse,
465 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest | undefined,
466 4
      {} | undefined
467 4
    ]
468 4
  >;
469 4
  previewRealmUpdate(
470 4
    request: protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest,
471 4
    options: gax.CallOptions,
472 4
    callback: Callback<
473 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateResponse,
474 4
      | protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest
475 4
      | null
476 4
      | undefined,
477 4
      {} | null | undefined
478 4
    >
479 4
  ): void;
480 4
  previewRealmUpdate(
481 4
    request: protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest,
482 4
    callback: Callback<
483 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateResponse,
484 4
      | protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest
485 4
      | null
486 4
      | undefined,
487 4
      {} | null | undefined
488 4
    >
489 4
  ): void;
490 4
  /**
491 4
   * Previews patches to a single realm.
492 4
   *
493 4
   * @param {Object} request
494 4
   *   The request object that will be sent.
495 4
   * @param {google.cloud.gaming.v1beta.Realm} request.realm
496 4
   *   Required. The realm to be updated.
497 4
   *   Only fields specified in update_mask are updated.
498 4
   * @param {google.protobuf.FieldMask} request.updateMask
499 4
   *   Required. The update mask applies to the resource. For the `FieldMask`
500 4
   *   definition, see
501 4
   *
502 4
   *   https:
503 4
   *   //developers.google.com/protocol-buffers
504 4
   *   // /docs/reference/google.protobuf#fieldmask
505 4
   * @param {google.protobuf.Timestamp} [request.previewTime]
506 4
   *   Optional. The target timestamp to compute the preview.
507 4
   * @param {object} [options]
508 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
509 4
   * @returns {Promise} - The promise which resolves to an array.
510 4
   *   The first element of the array is an object representing [PreviewRealmUpdateResponse]{@link google.cloud.gaming.v1beta.PreviewRealmUpdateResponse}.
511 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
512 4
   */
513 4
  previewRealmUpdate(
514 4
    request: protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest,
515 4
    optionsOrCallback?:
516 4
      | gax.CallOptions
517 4
      | Callback<
518 4
          protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateResponse,
519 4
          | protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest
520 4
          | null
521 4
          | undefined,
522 4
          {} | null | undefined
523 4
        >,
524 4
    callback?: Callback<
525 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateResponse,
526 4
      | protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest
527 4
      | null
528 4
      | undefined,
529 4
      {} | null | undefined
530 4
    >
531 4
  ): Promise<
532 4
    [
533 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateResponse,
534 4
      protos.google.cloud.gaming.v1beta.IPreviewRealmUpdateRequest | undefined,
535 4
      {} | undefined
536 4
    ]
537 4
  > | void {
538 4
    request = request || {};
539 4
    let options: gax.CallOptions;
540 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
541 4
      callback = optionsOrCallback;
542 4
      options = {};
543 4
    } else {
544 4
      options = optionsOrCallback as gax.CallOptions;
545 4
    }
546 4
    options = options || {};
547 4
    options.otherArgs = options.otherArgs || {};
548 4
    options.otherArgs.headers = options.otherArgs.headers || {};
549 4
    options.otherArgs.headers[
550 4
      'x-goog-request-params'
551 4
    ] = gax.routingHeader.fromParams({
552 4
      'realm.name': request.realm!.name || '',
553 4
    });
554 4
    this.initialize();
555 4
    return this.innerApiCalls.previewRealmUpdate(request, options, callback);
556 4
  }
557 4

558 4
  createRealm(
559 4
    request: protos.google.cloud.gaming.v1beta.ICreateRealmRequest,
560 4
    options?: gax.CallOptions
561 4
  ): Promise<
562 4
    [
563 4
      LROperation<
564 4
        protos.google.cloud.gaming.v1beta.IRealm,
565 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
566 4
      >,
567 4
      protos.google.longrunning.IOperation | undefined,
568 4
      {} | undefined
569 4
    ]
570 4
  >;
571 4
  createRealm(
572 4
    request: protos.google.cloud.gaming.v1beta.ICreateRealmRequest,
573 4
    options: gax.CallOptions,
574 4
    callback: Callback<
575 4
      LROperation<
576 4
        protos.google.cloud.gaming.v1beta.IRealm,
577 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
578 4
      >,
579 4
      protos.google.longrunning.IOperation | null | undefined,
580 4
      {} | null | undefined
581 4
    >
582 4
  ): void;
583 4
  createRealm(
584 4
    request: protos.google.cloud.gaming.v1beta.ICreateRealmRequest,
585 4
    callback: Callback<
586 4
      LROperation<
587 4
        protos.google.cloud.gaming.v1beta.IRealm,
588 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
589 4
      >,
590 4
      protos.google.longrunning.IOperation | null | undefined,
591 4
      {} | null | undefined
592 4
    >
593 4
  ): void;
594 4
  /**
595 4
   * Creates a new realm in a given project and location.
596 4
   *
597 4
   * @param {Object} request
598 4
   *   The request object that will be sent.
599 4
   * @param {string} request.parent
600 4
   *   Required. The parent resource name. Uses the form:
601 4
   *   `projects/{project}/locations/{location}`.
602 4
   * @param {string} request.realmId
603 4
   *   Required. The ID of the realm resource to be created.
604 4
   * @param {google.cloud.gaming.v1beta.Realm} request.realm
605 4
   *   Required. The realm resource to be created.
606 4
   * @param {object} [options]
607 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
608 4
   * @returns {Promise} - The promise which resolves to an array.
609 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
610 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
611 4
   */
612 4
  createRealm(
613 4
    request: protos.google.cloud.gaming.v1beta.ICreateRealmRequest,
614 4
    optionsOrCallback?:
615 4
      | gax.CallOptions
616 4
      | Callback<
617 4
          LROperation<
618 4
            protos.google.cloud.gaming.v1beta.IRealm,
619 4
            protos.google.cloud.gaming.v1beta.IOperationMetadata
620 4
          >,
621 4
          protos.google.longrunning.IOperation | null | undefined,
622 4
          {} | null | undefined
623 4
        >,
624 4
    callback?: Callback<
625 4
      LROperation<
626 4
        protos.google.cloud.gaming.v1beta.IRealm,
627 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
628 4
      >,
629 4
      protos.google.longrunning.IOperation | null | undefined,
630 4
      {} | null | undefined
631 4
    >
632 4
  ): Promise<
633 4
    [
634 4
      LROperation<
635 4
        protos.google.cloud.gaming.v1beta.IRealm,
636 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
637 4
      >,
638 4
      protos.google.longrunning.IOperation | undefined,
639 4
      {} | undefined
640 4
    ]
641 4
  > | void {
642 4
    request = request || {};
643 4
    let options: gax.CallOptions;
644 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
645 4
      callback = optionsOrCallback;
646 4
      options = {};
647 4
    } else {
648 4
      options = optionsOrCallback as gax.CallOptions;
649 4
    }
650 4
    options = options || {};
651 4
    options.otherArgs = options.otherArgs || {};
652 4
    options.otherArgs.headers = options.otherArgs.headers || {};
653 4
    options.otherArgs.headers[
654 4
      'x-goog-request-params'
655 4
    ] = gax.routingHeader.fromParams({
656 4
      parent: request.parent || '',
657 4
    });
658 4
    this.initialize();
659 4
    return this.innerApiCalls.createRealm(request, options, callback);
660 4
  }
661 4
  /**
662 4
   * Check the status of the long running operation returned by the createRealm() method.
663 4
   * @param {String} name
664 4
   *   The operation name that will be passed.
665 4
   * @returns {Promise} - The promise which resolves to an object.
666 4
   *   The decoded operation object has result and metadata field to get information from.
667 4
   *
668 4
   * @example:
669 4
   *   const decodedOperation = await checkCreateRealmProgress(name);
670 4
   *   console.log(decodedOperation.result);
671 4
   *   console.log(decodedOperation.done);
672 4
   *   console.log(decodedOperation.metadata);
673 4
   *
674 4
   */
675 4
  async checkCreateRealmProgress(
676 4
    name: string
677 4
  ): Promise<
678 4
    LROperation<
679 4
      protos.google.cloud.gaming.v1beta.Realm,
680 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
681 4
    >
682 4
  > {
683 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
684 4
      {name}
685 4
    );
686 4
    const [operation] = await this.operationsClient.getOperation(request);
687 4
    const decodeOperation = new gax.Operation(
688 4
      operation,
689 4
      this.descriptors.longrunning.createRealm,
690 4
      gax.createDefaultBackoffSettings()
691 4
    );
692 4
    return decodeOperation as LROperation<
693 4
      protos.google.cloud.gaming.v1beta.Realm,
694 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
695 4
    >;
696 1
  }
697 4
  deleteRealm(
698 4
    request: protos.google.cloud.gaming.v1beta.IDeleteRealmRequest,
699 4
    options?: gax.CallOptions
700 4
  ): Promise<
701 4
    [
702 4
      LROperation<
703 4
        protos.google.protobuf.IEmpty,
704 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
705 4
      >,
706 4
      protos.google.longrunning.IOperation | undefined,
707 4
      {} | undefined
708 4
    ]
709 4
  >;
710 4
  deleteRealm(
711 4
    request: protos.google.cloud.gaming.v1beta.IDeleteRealmRequest,
712 4
    options: gax.CallOptions,
713 4
    callback: Callback<
714 4
      LROperation<
715 4
        protos.google.protobuf.IEmpty,
716 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
717 4
      >,
718 4
      protos.google.longrunning.IOperation | null | undefined,
719 4
      {} | null | undefined
720 4
    >
721 4
  ): void;
722 4
  deleteRealm(
723 4
    request: protos.google.cloud.gaming.v1beta.IDeleteRealmRequest,
724 4
    callback: Callback<
725 4
      LROperation<
726 4
        protos.google.protobuf.IEmpty,
727 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
728 4
      >,
729 4
      protos.google.longrunning.IOperation | null | undefined,
730 4
      {} | null | undefined
731 4
    >
732 4
  ): void;
733 4
  /**
734 4
   * Deletes a single realm.
735 4
   *
736 4
   * @param {Object} request
737 4
   *   The request object that will be sent.
738 4
   * @param {string} request.name
739 4
   *   Required. The name of the realm to delete. Uses the form:
740 4
   *   `projects/{project}/locations/{location}/realms/{realm}`.
741 4
   * @param {object} [options]
742 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
743 4
   * @returns {Promise} - The promise which resolves to an array.
744 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
745 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
746 4
   */
747 4
  deleteRealm(
748 4
    request: protos.google.cloud.gaming.v1beta.IDeleteRealmRequest,
749 4
    optionsOrCallback?:
750 4
      | gax.CallOptions
751 4
      | Callback<
752 4
          LROperation<
753 4
            protos.google.protobuf.IEmpty,
754 4
            protos.google.cloud.gaming.v1beta.IOperationMetadata
755 4
          >,
756 4
          protos.google.longrunning.IOperation | null | undefined,
757 4
          {} | null | undefined
758 4
        >,
759 4
    callback?: Callback<
760 4
      LROperation<
761 4
        protos.google.protobuf.IEmpty,
762 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
763 4
      >,
764 4
      protos.google.longrunning.IOperation | null | undefined,
765 4
      {} | null | undefined
766 4
    >
767 4
  ): Promise<
768 4
    [
769 4
      LROperation<
770 4
        protos.google.protobuf.IEmpty,
771 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
772 4
      >,
773 4
      protos.google.longrunning.IOperation | undefined,
774 4
      {} | undefined
775 4
    ]
776 4
  > | void {
777 4
    request = request || {};
778 4
    let options: gax.CallOptions;
779 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
780 4
      callback = optionsOrCallback;
781 4
      options = {};
782 4
    } else {
783 4
      options = optionsOrCallback as gax.CallOptions;
784 4
    }
785 4
    options = options || {};
786 4
    options.otherArgs = options.otherArgs || {};
787 4
    options.otherArgs.headers = options.otherArgs.headers || {};
788 4
    options.otherArgs.headers[
789 4
      'x-goog-request-params'
790 4
    ] = gax.routingHeader.fromParams({
791 4
      name: request.name || '',
792 4
    });
793 4
    this.initialize();
794 4
    return this.innerApiCalls.deleteRealm(request, options, callback);
795 4
  }
796 4
  /**
797 4
   * Check the status of the long running operation returned by the deleteRealm() method.
798 4
   * @param {String} name
799 4
   *   The operation name that will be passed.
800 4
   * @returns {Promise} - The promise which resolves to an object.
801 4
   *   The decoded operation object has result and metadata field to get information from.
802 4
   *
803 4
   * @example:
804 4
   *   const decodedOperation = await checkDeleteRealmProgress(name);
805 4
   *   console.log(decodedOperation.result);
806 4
   *   console.log(decodedOperation.done);
807 4
   *   console.log(decodedOperation.metadata);
808 4
   *
809 4
   */
810 4
  async checkDeleteRealmProgress(
811 4
    name: string
812 4
  ): Promise<
813 4
    LROperation<
814 4
      protos.google.protobuf.Empty,
815 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
816 4
    >
817 4
  > {
818 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
819 4
      {name}
820 4
    );
821 4
    const [operation] = await this.operationsClient.getOperation(request);
822 4
    const decodeOperation = new gax.Operation(
823 4
      operation,
824 4
      this.descriptors.longrunning.deleteRealm,
825 4
      gax.createDefaultBackoffSettings()
826 4
    );
827 4
    return decodeOperation as LROperation<
828 4
      protos.google.protobuf.Empty,
829 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
830 4
    >;
831 1
  }
832 4
  updateRealm(
833 4
    request: protos.google.cloud.gaming.v1beta.IUpdateRealmRequest,
834 4
    options?: gax.CallOptions
835 4
  ): Promise<
836 4
    [
837 4
      LROperation<
838 4
        protos.google.cloud.gaming.v1beta.IRealm,
839 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
840 4
      >,
841 4
      protos.google.longrunning.IOperation | undefined,
842 4
      {} | undefined
843 4
    ]
844 4
  >;
845 4
  updateRealm(
846 4
    request: protos.google.cloud.gaming.v1beta.IUpdateRealmRequest,
847 4
    options: gax.CallOptions,
848 4
    callback: Callback<
849 4
      LROperation<
850 4
        protos.google.cloud.gaming.v1beta.IRealm,
851 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
852 4
      >,
853 4
      protos.google.longrunning.IOperation | null | undefined,
854 4
      {} | null | undefined
855 4
    >
856 4
  ): void;
857 4
  updateRealm(
858 4
    request: protos.google.cloud.gaming.v1beta.IUpdateRealmRequest,
859 4
    callback: Callback<
860 4
      LROperation<
861 4
        protos.google.cloud.gaming.v1beta.IRealm,
862 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
863 4
      >,
864 4
      protos.google.longrunning.IOperation | null | undefined,
865 4
      {} | null | undefined
866 4
    >
867 4
  ): void;
868 4
  /**
869 4
   * Patches a single realm.
870 4
   *
871 4
   * @param {Object} request
872 4
   *   The request object that will be sent.
873 4
   * @param {google.cloud.gaming.v1beta.Realm} request.realm
874 4
   *   Required. The realm to be updated.
875 4
   *   Only fields specified in update_mask are updated.
876 4
   * @param {google.protobuf.FieldMask} request.updateMask
877 4
   *   Required. The update mask applies to the resource. For the `FieldMask`
878 4
   *   definition, see
879 4
   *
880 4
   *   https:
881 4
   *   //developers.google.com/protocol-buffers
882 4
   *   // /docs/reference/google.protobuf#fieldmask
883 4
   * @param {object} [options]
884 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
885 4
   * @returns {Promise} - The promise which resolves to an array.
886 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
887 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
888 4
   */
889 4
  updateRealm(
890 4
    request: protos.google.cloud.gaming.v1beta.IUpdateRealmRequest,
891 4
    optionsOrCallback?:
892 4
      | gax.CallOptions
893 4
      | Callback<
894 4
          LROperation<
895 4
            protos.google.cloud.gaming.v1beta.IRealm,
896 4
            protos.google.cloud.gaming.v1beta.IOperationMetadata
897 4
          >,
898 4
          protos.google.longrunning.IOperation | null | undefined,
899 4
          {} | null | undefined
900 4
        >,
901 4
    callback?: Callback<
902 4
      LROperation<
903 4
        protos.google.cloud.gaming.v1beta.IRealm,
904 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
905 4
      >,
906 4
      protos.google.longrunning.IOperation | null | undefined,
907 4
      {} | null | undefined
908 4
    >
909 4
  ): Promise<
910 4
    [
911 4
      LROperation<
912 4
        protos.google.cloud.gaming.v1beta.IRealm,
913 4
        protos.google.cloud.gaming.v1beta.IOperationMetadata
914 4
      >,
915 4
      protos.google.longrunning.IOperation | undefined,
916 4
      {} | undefined
917 4
    ]
918 4
  > | void {
919 4
    request = request || {};
920 4
    let options: gax.CallOptions;
921 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
922 4
      callback = optionsOrCallback;
923 4
      options = {};
924 4
    } else {
925 4
      options = optionsOrCallback as gax.CallOptions;
926 4
    }
927 4
    options = options || {};
928 4
    options.otherArgs = options.otherArgs || {};
929 4
    options.otherArgs.headers = options.otherArgs.headers || {};
930 4
    options.otherArgs.headers[
931 4
      'x-goog-request-params'
932 4
    ] = gax.routingHeader.fromParams({
933 4
      'realm.name': request.realm!.name || '',
934 4
    });
935 4
    this.initialize();
936 4
    return this.innerApiCalls.updateRealm(request, options, callback);
937 4
  }
938 4
  /**
939 4
   * Check the status of the long running operation returned by the updateRealm() method.
940 4
   * @param {String} name
941 4
   *   The operation name that will be passed.
942 4
   * @returns {Promise} - The promise which resolves to an object.
943 4
   *   The decoded operation object has result and metadata field to get information from.
944 4
   *
945 4
   * @example:
946 4
   *   const decodedOperation = await checkUpdateRealmProgress(name);
947 4
   *   console.log(decodedOperation.result);
948 4
   *   console.log(decodedOperation.done);
949 4
   *   console.log(decodedOperation.metadata);
950 4
   *
951 4
   */
952 4
  async checkUpdateRealmProgress(
953 4
    name: string
954 4
  ): Promise<
955 4
    LROperation<
956 4
      protos.google.cloud.gaming.v1beta.Realm,
957 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
958 4
    >
959 4
  > {
960 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
961 4
      {name}
962 4
    );
963 4
    const [operation] = await this.operationsClient.getOperation(request);
964 4
    const decodeOperation = new gax.Operation(
965 4
      operation,
966 4
      this.descriptors.longrunning.updateRealm,
967 4
      gax.createDefaultBackoffSettings()
968 4
    );
969 4
    return decodeOperation as LROperation<
970 4
      protos.google.cloud.gaming.v1beta.Realm,
971 4
      protos.google.cloud.gaming.v1beta.OperationMetadata
972 4
    >;
973 1
  }
974 4
  listRealms(
975 4
    request: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
976 4
    options?: gax.CallOptions
977 4
  ): Promise<
978 4
    [
979 4
      protos.google.cloud.gaming.v1beta.IRealm[],
980 4
      protos.google.cloud.gaming.v1beta.IListRealmsRequest | null,
981 4
      protos.google.cloud.gaming.v1beta.IListRealmsResponse
982 4
    ]
983 4
  >;
984 4
  listRealms(
985 4
    request: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
986 4
    options: gax.CallOptions,
987 4
    callback: PaginationCallback<
988 4
      protos.google.cloud.gaming.v1beta.IListRealmsRequest,
989 4
      protos.google.cloud.gaming.v1beta.IListRealmsResponse | null | undefined,
990 4
      protos.google.cloud.gaming.v1beta.IRealm
991 4
    >
992 4
  ): void;
993 4
  listRealms(
994 4
    request: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
995 4
    callback: PaginationCallback<
996 4
      protos.google.cloud.gaming.v1beta.IListRealmsRequest,
997 4
      protos.google.cloud.gaming.v1beta.IListRealmsResponse | null | undefined,
998 4
      protos.google.cloud.gaming.v1beta.IRealm
999 4
    >
1000 4
  ): void;
1001 4
  /**
1002 4
   * Lists realms in a given project and location.
1003 4
   *
1004 4
   * @param {Object} request
1005 4
   *   The request object that will be sent.
1006 4
   * @param {string} request.parent
1007 4
   *   Required. The parent resource name. Uses the form:
1008 4
   *   `projects/{project}/locations/{location}`.
1009 4
   * @param {number} [request.pageSize]
1010 4
   *   Optional. The maximum number of items to return.  If unspecified, server
1011 4
   *   will pick an appropriate default. Server may return fewer items than
1012 4
   *   requested. A caller should only rely on response's
1013 4
   *   {@link google.cloud.gaming.v1beta.ListRealmsResponse.next_page_token|next_page_token} to
1014 4
   *   determine if there are more realms left to be queried.
1015 4
   * @param {string} [request.pageToken]
1016 4
   *   Optional. The next_page_token value returned from a previous List request,
1017 4
   *   if any.
1018 4
   * @param {string} [request.filter]
1019 4
   *   Optional. The filter to apply to list results.
1020 4
   * @param {string} [request.orderBy]
1021 4
   *   Optional. Specifies the ordering of results following syntax at
1022 4
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1023 4
   * @param {object} [options]
1024 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1025 4
   * @returns {Promise} - The promise which resolves to an array.
1026 4
   *   The first element of the array is Array of [Realm]{@link google.cloud.gaming.v1beta.Realm}.
1027 4
   *   The client library support auto-pagination by default: it will call the API as many
1028 4
   *   times as needed and will merge results from all the pages into this array.
1029 4
   *
1030 4
   *   When autoPaginate: false is specified through options, the array has three elements.
1031 4
   *   The first element is Array of [Realm]{@link google.cloud.gaming.v1beta.Realm} that corresponds to
1032 4
   *   the one page received from the API server.
1033 4
   *   If the second element is not null it contains the request object of type [ListRealmsRequest]{@link google.cloud.gaming.v1beta.ListRealmsRequest}
1034 4
   *   that can be used to obtain the next page of the results.
1035 4
   *   If it is null, the next page does not exist.
1036 4
   *   The third element contains the raw response received from the API server. Its type is
1037 4
   *   [ListRealmsResponse]{@link google.cloud.gaming.v1beta.ListRealmsResponse}.
1038 4
   *
1039 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1040 4
   */
1041 4
  listRealms(
1042 4
    request: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1043 4
    optionsOrCallback?:
1044 4
      | gax.CallOptions
1045 4
      | PaginationCallback<
1046 4
          protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1047 4
          | protos.google.cloud.gaming.v1beta.IListRealmsResponse
1048 4
          | null
1049 4
          | undefined,
1050 4
          protos.google.cloud.gaming.v1beta.IRealm
1051 4
        >,
1052 4
    callback?: PaginationCallback<
1053 4
      protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1054 4
      protos.google.cloud.gaming.v1beta.IListRealmsResponse | null | undefined,
1055 4
      protos.google.cloud.gaming.v1beta.IRealm
1056 4
    >
1057 4
  ): Promise<
1058 4
    [
1059 4
      protos.google.cloud.gaming.v1beta.IRealm[],
1060 4
      protos.google.cloud.gaming.v1beta.IListRealmsRequest | null,
1061 4
      protos.google.cloud.gaming.v1beta.IListRealmsResponse
1062 4
    ]
1063 4
  > | void {
1064 4
    request = request || {};
1065 4
    let options: gax.CallOptions;
1066 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1067 4
      callback = optionsOrCallback;
1068 4
      options = {};
1069 4
    } else {
1070 4
      options = optionsOrCallback as gax.CallOptions;
1071 4
    }
1072 4
    options = options || {};
1073 4
    options.otherArgs = options.otherArgs || {};
1074 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1075 4
    options.otherArgs.headers[
1076 4
      'x-goog-request-params'
1077 4
    ] = gax.routingHeader.fromParams({
1078 4
      parent: request.parent || '',
1079 4
    });
1080 4
    this.initialize();
1081 4
    return this.innerApiCalls.listRealms(request, options, callback);
1082 4
  }
1083 4

1084 4
  /**
1085 4
   * Equivalent to {@link listRealms}, but returns a NodeJS Stream object.
1086 4
   *
1087 4
   * This fetches the paged responses for {@link listRealms} continuously
1088 4
   * and invokes the callback registered for 'data' event for each element in the
1089 4
   * responses.
1090 4
   *
1091 4
   * The returned object has 'end' method when no more elements are required.
1092 4
   *
1093 4
   * autoPaginate option will be ignored.
1094 4
   *
1095 4
   * @see {@link https://nodejs.org/api/stream.html}
1096 4
   *
1097 4
   * @param {Object} request
1098 4
   *   The request object that will be sent.
1099 4
   * @param {string} request.parent
1100 4
   *   Required. The parent resource name. Uses the form:
1101 4
   *   `projects/{project}/locations/{location}`.
1102 4
   * @param {number} [request.pageSize]
1103 4
   *   Optional. The maximum number of items to return.  If unspecified, server
1104 4
   *   will pick an appropriate default. Server may return fewer items than
1105 4
   *   requested. A caller should only rely on response's
1106 4
   *   {@link google.cloud.gaming.v1beta.ListRealmsResponse.next_page_token|next_page_token} to
1107 4
   *   determine if there are more realms left to be queried.
1108 4
   * @param {string} [request.pageToken]
1109 4
   *   Optional. The next_page_token value returned from a previous List request,
1110 4
   *   if any.
1111 4
   * @param {string} [request.filter]
1112 4
   *   Optional. The filter to apply to list results.
1113 4
   * @param {string} [request.orderBy]
1114 4
   *   Optional. Specifies the ordering of results following syntax at
1115 4
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1116 4
   * @param {object} [options]
1117 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1118 4
   * @returns {Stream}
1119 4
   *   An object stream which emits an object representing [Realm]{@link google.cloud.gaming.v1beta.Realm} on 'data' event.
1120 4
   */
1121 4
  listRealmsStream(
1122 4
    request?: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1123 4
    options?: gax.CallOptions
1124 4
  ): Transform {
1125 4
    request = request || {};
1126 4
    options = options || {};
1127 4
    options.otherArgs = options.otherArgs || {};
1128 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1129 4
    options.otherArgs.headers[
1130 4
      'x-goog-request-params'
1131 4
    ] = gax.routingHeader.fromParams({
1132 4
      parent: request.parent || '',
1133 4
    });
1134 4
    const callSettings = new gax.CallSettings(options);
1135 4
    this.initialize();
1136 4
    return this.descriptors.page.listRealms.createStream(
1137 4
      this.innerApiCalls.listRealms as gax.GaxCall,
1138 4
      request,
1139 4
      callSettings
1140 4
    );
1141 4
  }
1142 4

1143 4
  /**
1144 4
   * Equivalent to {@link listRealms}, but returns an iterable object.
1145 4
   *
1146 4
   * for-await-of syntax is used with the iterable to recursively get response element on-demand.
1147 4
   *
1148 4
   * @param {Object} request
1149 4
   *   The request object that will be sent.
1150 4
   * @param {string} request.parent
1151 4
   *   Required. The parent resource name. Uses the form:
1152 4
   *   `projects/{project}/locations/{location}`.
1153 4
   * @param {number} [request.pageSize]
1154 4
   *   Optional. The maximum number of items to return.  If unspecified, server
1155 4
   *   will pick an appropriate default. Server may return fewer items than
1156 4
   *   requested. A caller should only rely on response's
1157 4
   *   {@link google.cloud.gaming.v1beta.ListRealmsResponse.next_page_token|next_page_token} to
1158 4
   *   determine if there are more realms left to be queried.
1159 4
   * @param {string} [request.pageToken]
1160 4
   *   Optional. The next_page_token value returned from a previous List request,
1161 4
   *   if any.
1162 4
   * @param {string} [request.filter]
1163 4
   *   Optional. The filter to apply to list results.
1164 4
   * @param {string} [request.orderBy]
1165 4
   *   Optional. Specifies the ordering of results following syntax at
1166 4
   *   https://cloud.google.com/apis/design/design_patterns#sorting_order.
1167 4
   * @param {object} [options]
1168 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1169 4
   * @returns {Object}
1170 4
   *   An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
1171 4
   */
1172 4
  listRealmsAsync(
1173 4
    request?: protos.google.cloud.gaming.v1beta.IListRealmsRequest,
1174 4
    options?: gax.CallOptions
1175 4
  ): AsyncIterable<protos.google.cloud.gaming.v1beta.IRealm> {
1176 4
    request = request || {};
1177 4
    options = options || {};
1178 4
    options.otherArgs = options.otherArgs || {};
1179 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1180 4
    options.otherArgs.headers[
1181 4
      'x-goog-request-params'
1182 4
    ] = gax.routingHeader.fromParams({
1183 4
      parent: request.parent || '',
1184 4
    });
1185 4
    options = options || {};
1186 4
    const callSettings = new gax.CallSettings(options);
1187 4
    this.initialize();
1188 4
    return this.descriptors.page.listRealms.asyncIterate(
1189 4
      this.innerApiCalls['listRealms'] as GaxCall,
1190 4
      (request as unknown) as RequestType,
1191 4
      callSettings
1192 4
    ) as AsyncIterable<protos.google.cloud.gaming.v1beta.IRealm>;
1193 4
  }
1194 4
  // --------------------
1195 4
  // -- Path templates --
1196 4
  // --------------------
1197 4

1198 4
  /**
1199 4
   * Return a fully-qualified gameServerCluster resource name string.
1200 4
   *
1201 4
   * @param {string} project
1202 4
   * @param {string} location
1203 4
   * @param {string} realm
1204 4
   * @param {string} cluster
1205 4
   * @returns {string} Resource name string.
1206 4
   */
1207 4
  gameServerClusterPath(
1208 4
    project: string,
1209 4
    location: string,
1210 4
    realm: string,
1211 4
    cluster: string
1212 4
  ) {
1213 4
    return this.pathTemplates.gameServerClusterPathTemplate.render({
1214 4
      project: project,
1215 4
      location: location,
1216 4
      realm: realm,
1217 4
      cluster: cluster,
1218 4
    });
1219 4
  }
1220 4

1221 4
  /**
1222 4
   * Parse the project from GameServerCluster resource.
1223 4
   *
1224 4
   * @param {string} gameServerClusterName
1225 4
   *   A fully-qualified path representing GameServerCluster resource.
1226 4
   * @returns {string} A string representing the project.
1227 4
   */
1228 4
  matchProjectFromGameServerClusterName(gameServerClusterName: string) {
1229 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1230 4
      gameServerClusterName
1231 4
    ).project;
1232 4
  }
1233 4

1234 4
  /**
1235 4
   * Parse the location from GameServerCluster resource.
1236 4
   *
1237 4
   * @param {string} gameServerClusterName
1238 4
   *   A fully-qualified path representing GameServerCluster resource.
1239 4
   * @returns {string} A string representing the location.
1240 4
   */
1241 4
  matchLocationFromGameServerClusterName(gameServerClusterName: string) {
1242 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1243 4
      gameServerClusterName
1244 4
    ).location;
1245 4
  }
1246 4

1247 4
  /**
1248 4
   * Parse the realm from GameServerCluster resource.
1249 4
   *
1250 4
   * @param {string} gameServerClusterName
1251 4
   *   A fully-qualified path representing GameServerCluster resource.
1252 4
   * @returns {string} A string representing the realm.
1253 4
   */
1254 4
  matchRealmFromGameServerClusterName(gameServerClusterName: string) {
1255 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1256 4
      gameServerClusterName
1257 4
    ).realm;
1258 4
  }
1259 4

1260 4
  /**
1261 4
   * Parse the cluster from GameServerCluster resource.
1262 4
   *
1263 4
   * @param {string} gameServerClusterName
1264 4
   *   A fully-qualified path representing GameServerCluster resource.
1265 4
   * @returns {string} A string representing the cluster.
1266 4
   */
1267 4
  matchClusterFromGameServerClusterName(gameServerClusterName: string) {
1268 4
    return this.pathTemplates.gameServerClusterPathTemplate.match(
1269 4
      gameServerClusterName
1270 4
    ).cluster;
1271 4
  }
1272 4

1273 4
  /**
1274 4
   * Return a fully-qualified gameServerConfig resource name string.
1275 4
   *
1276 4
   * @param {string} project
1277 4
   * @param {string} location
1278 4
   * @param {string} deployment
1279 4
   * @param {string} config
1280 4
   * @returns {string} Resource name string.
1281 4
   */
1282 4
  gameServerConfigPath(
1283 4
    project: string,
1284 4
    location: string,
1285 4
    deployment: string,
1286 4
    config: string
1287 4
  ) {
1288 4
    return this.pathTemplates.gameServerConfigPathTemplate.render({
1289 4
      project: project,
1290 4
      location: location,
1291 4
      deployment: deployment,
1292 4
      config: config,
1293 4
    });
1294 4
  }
1295 4

1296 4
  /**
1297 4
   * Parse the project from GameServerConfig resource.
1298 4
   *
1299 4
   * @param {string} gameServerConfigName
1300 4
   *   A fully-qualified path representing GameServerConfig resource.
1301 4
   * @returns {string} A string representing the project.
1302 4
   */
1303 4
  matchProjectFromGameServerConfigName(gameServerConfigName: string) {
1304 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1305 4
      gameServerConfigName
1306 4
    ).project;
1307 4
  }
1308 4

1309 4
  /**
1310 4
   * Parse the location from GameServerConfig resource.
1311 4
   *
1312 4
   * @param {string} gameServerConfigName
1313 4
   *   A fully-qualified path representing GameServerConfig resource.
1314 4
   * @returns {string} A string representing the location.
1315 4
   */
1316 4
  matchLocationFromGameServerConfigName(gameServerConfigName: string) {
1317 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1318 4
      gameServerConfigName
1319 4
    ).location;
1320 4
  }
1321 4

1322 4
  /**
1323 4
   * Parse the deployment from GameServerConfig resource.
1324 4
   *
1325 4
   * @param {string} gameServerConfigName
1326 4
   *   A fully-qualified path representing GameServerConfig resource.
1327 4
   * @returns {string} A string representing the deployment.
1328 4
   */
1329 4
  matchDeploymentFromGameServerConfigName(gameServerConfigName: string) {
1330 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1331 4
      gameServerConfigName
1332 4
    ).deployment;
1333 4
  }
1334 4

1335 4
  /**
1336 4
   * Parse the config from GameServerConfig resource.
1337 4
   *
1338 4
   * @param {string} gameServerConfigName
1339 4
   *   A fully-qualified path representing GameServerConfig resource.
1340 4
   * @returns {string} A string representing the config.
1341 4
   */
1342 4
  matchConfigFromGameServerConfigName(gameServerConfigName: string) {
1343 4
    return this.pathTemplates.gameServerConfigPathTemplate.match(
1344 4
      gameServerConfigName
1345 4
    ).config;
1346 4
  }
1347 4

1348 4
  /**
1349 4
   * Return a fully-qualified gameServerDeployment resource name string.
1350 4
   *
1351 4
   * @param {string} project
1352 4
   * @param {string} location
1353 4
   * @param {string} deployment
1354 4
   * @returns {string} Resource name string.
1355 4
   */
1356 4
  gameServerDeploymentPath(
1357 4
    project: string,
1358 4
    location: string,
1359 4
    deployment: string
1360 4
  ) {
1361 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.render({
1362 4
      project: project,
1363 4
      location: location,
1364 4
      deployment: deployment,
1365 4
    });
1366 4
  }
1367 4

1368 4
  /**
1369 4
   * Parse the project from GameServerDeployment resource.
1370 4
   *
1371 4
   * @param {string} gameServerDeploymentName
1372 4
   *   A fully-qualified path representing GameServerDeployment resource.
1373 4
   * @returns {string} A string representing the project.
1374 4
   */
1375 4
  matchProjectFromGameServerDeploymentName(gameServerDeploymentName: string) {
1376 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1377 4
      gameServerDeploymentName
1378 4
    ).project;
1379 4
  }
1380 4

1381 4
  /**
1382 4
   * Parse the location from GameServerDeployment resource.
1383 4
   *
1384 4
   * @param {string} gameServerDeploymentName
1385 4
   *   A fully-qualified path representing GameServerDeployment resource.
1386 4
   * @returns {string} A string representing the location.
1387 4
   */
1388 4
  matchLocationFromGameServerDeploymentName(gameServerDeploymentName: string) {
1389 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1390 4
      gameServerDeploymentName
1391 4
    ).location;
1392 4
  }
1393 4

1394 4
  /**
1395 4
   * Parse the deployment from GameServerDeployment resource.
1396 4
   *
1397 4
   * @param {string} gameServerDeploymentName
1398 4
   *   A fully-qualified path representing GameServerDeployment resource.
1399 4
   * @returns {string} A string representing the deployment.
1400 4
   */
1401 4
  matchDeploymentFromGameServerDeploymentName(
1402 4
    gameServerDeploymentName: string
1403 4
  ) {
1404 4
    return this.pathTemplates.gameServerDeploymentPathTemplate.match(
1405 4
      gameServerDeploymentName
1406 4
    ).deployment;
1407 4
  }
1408 4

1409 4
  /**
1410 4
   * Return a fully-qualified gameServerDeploymentRollout resource name string.
1411 4
   *
1412 4
   * @param {string} project
1413 4
   * @param {string} location
1414 4
   * @param {string} deployment
1415 4
   * @returns {string} Resource name string.
1416 4
   */
1417 4
  gameServerDeploymentRolloutPath(
1418 4
    project: string,
1419 4
    location: string,
1420 4
    deployment: string
1421 4
  ) {
1422 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.render({
1423 4
      project: project,
1424 4
      location: location,
1425 4
      deployment: deployment,
1426 4
    });
1427 4
  }
1428 4

1429 4
  /**
1430 4
   * Parse the project from GameServerDeploymentRollout resource.
1431 4
   *
1432 4
   * @param {string} gameServerDeploymentRolloutName
1433 4
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1434 4
   * @returns {string} A string representing the project.
1435 4
   */
1436 4
  matchProjectFromGameServerDeploymentRolloutName(
1437 4
    gameServerDeploymentRolloutName: string
1438 4
  ) {
1439 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1440 4
      gameServerDeploymentRolloutName
1441 4
    ).project;
1442 4
  }
1443 4

1444 4
  /**
1445 4
   * Parse the location from GameServerDeploymentRollout resource.
1446 4
   *
1447 4
   * @param {string} gameServerDeploymentRolloutName
1448 4
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1449 4
   * @returns {string} A string representing the location.
1450 4
   */
1451 4
  matchLocationFromGameServerDeploymentRolloutName(
1452 4
    gameServerDeploymentRolloutName: string
1453 4
  ) {
1454 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1455 4
      gameServerDeploymentRolloutName
1456 4
    ).location;
1457 4
  }
1458 4

1459 4
  /**
1460 4
   * Parse the deployment from GameServerDeploymentRollout resource.
1461 4
   *
1462 4
   * @param {string} gameServerDeploymentRolloutName
1463 4
   *   A fully-qualified path representing GameServerDeploymentRollout resource.
1464 4
   * @returns {string} A string representing the deployment.
1465 4
   */
1466 4
  matchDeploymentFromGameServerDeploymentRolloutName(
1467 4
    gameServerDeploymentRolloutName: string
1468 4
  ) {
1469 4
    return this.pathTemplates.gameServerDeploymentRolloutPathTemplate.match(
1470 4
      gameServerDeploymentRolloutName
1471 4
    ).deployment;
1472 4
  }
1473 4

1474 4
  /**
1475 4
   * Return a fully-qualified realm resource name string.
1476 4
   *
1477 4
   * @param {string} project
1478 4
   * @param {string} location
1479 4
   * @param {string} realm
1480 4
   * @returns {string} Resource name string.
1481 4
   */
1482 4
  realmPath(project: string, location: string, realm: string) {
1483 4
    return this.pathTemplates.realmPathTemplate.render({
1484 4
      project: project,
1485 4
      location: location,
1486 4
      realm: realm,
1487 4
    });
1488 4
  }
1489 4

1490 4
  /**
1491 4
   * Parse the project from Realm resource.
1492 4
   *
1493 4
   * @param {string} realmName
1494 4
   *   A fully-qualified path representing Realm resource.
1495 4
   * @returns {string} A string representing the project.
1496 4
   */
1497 4
  matchProjectFromRealmName(realmName: string) {
1498 4
    return this.pathTemplates.realmPathTemplate.match(realmName).project;
1499 4
  }
1500 4

1501 4
  /**
1502 4
   * Parse the location from Realm resource.
1503 4
   *
1504 4
   * @param {string} realmName
1505 4
   *   A fully-qualified path representing Realm resource.
1506 4
   * @returns {string} A string representing the location.
1507 4
   */
1508 4
  matchLocationFromRealmName(realmName: string) {
1509 4
    return this.pathTemplates.realmPathTemplate.match(realmName).location;
1510 4
  }
1511 4

1512 4
  /**
1513 4
   * Parse the realm from Realm resource.
1514 4
   *
1515 4
   * @param {string} realmName
1516 4
   *   A fully-qualified path representing Realm resource.
1517 4
   * @returns {string} A string representing the realm.
1518 4
   */
1519 4
  matchRealmFromRealmName(realmName: string) {
1520 4
    return this.pathTemplates.realmPathTemplate.match(realmName).realm;
1521 4
  }
1522 4

1523 4
  /**
1524 4
   * Terminate the GRPC channel and close the client.
1525 4
   *
1526 4
   * The client will no longer be usable and all future behavior is undefined.
1527 4
   */
1528 4
  close(): Promise<void> {
1529 4
    this.initialize();
1530 4
    if (!this._terminated) {
1531 4
      return this.realmsServiceStub!.then(stub => {
1532 4
        this._terminated = true;
1533 4
        stub.close();
1534 4
      });
1535 4
    }
1536 0
    return Promise.resolve();
1537 0
  }
1538 4
}

Read our documentation on viewing source code .

Loading