-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [AppsChat] Addition of space notification setting Chat API (#8139)
* feat: Addition of space notification setting Chat API PiperOrigin-RevId: 734264583 Source-Link: googleapis/googleapis@76254e6 Source-Link: googleapis/googleapis-gen@63109f6 Copy-Tag: eyJwIjoiQXBwc0NoYXQvLk93bEJvdC55YW1sIiwiaCI6IjYzMTA5ZjYwY2Y1ZmQ3NmRiZmIxMTUxMzM5ZWUxNzQwNjY1MTg1MjIifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
eb6f007
commit 9409cd0
Showing
15 changed files
with
1,025 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
81 changes: 81 additions & 0 deletions
81
AppsChat/samples/V1/ChatServiceClient/get_space_notification_setting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
/* | ||
* Copyright 2025 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START chat_v1_generated_ChatService_GetSpaceNotificationSetting_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Apps\Chat\V1\Client\ChatServiceClient; | ||
use Google\Apps\Chat\V1\GetSpaceNotificationSettingRequest; | ||
use Google\Apps\Chat\V1\SpaceNotificationSetting; | ||
|
||
/** | ||
* Gets the space notification setting. For an example, see [Get the | ||
* caller's space notification | ||
* setting](https://developers.google.com/workspace/chat/get-space-notification-setting). | ||
* | ||
* Requires [user | ||
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). | ||
* | ||
* @param string $formattedName Format: users/{user}/spaces/{space}/spaceNotificationSetting | ||
* | ||
* - `users/me/spaces/{space}/spaceNotificationSetting`, OR | ||
* - `users/user@example.com/spaces/{space}/spaceNotificationSetting`, OR | ||
* - `users/123456789/spaces/{space}/spaceNotificationSetting`. | ||
* Note: Only the caller's user id or email is allowed in the path. Please see | ||
* {@see ChatServiceClient::spaceNotificationSettingName()} for help formatting this field. | ||
*/ | ||
function get_space_notification_setting_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$chatServiceClient = new ChatServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetSpaceNotificationSettingRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var SpaceNotificationSetting $response */ | ||
$response = $chatServiceClient->getSpaceNotificationSetting($request); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedName = ChatServiceClient::spaceNotificationSettingName('[USER]', '[SPACE]'); | ||
|
||
get_space_notification_setting_sample($formattedName); | ||
} | ||
// [END chat_v1_generated_ChatService_GetSpaceNotificationSetting_sync] |
67 changes: 67 additions & 0 deletions
67
AppsChat/samples/V1/ChatServiceClient/update_space_notification_setting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/* | ||
* Copyright 2025 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START chat_v1_generated_ChatService_UpdateSpaceNotificationSetting_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Apps\Chat\V1\Client\ChatServiceClient; | ||
use Google\Apps\Chat\V1\SpaceNotificationSetting; | ||
use Google\Apps\Chat\V1\UpdateSpaceNotificationSettingRequest; | ||
use Google\Protobuf\FieldMask; | ||
|
||
/** | ||
* Updates the space notification setting. For an example, see [Update | ||
* the caller's space notification | ||
* setting](https://developers.google.com/workspace/chat/update-space-notification-setting). | ||
* | ||
* Requires [user | ||
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function update_space_notification_setting_sample(): void | ||
{ | ||
// Create a client. | ||
$chatServiceClient = new ChatServiceClient(); | ||
|
||
// Prepare the request message. | ||
$spaceNotificationSetting = new SpaceNotificationSetting(); | ||
$updateMask = new FieldMask(); | ||
$request = (new UpdateSpaceNotificationSettingRequest()) | ||
->setSpaceNotificationSetting($spaceNotificationSetting) | ||
->setUpdateMask($updateMask); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var SpaceNotificationSetting $response */ | ||
$response = $chatServiceClient->updateSpaceNotificationSetting($request); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
// [END chat_v1_generated_ChatService_UpdateSpaceNotificationSetting_sync] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.