@google-apps/chat 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -934,6 +934,24 @@ export declare class ChatServiceClient {
934
934
  * users](https://developers.google.com/workspace/chat/space-target-audience).
935
935
  * `access_settings.audience` is not supported with `useAdminAccess`.
936
936
  *
937
+ * `access_settings.access_permission_settings`: Updates the [access
938
+ * permission
939
+ * settings](https://support.google.com/chat/answer/11971020) of who can
940
+ * discover and join the space where `spaceType` field is `SPACE`. Principals
941
+ * allowed to join the space must also be allowed to discover it. To update
942
+ * access permission settings for a space, the authenticating user must be a
943
+ * space manager or assistant manager and omit all other field masks in the
944
+ * request. You can't update this field if the space is in [import
945
+ * mode](https://developers.google.com/workspace/chat/import-data-overview).
946
+ * To learn more, see [Make a space discoverable to specific
947
+ * users](https://developers.google.com/workspace/chat/space-target-audience).
948
+ * `access_settings.access_permission_settings` is not supported with
949
+ * `useAdminAccess`.
950
+ * The supported field masks include:
951
+ *
952
+ * - `access_settings.access_permission_settings.discoverSpaceSetting`
953
+ * - `access_settings.access_permission_settings.joinSpaceSetting`
954
+ *
937
955
  * `permission_settings`: Supports changing the
938
956
  * [permission settings](https://support.google.com/chat/answer/13340792)
939
957
  * of a space.
@@ -1768,6 +1786,224 @@ export declare class ChatServiceClient {
1768
1786
  ]>;
1769
1787
  getThreadReadState(request: protos.google.chat.v1.IGetThreadReadStateRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IThreadReadState, protos.google.chat.v1.IGetThreadReadStateRequest | null | undefined, {} | null | undefined>): void;
1770
1788
  getThreadReadState(request: protos.google.chat.v1.IGetThreadReadStateRequest, callback: Callback<protos.google.chat.v1.IThreadReadState, protos.google.chat.v1.IGetThreadReadStateRequest | null | undefined, {} | null | undefined>): void;
1789
+ /**
1790
+ * Returns availability information for a human user in Google Chat. For
1791
+ * example, this can be used to check if a user is online or away, or to
1792
+ * retrieve their custom status message.
1793
+ *
1794
+ * This method only retrieves the authenticated user's availability.
1795
+ *
1796
+ * Requires [user
1797
+ * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
1798
+ * with one of the following [authorization
1799
+ * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
1800
+ *
1801
+ * - `https://www.googleapis.com/auth/chat.users.availability.readonly`
1802
+ * - `https://www.googleapis.com/auth/chat.users.availability`
1803
+ *
1804
+ * @param {Object} request
1805
+ * The request object that will be sent.
1806
+ * @param {string} request.name
1807
+ * Required. The resource name of the availability to retrieve.
1808
+ *
1809
+ * Format: users/{user}/availability
1810
+ *
1811
+ * `{user}` is the id for the Person in the People API or Admin SDK directory
1812
+ * API. For example, `users/123456789`.
1813
+ *
1814
+ * The user's email address or `me` can also be used as an alias to refer to
1815
+ * the caller. For example, `users/user@example.com` or `users/me`.
1816
+ * @param {object} [options]
1817
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1818
+ * @returns {Promise} - The promise which resolves to an array.
1819
+ * The first element of the array is an object representing {@link protos.google.chat.v1.Availability|Availability}.
1820
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
1821
+ * for more details and examples.
1822
+ * @example <caption>include:samples/generated/v1/chat_service.get_availability.js</caption>
1823
+ * region_tag:chat_v1_generated_ChatService_GetAvailability_async
1824
+ */
1825
+ getAvailability(request?: protos.google.chat.v1.IGetAvailabilityRequest, options?: CallOptions): Promise<[
1826
+ protos.google.chat.v1.IAvailability,
1827
+ protos.google.chat.v1.IGetAvailabilityRequest | undefined,
1828
+ {} | undefined
1829
+ ]>;
1830
+ getAvailability(request: protos.google.chat.v1.IGetAvailabilityRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IGetAvailabilityRequest | null | undefined, {} | null | undefined>): void;
1831
+ getAvailability(request: protos.google.chat.v1.IGetAvailabilityRequest, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IGetAvailabilityRequest | null | undefined, {} | null | undefined>): void;
1832
+ /**
1833
+ * Marks user as `ACTIVE` in Google Chat.
1834
+ *
1835
+ * Sets the user's availability state to `ACTIVE`. The `ACTIVE` state
1836
+ * lasts until the specified expiration, at which point the user's state
1837
+ * becomes `AWAY`. Note that if the user is actively using Chat, the `ACTIVE`
1838
+ * state duration may extend beyond the provided expiration.
1839
+ *
1840
+ * This method only updates the authenticated user's availability.
1841
+ *
1842
+ * Requires [user
1843
+ * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
1844
+ * with [authorization
1845
+ * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
1846
+ *
1847
+ * - `https://www.googleapis.com/auth/chat.users.availability`
1848
+ *
1849
+ * @param {Object} request
1850
+ * The request object that will be sent.
1851
+ * @param {string} request.name
1852
+ * Required. The resource name of the availability to mark as active.
1853
+ * Format: users/{user}/availability
1854
+ *
1855
+ * `{user}` is the id for the Person in the People API or Admin SDK directory
1856
+ * API. For example, `users/123456789`.
1857
+ *
1858
+ * The user's email address or `me` can also be used as an alias to refer to
1859
+ * the caller. For example, `users/user@example.com` or `users/me`.
1860
+ * @param {google.protobuf.Timestamp} request.expireTime
1861
+ * The absolute timestamp when the ACTIVE state expires.
1862
+ * @param {google.protobuf.Duration} request.ttl
1863
+ * The duration from the current time until the ACTIVE state expires.
1864
+ * Using a short TTL can effectively reset the user's state to be based
1865
+ * on activity after this brief duration.
1866
+ * @param {object} [options]
1867
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1868
+ * @returns {Promise} - The promise which resolves to an array.
1869
+ * The first element of the array is an object representing {@link protos.google.chat.v1.Availability|Availability}.
1870
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
1871
+ * for more details and examples.
1872
+ * @example <caption>include:samples/generated/v1/chat_service.mark_as_active.js</caption>
1873
+ * region_tag:chat_v1_generated_ChatService_MarkAsActive_async
1874
+ */
1875
+ markAsActive(request?: protos.google.chat.v1.IMarkAsActiveRequest, options?: CallOptions): Promise<[
1876
+ protos.google.chat.v1.IAvailability,
1877
+ protos.google.chat.v1.IMarkAsActiveRequest | undefined,
1878
+ {} | undefined
1879
+ ]>;
1880
+ markAsActive(request: protos.google.chat.v1.IMarkAsActiveRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IMarkAsActiveRequest | null | undefined, {} | null | undefined>): void;
1881
+ markAsActive(request: protos.google.chat.v1.IMarkAsActiveRequest, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IMarkAsActiveRequest | null | undefined, {} | null | undefined>): void;
1882
+ /**
1883
+ * Marks user as `AWAY` in Google Chat.
1884
+ *
1885
+ * Sets the user's state to away and is not affected by the user's
1886
+ * activity.
1887
+ *
1888
+ * This method only updates the authenticated user's availability.
1889
+ *
1890
+ * Requires [user
1891
+ * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
1892
+ * with [authorization
1893
+ * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
1894
+ *
1895
+ * - `https://www.googleapis.com/auth/chat.users.availability`
1896
+ *
1897
+ * @param {Object} request
1898
+ * The request object that will be sent.
1899
+ * @param {string} request.name
1900
+ * Required. The resource name of the availability to mark as away.
1901
+ * Format: users/{user}/availability
1902
+ *
1903
+ * `{user}` is the id for the Person in the People API or Admin SDK directory
1904
+ * API. For example, `users/123456789`.
1905
+ *
1906
+ * The user's email address or `me` can also be used as an alias to refer to
1907
+ * the caller. For example, `users/user@example.com` or `users/me`.
1908
+ * @param {object} [options]
1909
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1910
+ * @returns {Promise} - The promise which resolves to an array.
1911
+ * The first element of the array is an object representing {@link protos.google.chat.v1.Availability|Availability}.
1912
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
1913
+ * for more details and examples.
1914
+ * @example <caption>include:samples/generated/v1/chat_service.mark_as_away.js</caption>
1915
+ * region_tag:chat_v1_generated_ChatService_MarkAsAway_async
1916
+ */
1917
+ markAsAway(request?: protos.google.chat.v1.IMarkAsAwayRequest, options?: CallOptions): Promise<[
1918
+ protos.google.chat.v1.IAvailability,
1919
+ protos.google.chat.v1.IMarkAsAwayRequest | undefined,
1920
+ {} | undefined
1921
+ ]>;
1922
+ markAsAway(request: protos.google.chat.v1.IMarkAsAwayRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IMarkAsAwayRequest | null | undefined, {} | null | undefined>): void;
1923
+ markAsAway(request: protos.google.chat.v1.IMarkAsAwayRequest, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IMarkAsAwayRequest | null | undefined, {} | null | undefined>): void;
1924
+ /**
1925
+ * Marks user as `DO_NOT_DISTURB` in Google Chat.
1926
+ *
1927
+ * Sets a user's availability state to `DO_NOT_DISTURB` until a specified
1928
+ * expiration time.
1929
+ * When in `DO_NOT_DISTURB`, users typically won't receive notifications.
1930
+ *
1931
+ * This method only updates the authenticated user's availability.
1932
+ *
1933
+ * Requires [user
1934
+ * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
1935
+ * with [authorization
1936
+ * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
1937
+ *
1938
+ * - `https://www.googleapis.com/auth/chat.users.availability`
1939
+ *
1940
+ * @param {Object} request
1941
+ * The request object that will be sent.
1942
+ * @param {string} request.name
1943
+ * Required. The resource name of the availability to mark as Do Not Disturb.
1944
+ * Format: users/{user}/availability
1945
+ *
1946
+ * `{user}` is the id for the Person in the People API or Admin SDK directory
1947
+ * API. For example, `users/123456789`.
1948
+ *
1949
+ * The user's email address or `me` can also be used as an alias to refer to
1950
+ * the caller. For example, `users/user@example.com` or `users/me`.
1951
+ * @param {google.protobuf.Timestamp} request.expireTime
1952
+ * The absolute timestamp when the DND state expires.
1953
+ * @param {google.protobuf.Duration} request.ttl
1954
+ * The duration from the current time until the DND state expires.
1955
+ * @param {object} [options]
1956
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1957
+ * @returns {Promise} - The promise which resolves to an array.
1958
+ * The first element of the array is an object representing {@link protos.google.chat.v1.Availability|Availability}.
1959
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
1960
+ * for more details and examples.
1961
+ * @example <caption>include:samples/generated/v1/chat_service.mark_as_do_not_disturb.js</caption>
1962
+ * region_tag:chat_v1_generated_ChatService_MarkAsDoNotDisturb_async
1963
+ */
1964
+ markAsDoNotDisturb(request?: protos.google.chat.v1.IMarkAsDoNotDisturbRequest, options?: CallOptions): Promise<[
1965
+ protos.google.chat.v1.IAvailability,
1966
+ protos.google.chat.v1.IMarkAsDoNotDisturbRequest | undefined,
1967
+ {} | undefined
1968
+ ]>;
1969
+ markAsDoNotDisturb(request: protos.google.chat.v1.IMarkAsDoNotDisturbRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IMarkAsDoNotDisturbRequest | null | undefined, {} | null | undefined>): void;
1970
+ markAsDoNotDisturb(request: protos.google.chat.v1.IMarkAsDoNotDisturbRequest, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IMarkAsDoNotDisturbRequest | null | undefined, {} | null | undefined>): void;
1971
+ /**
1972
+ * Updates availability information for a human user. Only the `custom_status`
1973
+ * field can be updated through this method.
1974
+ *
1975
+ * This method only updates the authenticated user's availability.
1976
+ *
1977
+ * Requires [user
1978
+ * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
1979
+ * with one of the following [authorization
1980
+ * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
1981
+ *
1982
+ * - `https://www.googleapis.com/auth/chat.users.availability`
1983
+ *
1984
+ * @param {Object} request
1985
+ * The request object that will be sent.
1986
+ * @param {google.chat.v1.Availability} request.availability
1987
+ * Required. The availability to update.
1988
+ * @param {google.protobuf.FieldMask} request.updateMask
1989
+ * Required. The list of fields to update.
1990
+ * The only field that can be updated is `custom_status`.
1991
+ * @param {object} [options]
1992
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1993
+ * @returns {Promise} - The promise which resolves to an array.
1994
+ * The first element of the array is an object representing {@link protos.google.chat.v1.Availability|Availability}.
1995
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
1996
+ * for more details and examples.
1997
+ * @example <caption>include:samples/generated/v1/chat_service.update_availability.js</caption>
1998
+ * region_tag:chat_v1_generated_ChatService_UpdateAvailability_async
1999
+ */
2000
+ updateAvailability(request?: protos.google.chat.v1.IUpdateAvailabilityRequest, options?: CallOptions): Promise<[
2001
+ protos.google.chat.v1.IAvailability,
2002
+ protos.google.chat.v1.IUpdateAvailabilityRequest | undefined,
2003
+ {} | undefined
2004
+ ]>;
2005
+ updateAvailability(request: protos.google.chat.v1.IUpdateAvailabilityRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IUpdateAvailabilityRequest | null | undefined, {} | null | undefined>): void;
2006
+ updateAvailability(request: protos.google.chat.v1.IUpdateAvailabilityRequest, callback: Callback<protos.google.chat.v1.IAvailability, protos.google.chat.v1.IUpdateAvailabilityRequest | null | undefined, {} | null | undefined>): void;
1771
2007
  /**
1772
2008
  * Returns an event from a Google Chat space. The [event
1773
2009
  * payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload)
@@ -4687,6 +4923,21 @@ export declare class ChatServiceClient {
4687
4923
  * @returns {string} A string representing the attachment.
4688
4924
  */
4689
4925
  matchAttachmentFromAttachmentName(attachmentName: string): string | number;
4926
+ /**
4927
+ * Return a fully-qualified availability resource name string.
4928
+ *
4929
+ * @param {string} user
4930
+ * @returns {string} Resource name string.
4931
+ */
4932
+ availabilityPath(user: string): string;
4933
+ /**
4934
+ * Parse the user from Availability resource.
4935
+ *
4936
+ * @param {string} availabilityName
4937
+ * A fully-qualified path representing Availability resource.
4938
+ * @returns {string} A string representing the user.
4939
+ */
4940
+ matchUserFromAvailabilityName(availabilityName: string): string | number;
4690
4941
  /**
4691
4942
  * Return a fully-qualified customEmoji resource name string.
4692
4943
  *
@@ -168,6 +168,7 @@ class ChatServiceClient {
168
168
  // Create useful helper objects for these.
169
169
  this.pathTemplates = {
170
170
  attachmentPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/attachments/{attachment}'),
171
+ availabilityPathTemplate: new this._gaxModule.PathTemplate('users/{user}/availability'),
171
172
  customEmojiPathTemplate: new this._gaxModule.PathTemplate('customEmojis/{custom_emoji}'),
172
173
  membershipPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/members/{member}'),
173
174
  messagePathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}'),
@@ -263,6 +264,11 @@ class ChatServiceClient {
263
264
  'getSpaceReadState',
264
265
  'updateSpaceReadState',
265
266
  'getThreadReadState',
267
+ 'getAvailability',
268
+ 'markAsActive',
269
+ 'markAsAway',
270
+ 'markAsDoNotDisturb',
271
+ 'updateAvailability',
266
272
  'getSpaceEvent',
267
273
  'listSpaceEvents',
268
274
  'getSpaceNotificationSetting',
@@ -368,6 +374,8 @@ class ChatServiceClient {
368
374
  'https://www.googleapis.com/auth/chat.spaces',
369
375
  'https://www.googleapis.com/auth/chat.spaces.create',
370
376
  'https://www.googleapis.com/auth/chat.spaces.readonly',
377
+ 'https://www.googleapis.com/auth/chat.users.availability',
378
+ 'https://www.googleapis.com/auth/chat.users.availability.readonly',
371
379
  'https://www.googleapis.com/auth/chat.users.readstate',
372
380
  'https://www.googleapis.com/auth/chat.users.readstate.readonly',
373
381
  'https://www.googleapis.com/auth/chat.users.sections',
@@ -1445,6 +1453,221 @@ class ChatServiceClient {
1445
1453
  throw error;
1446
1454
  });
1447
1455
  }
1456
+ getAvailability(request, optionsOrCallback, callback) {
1457
+ request = request || {};
1458
+ let options;
1459
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1460
+ callback = optionsOrCallback;
1461
+ options = {};
1462
+ }
1463
+ else {
1464
+ options = optionsOrCallback;
1465
+ }
1466
+ options = options || {};
1467
+ options.otherArgs = options.otherArgs || {};
1468
+ options.otherArgs.headers = options.otherArgs.headers || {};
1469
+ options.otherArgs.headers['x-goog-request-params'] =
1470
+ this._gaxModule.routingHeader.fromParams({
1471
+ name: request.name ?? '',
1472
+ });
1473
+ this.initialize().catch((err) => {
1474
+ throw err;
1475
+ });
1476
+ this._log.info('getAvailability request %j', request);
1477
+ const wrappedCallback = callback
1478
+ ? (error, response, options, rawResponse) => {
1479
+ this._log.info('getAvailability response %j', response);
1480
+ callback(error, response, options, rawResponse); // We verified callback above.
1481
+ }
1482
+ : undefined;
1483
+ return this.innerApiCalls
1484
+ .getAvailability(request, options, wrappedCallback)
1485
+ ?.then(([response, options, rawResponse]) => {
1486
+ this._log.info('getAvailability response %j', response);
1487
+ return [response, options, rawResponse];
1488
+ })
1489
+ .catch((error) => {
1490
+ if (error &&
1491
+ 'statusDetails' in error &&
1492
+ error.statusDetails instanceof Array) {
1493
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1494
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1495
+ }
1496
+ throw error;
1497
+ });
1498
+ }
1499
+ markAsActive(request, optionsOrCallback, callback) {
1500
+ request = request || {};
1501
+ let options;
1502
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1503
+ callback = optionsOrCallback;
1504
+ options = {};
1505
+ }
1506
+ else {
1507
+ options = optionsOrCallback;
1508
+ }
1509
+ options = options || {};
1510
+ options.otherArgs = options.otherArgs || {};
1511
+ options.otherArgs.headers = options.otherArgs.headers || {};
1512
+ options.otherArgs.headers['x-goog-request-params'] =
1513
+ this._gaxModule.routingHeader.fromParams({
1514
+ name: request.name ?? '',
1515
+ });
1516
+ this.initialize().catch((err) => {
1517
+ throw err;
1518
+ });
1519
+ this._log.info('markAsActive request %j', request);
1520
+ const wrappedCallback = callback
1521
+ ? (error, response, options, rawResponse) => {
1522
+ this._log.info('markAsActive response %j', response);
1523
+ callback(error, response, options, rawResponse); // We verified callback above.
1524
+ }
1525
+ : undefined;
1526
+ return this.innerApiCalls
1527
+ .markAsActive(request, options, wrappedCallback)
1528
+ ?.then(([response, options, rawResponse]) => {
1529
+ this._log.info('markAsActive response %j', response);
1530
+ return [response, options, rawResponse];
1531
+ })
1532
+ .catch((error) => {
1533
+ if (error &&
1534
+ 'statusDetails' in error &&
1535
+ error.statusDetails instanceof Array) {
1536
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1537
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1538
+ }
1539
+ throw error;
1540
+ });
1541
+ }
1542
+ markAsAway(request, optionsOrCallback, callback) {
1543
+ request = request || {};
1544
+ let options;
1545
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1546
+ callback = optionsOrCallback;
1547
+ options = {};
1548
+ }
1549
+ else {
1550
+ options = optionsOrCallback;
1551
+ }
1552
+ options = options || {};
1553
+ options.otherArgs = options.otherArgs || {};
1554
+ options.otherArgs.headers = options.otherArgs.headers || {};
1555
+ options.otherArgs.headers['x-goog-request-params'] =
1556
+ this._gaxModule.routingHeader.fromParams({
1557
+ name: request.name ?? '',
1558
+ });
1559
+ this.initialize().catch((err) => {
1560
+ throw err;
1561
+ });
1562
+ this._log.info('markAsAway request %j', request);
1563
+ const wrappedCallback = callback
1564
+ ? (error, response, options, rawResponse) => {
1565
+ this._log.info('markAsAway response %j', response);
1566
+ callback(error, response, options, rawResponse); // We verified callback above.
1567
+ }
1568
+ : undefined;
1569
+ return this.innerApiCalls
1570
+ .markAsAway(request, options, wrappedCallback)
1571
+ ?.then(([response, options, rawResponse]) => {
1572
+ this._log.info('markAsAway response %j', response);
1573
+ return [response, options, rawResponse];
1574
+ })
1575
+ .catch((error) => {
1576
+ if (error &&
1577
+ 'statusDetails' in error &&
1578
+ error.statusDetails instanceof Array) {
1579
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1580
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1581
+ }
1582
+ throw error;
1583
+ });
1584
+ }
1585
+ markAsDoNotDisturb(request, optionsOrCallback, callback) {
1586
+ request = request || {};
1587
+ let options;
1588
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1589
+ callback = optionsOrCallback;
1590
+ options = {};
1591
+ }
1592
+ else {
1593
+ options = optionsOrCallback;
1594
+ }
1595
+ options = options || {};
1596
+ options.otherArgs = options.otherArgs || {};
1597
+ options.otherArgs.headers = options.otherArgs.headers || {};
1598
+ options.otherArgs.headers['x-goog-request-params'] =
1599
+ this._gaxModule.routingHeader.fromParams({
1600
+ name: request.name ?? '',
1601
+ });
1602
+ this.initialize().catch((err) => {
1603
+ throw err;
1604
+ });
1605
+ this._log.info('markAsDoNotDisturb request %j', request);
1606
+ const wrappedCallback = callback
1607
+ ? (error, response, options, rawResponse) => {
1608
+ this._log.info('markAsDoNotDisturb response %j', response);
1609
+ callback(error, response, options, rawResponse); // We verified callback above.
1610
+ }
1611
+ : undefined;
1612
+ return this.innerApiCalls
1613
+ .markAsDoNotDisturb(request, options, wrappedCallback)
1614
+ ?.then(([response, options, rawResponse]) => {
1615
+ this._log.info('markAsDoNotDisturb response %j', response);
1616
+ return [response, options, rawResponse];
1617
+ })
1618
+ .catch((error) => {
1619
+ if (error &&
1620
+ 'statusDetails' in error &&
1621
+ error.statusDetails instanceof Array) {
1622
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1623
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1624
+ }
1625
+ throw error;
1626
+ });
1627
+ }
1628
+ updateAvailability(request, optionsOrCallback, callback) {
1629
+ request = request || {};
1630
+ let options;
1631
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1632
+ callback = optionsOrCallback;
1633
+ options = {};
1634
+ }
1635
+ else {
1636
+ options = optionsOrCallback;
1637
+ }
1638
+ options = options || {};
1639
+ options.otherArgs = options.otherArgs || {};
1640
+ options.otherArgs.headers = options.otherArgs.headers || {};
1641
+ options.otherArgs.headers['x-goog-request-params'] =
1642
+ this._gaxModule.routingHeader.fromParams({
1643
+ 'availability.name': request.availability.name ?? '',
1644
+ });
1645
+ this.initialize().catch((err) => {
1646
+ throw err;
1647
+ });
1648
+ this._log.info('updateAvailability request %j', request);
1649
+ const wrappedCallback = callback
1650
+ ? (error, response, options, rawResponse) => {
1651
+ this._log.info('updateAvailability response %j', response);
1652
+ callback(error, response, options, rawResponse); // We verified callback above.
1653
+ }
1654
+ : undefined;
1655
+ return this.innerApiCalls
1656
+ .updateAvailability(request, options, wrappedCallback)
1657
+ ?.then(([response, options, rawResponse]) => {
1658
+ this._log.info('updateAvailability response %j', response);
1659
+ return [response, options, rawResponse];
1660
+ })
1661
+ .catch((error) => {
1662
+ if (error &&
1663
+ 'statusDetails' in error &&
1664
+ error.statusDetails instanceof Array) {
1665
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1666
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1667
+ }
1668
+ throw error;
1669
+ });
1670
+ }
1448
1671
  getSpaceEvent(request, optionsOrCallback, callback) {
1449
1672
  request = request || {};
1450
1673
  let options;
@@ -3970,6 +4193,28 @@ class ChatServiceClient {
3970
4193
  return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
3971
4194
  .attachment;
3972
4195
  }
4196
+ /**
4197
+ * Return a fully-qualified availability resource name string.
4198
+ *
4199
+ * @param {string} user
4200
+ * @returns {string} Resource name string.
4201
+ */
4202
+ availabilityPath(user) {
4203
+ return this.pathTemplates.availabilityPathTemplate.render({
4204
+ user: user,
4205
+ });
4206
+ }
4207
+ /**
4208
+ * Parse the user from Availability resource.
4209
+ *
4210
+ * @param {string} availabilityName
4211
+ * A fully-qualified path representing Availability resource.
4212
+ * @returns {string} A string representing the user.
4213
+ */
4214
+ matchUserFromAvailabilityName(availabilityName) {
4215
+ return this.pathTemplates.availabilityPathTemplate.match(availabilityName)
4216
+ .user;
4217
+ }
3973
4218
  /**
3974
4219
  * Return a fully-qualified customEmoji resource name string.
3975
4220
  *