Skip to content

Commit 97daa3a

Browse files
feat: adds customEmojis methods (#8274)
feat: A new method `customEmojis.create` is added feat: A new method `customEmojis.delete` is added feat: A new method `customEmojis.get` is added feat: A new method `customEmojis.list` is added docs: A comment for message `CustomEmoji` is changed docs: A comment for field `filter` in message `.google.chat.v1.ListReactionsRequest` is changed PiperOrigin-RevId: 753602235 Source-Link: googleapis/googleapis@a7ae461 Source-Link: googleapis/googleapis-gen@23558eb Copy-Tag: eyJwIjoiQXBwc0NoYXQvLk93bEJvdC55YW1sIiwiaCI6IjIzNTU4ZWI1NzAxMWNlN2NlY2VkY2RhOTJjNzM0NjA4ZGU4MDFlODMifQ== * 🦉 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>
1 parent 3e1bd3b commit 97daa3a

20 files changed

Lines changed: 1790 additions & 9 deletions
648 Bytes
Binary file not shown.
783 Bytes
Binary file not shown.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START chat_v1_generated_ChatService_CreateCustomEmoji_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Apps\Chat\V1\Client\ChatServiceClient;
28+
use Google\Apps\Chat\V1\CreateCustomEmojiRequest;
29+
use Google\Apps\Chat\V1\CustomEmoji;
30+
31+
/**
32+
* Creates a custom emoji.
33+
*
34+
* Custom emojis are only available for Google Workspace accounts, and the
35+
* administrator must turn custom emojis on for the organization. For more
36+
* information, see [Learn about custom emojis in Google
37+
* Chat](https://support.google.com/chat/answer/12800149) and
38+
* [Manage custom emoji
39+
* permissions](https://support.google.com/a/answer/12850085).
40+
*
41+
* Requires [user
42+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
43+
*
44+
* This sample has been automatically generated and should be regarded as a code
45+
* template only. It will require modifications to work:
46+
* - It may require correct/in-range values for request initialization.
47+
* - It may require specifying regional endpoints when creating the service client,
48+
* please see the apiEndpoint client configuration option for more details.
49+
*/
50+
function create_custom_emoji_sample(): void
51+
{
52+
// Create a client.
53+
$chatServiceClient = new ChatServiceClient();
54+
55+
// Prepare the request message.
56+
$customEmoji = new CustomEmoji();
57+
$request = (new CreateCustomEmojiRequest())
58+
->setCustomEmoji($customEmoji);
59+
60+
// Call the API and handle any network failures.
61+
try {
62+
/** @var CustomEmoji $response */
63+
$response = $chatServiceClient->createCustomEmoji($request);
64+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
65+
} catch (ApiException $ex) {
66+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
67+
}
68+
}
69+
// [END chat_v1_generated_ChatService_CreateCustomEmoji_sync]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START chat_v1_generated_ChatService_DeleteCustomEmoji_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Apps\Chat\V1\Client\ChatServiceClient;
28+
use Google\Apps\Chat\V1\DeleteCustomEmojiRequest;
29+
30+
/**
31+
* Deletes a custom emoji. By default, users can only delete custom emoji they
32+
* created. [Emoji managers](https://support.google.com/a/answer/12850085)
33+
* assigned by the administrator can delete any custom emoji in the
34+
* organization. See [Learn about custom emojis in Google
35+
* Chat](https://support.google.com/chat/answer/12800149).
36+
*
37+
* Custom emojis are only available for Google Workspace accounts, and the
38+
* administrator must turn custom emojis on for the organization. For more
39+
* information, see [Learn about custom emojis in Google
40+
* Chat](https://support.google.com/chat/answer/12800149) and
41+
* [Manage custom emoji
42+
* permissions](https://support.google.com/a/answer/12850085).
43+
*
44+
* Requires [user
45+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
46+
*
47+
* @param string $formattedName Resource name of the custom emoji to delete.
48+
*
49+
* Format: `customEmojis/{customEmoji}`
50+
*
51+
* You can use the emoji name as an alias for `{customEmoji}`. For example,
52+
* `customEmojis/:example-emoji:` where `:example-emoji:` is the emoji name
53+
* for a custom emoji. Please see
54+
* {@see ChatServiceClient::customEmojiName()} for help formatting this field.
55+
*/
56+
function delete_custom_emoji_sample(string $formattedName): void
57+
{
58+
// Create a client.
59+
$chatServiceClient = new ChatServiceClient();
60+
61+
// Prepare the request message.
62+
$request = (new DeleteCustomEmojiRequest())
63+
->setName($formattedName);
64+
65+
// Call the API and handle any network failures.
66+
try {
67+
$chatServiceClient->deleteCustomEmoji($request);
68+
printf('Call completed successfully.' . PHP_EOL);
69+
} catch (ApiException $ex) {
70+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
71+
}
72+
}
73+
74+
/**
75+
* Helper to execute the sample.
76+
*
77+
* This sample has been automatically generated and should be regarded as a code
78+
* template only. It will require modifications to work:
79+
* - It may require correct/in-range values for request initialization.
80+
* - It may require specifying regional endpoints when creating the service client,
81+
* please see the apiEndpoint client configuration option for more details.
82+
*/
83+
function callSample(): void
84+
{
85+
$formattedName = ChatServiceClient::customEmojiName('[CUSTOM_EMOJI]');
86+
87+
delete_custom_emoji_sample($formattedName);
88+
}
89+
// [END chat_v1_generated_ChatService_DeleteCustomEmoji_sync]
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START chat_v1_generated_ChatService_GetCustomEmoji_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Apps\Chat\V1\Client\ChatServiceClient;
28+
use Google\Apps\Chat\V1\CustomEmoji;
29+
use Google\Apps\Chat\V1\GetCustomEmojiRequest;
30+
31+
/**
32+
* Returns details about a custom emoji.
33+
*
34+
* Custom emojis are only available for Google Workspace accounts, and the
35+
* administrator must turn custom emojis on for the organization. For more
36+
* information, see [Learn about custom emojis in Google
37+
* Chat](https://support.google.com/chat/answer/12800149) and
38+
* [Manage custom emoji
39+
* permissions](https://support.google.com/a/answer/12850085).
40+
*
41+
* Requires [user
42+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
43+
*
44+
* @param string $formattedName Resource name of the custom emoji.
45+
*
46+
* Format: `customEmojis/{customEmoji}`
47+
*
48+
* You can use the emoji name as an alias for `{customEmoji}`. For example,
49+
* `customEmojis/:example-emoji:` where `:example-emoji:` is the emoji name
50+
* for a custom emoji. Please see
51+
* {@see ChatServiceClient::customEmojiName()} for help formatting this field.
52+
*/
53+
function get_custom_emoji_sample(string $formattedName): void
54+
{
55+
// Create a client.
56+
$chatServiceClient = new ChatServiceClient();
57+
58+
// Prepare the request message.
59+
$request = (new GetCustomEmojiRequest())
60+
->setName($formattedName);
61+
62+
// Call the API and handle any network failures.
63+
try {
64+
/** @var CustomEmoji $response */
65+
$response = $chatServiceClient->getCustomEmoji($request);
66+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
67+
} catch (ApiException $ex) {
68+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
69+
}
70+
}
71+
72+
/**
73+
* Helper to execute the sample.
74+
*
75+
* This sample has been automatically generated and should be regarded as a code
76+
* template only. It will require modifications to work:
77+
* - It may require correct/in-range values for request initialization.
78+
* - It may require specifying regional endpoints when creating the service client,
79+
* please see the apiEndpoint client configuration option for more details.
80+
*/
81+
function callSample(): void
82+
{
83+
$formattedName = ChatServiceClient::customEmojiName('[CUSTOM_EMOJI]');
84+
85+
get_custom_emoji_sample($formattedName);
86+
}
87+
// [END chat_v1_generated_ChatService_GetCustomEmoji_sync]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START chat_v1_generated_ChatService_ListCustomEmojis_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Apps\Chat\V1\Client\ChatServiceClient;
29+
use Google\Apps\Chat\V1\CustomEmoji;
30+
use Google\Apps\Chat\V1\ListCustomEmojisRequest;
31+
32+
/**
33+
* Lists custom emojis visible to the authenticated user.
34+
*
35+
* Custom emojis are only available for Google Workspace accounts, and the
36+
* administrator must turn custom emojis on for the organization. For more
37+
* information, see [Learn about custom emojis in Google
38+
* Chat](https://support.google.com/chat/answer/12800149) and
39+
* [Manage custom emoji
40+
* permissions](https://support.google.com/a/answer/12850085).
41+
*
42+
* Requires [user
43+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
44+
*
45+
* This sample has been automatically generated and should be regarded as a code
46+
* template only. It will require modifications to work:
47+
* - It may require correct/in-range values for request initialization.
48+
* - It may require specifying regional endpoints when creating the service client,
49+
* please see the apiEndpoint client configuration option for more details.
50+
*/
51+
function list_custom_emojis_sample(): void
52+
{
53+
// Create a client.
54+
$chatServiceClient = new ChatServiceClient();
55+
56+
// Prepare the request message.
57+
$request = new ListCustomEmojisRequest();
58+
59+
// Call the API and handle any network failures.
60+
try {
61+
/** @var PagedListResponse $response */
62+
$response = $chatServiceClient->listCustomEmojis($request);
63+
64+
/** @var CustomEmoji $element */
65+
foreach ($response as $element) {
66+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
67+
}
68+
} catch (ApiException $ex) {
69+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
70+
}
71+
}
72+
// [END chat_v1_generated_ChatService_ListCustomEmojis_sync]

0 commit comments

Comments
 (0)