diff --git a/AppsChat/.OwlBot.yaml b/AppsChat/.OwlBot.yaml new file mode 100644 index 000000000000..1f2c6c892f98 --- /dev/null +++ b/AppsChat/.OwlBot.yaml @@ -0,0 +1,6 @@ +deep-copy-regex: + - source: /google/chat/(v1)/.*-php/(.*) + dest: /owl-bot-staging/AppsChat/$1/$2 + - source: /google/apps/card/(v1)/.*-php/(.*) + dest: /owl-bot-staging/AppsChat/card-protos/$1/$2 +api-name: AppsChat diff --git a/AppsChat/.gitattributes b/AppsChat/.gitattributes new file mode 100644 index 000000000000..8119e7fcc1b2 --- /dev/null +++ b/AppsChat/.gitattributes @@ -0,0 +1,8 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/.repo-metadata.json export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/AppsChat/.github/pull_request_template.md b/AppsChat/.github/pull_request_template.md new file mode 100644 index 000000000000..01e8f62554e3 --- /dev/null +++ b/AppsChat/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `AppsChat/src`, and tests in `AppsChat/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/AppsChat/.repo-metadata.json b/AppsChat/.repo-metadata.json new file mode 100644 index 000000000000..917a35ff0820 --- /dev/null +++ b/AppsChat/.repo-metadata.json @@ -0,0 +1,8 @@ +{ + "language": "php", + "distribution_name": "google/chat", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/chat/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "chat" +} diff --git a/AppsChat/CONTRIBUTING.md b/AppsChat/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/AppsChat/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/AppsChat/LICENSE b/AppsChat/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/AppsChat/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/AppsChat/README.md b/AppsChat/README.md new file mode 100644 index 000000000000..4f4e02075d2d --- /dev/null +++ b/AppsChat/README.md @@ -0,0 +1,45 @@ +# Google Apps Chat for PHP + +> Idiomatic PHP client for [Google Apps Chat](https://developers.google.com/chat/concepts). + +[![Latest Stable Version](https://poser.pugx.org/google/chat/v/stable)](https://packagist.org/packages/google/chat) [![Packagist](https://img.shields.io/packagist/dm/google/chat.svg)](https://packagist.org/packages/google/chat) + +* [API documentation](https://cloud.google.com/php/docs/reference/chat/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/chat +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](https://github.com/googleapis/php-chat/tree/main/samples) for a canonical list of samples. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://developers.google.com/chat/concepts). diff --git a/AppsChat/VERSION b/AppsChat/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/AppsChat/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/AppsChat/composer.json b/AppsChat/composer.json new file mode 100644 index 000000000000..29d44291df31 --- /dev/null +++ b/AppsChat/composer.json @@ -0,0 +1,32 @@ +{ + "name": "google/apps-chat", + "description": "Google Apps Chat Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Apps\\Chat\\": "src/Chat", + "GPBMetadata\\Google\\Chat\\": "metadata/Chat", + "Google\\Apps\\Card\\": "src/Card", + "GPBMetadata\\Google\\Apps\\Card\\": "metadata/Card" + } + }, + "extra": { + "component": { + "id": "apps-chat", + "path": "AppsChat", + "target": "googleapis/php-apps-chat" + } + }, + "require": { + "php": "^8.0", + "google/gax": "^1.30.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/AppsChat/metadata/Card/V1/Card.php b/AppsChat/metadata/Card/V1/Card.php new file mode 100644 index 000000000000..2b741a7e4347 Binary files /dev/null and b/AppsChat/metadata/Card/V1/Card.php differ diff --git a/AppsChat/metadata/Chat/V1/ActionStatus.php b/AppsChat/metadata/Chat/V1/ActionStatus.php new file mode 100644 index 000000000000..5e1bb871cebf --- /dev/null +++ b/AppsChat/metadata/Chat/V1/ActionStatus.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' +¯ +"google/chat/v1/action_status.protogoogle.chat.v1"R + ActionStatus% + status_code (2.google.rpc.Code +user_facing_message ( Bœ +com.google.chat.v1BActionStatusProtoPZ,cloud.google.com/go/chat/apiv1/chatpb;chatpbªGoogle.Apps.Chat.V1ÊGoogle\\Apps\\Chat\\V1êGoogle::Apps::Chat::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/AppsChat/metadata/Chat/V1/Annotation.php b/AppsChat/metadata/Chat/V1/Annotation.php new file mode 100644 index 000000000000..62c79c5cae09 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Annotation.php differ diff --git a/AppsChat/metadata/Chat/V1/Attachment.php b/AppsChat/metadata/Chat/V1/Attachment.php new file mode 100644 index 000000000000..013dfc061df3 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Attachment.php differ diff --git a/AppsChat/metadata/Chat/V1/ChatService.php b/AppsChat/metadata/Chat/V1/ChatService.php new file mode 100644 index 000000000000..815f339431fd Binary files /dev/null and b/AppsChat/metadata/Chat/V1/ChatService.php differ diff --git a/AppsChat/metadata/Chat/V1/ContextualAddon.php b/AppsChat/metadata/Chat/V1/ContextualAddon.php new file mode 100644 index 000000000000..c72b5a23be72 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/ContextualAddon.php differ diff --git a/AppsChat/metadata/Chat/V1/DeletionMetadata.php b/AppsChat/metadata/Chat/V1/DeletionMetadata.php new file mode 100644 index 000000000000..ce6976a0ddc4 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/DeletionMetadata.php differ diff --git a/AppsChat/metadata/Chat/V1/Group.php b/AppsChat/metadata/Chat/V1/Group.php new file mode 100644 index 000000000000..4672bcfeb862 --- /dev/null +++ b/AppsChat/metadata/Chat/V1/Group.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' +ã +google/chat/v1/group.protogoogle.chat.v1" +Group +name ( B• +com.google.chat.v1B +GroupProtoPZ,cloud.google.com/go/chat/apiv1/chatpb;chatpbªGoogle.Apps.Chat.V1ÊGoogle\\Apps\\Chat\\V1êGoogle::Apps::Chat::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/AppsChat/metadata/Chat/V1/HistoryState.php b/AppsChat/metadata/Chat/V1/HistoryState.php new file mode 100644 index 000000000000..ec2fc6b93e71 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/HistoryState.php differ diff --git a/AppsChat/metadata/Chat/V1/MatchedUrl.php b/AppsChat/metadata/Chat/V1/MatchedUrl.php new file mode 100644 index 000000000000..bfe88200ad6f --- /dev/null +++ b/AppsChat/metadata/Chat/V1/MatchedUrl.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' +÷ + google/chat/v1/matched_url.protogoogle.chat.v1" + +MatchedUrl +url ( BàABš +com.google.chat.v1BMatchedUrlProtoPZ,cloud.google.com/go/chat/apiv1/chatpb;chatpbªGoogle.Apps.Chat.V1ÊGoogle\\Apps\\Chat\\V1êGoogle::Apps::Chat::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/AppsChat/metadata/Chat/V1/Membership.php b/AppsChat/metadata/Chat/V1/Membership.php new file mode 100644 index 000000000000..6feaa39be9a0 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Membership.php differ diff --git a/AppsChat/metadata/Chat/V1/Message.php b/AppsChat/metadata/Chat/V1/Message.php new file mode 100644 index 000000000000..5fa92ad96c45 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Message.php differ diff --git a/AppsChat/metadata/Chat/V1/Reaction.php b/AppsChat/metadata/Chat/V1/Reaction.php new file mode 100644 index 000000000000..2b9ad648519b Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Reaction.php differ diff --git a/AppsChat/metadata/Chat/V1/SlashCommand.php b/AppsChat/metadata/Chat/V1/SlashCommand.php new file mode 100644 index 000000000000..d31b2a8bf0d2 --- /dev/null +++ b/AppsChat/metadata/Chat/V1/SlashCommand.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' +ÿ +"google/chat/v1/slash_command.protogoogle.chat.v1"" + SlashCommand + +command_id (Bœ +com.google.chat.v1BSlashCommandProtoPZ,cloud.google.com/go/chat/apiv1/chatpb;chatpbªGoogle.Apps.Chat.V1ÊGoogle\\Apps\\Chat\\V1êGoogle::Apps::Chat::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/AppsChat/metadata/Chat/V1/Space.php b/AppsChat/metadata/Chat/V1/Space.php new file mode 100644 index 000000000000..d0f7fa81bd7f Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Space.php differ diff --git a/AppsChat/metadata/Chat/V1/SpaceSetup.php b/AppsChat/metadata/Chat/V1/SpaceSetup.php new file mode 100644 index 000000000000..69d661afdf88 --- /dev/null +++ b/AppsChat/metadata/Chat/V1/SpaceSetup.php @@ -0,0 +1,35 @@ +internalAddGeneratedFile( + ' +€ + google/chat/v1/space_setup.protogoogle.chat.v1google/chat/v1/membership.protogoogle/chat/v1/space.proto" +SetUpSpaceRequest) +space ( 2.google.chat.v1.SpaceBàA + +request_id ( BàA4 + memberships ( 2.google.chat.v1.MembershipBàABš +com.google.chat.v1BSpaceSetupProtoPZ,cloud.google.com/go/chat/apiv1/chatpb;chatpbªGoogle.Apps.Chat.V1ÊGoogle\\Apps\\Chat\\V1êGoogle::Apps::Chat::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/AppsChat/metadata/Chat/V1/User.php b/AppsChat/metadata/Chat/V1/User.php new file mode 100644 index 000000000000..8b5c899a36a3 Binary files /dev/null and b/AppsChat/metadata/Chat/V1/User.php differ diff --git a/AppsChat/metadata/Chat/V1/Widgets.php b/AppsChat/metadata/Chat/V1/Widgets.php new file mode 100644 index 000000000000..addbc96ed7ce Binary files /dev/null and b/AppsChat/metadata/Chat/V1/Widgets.php differ diff --git a/AppsChat/owlbot.py b/AppsChat/owlbot.py new file mode 100644 index 000000000000..429112b8037e --- /dev/null +++ b/AppsChat/owlbot.py @@ -0,0 +1,78 @@ +# Copyright 2023 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import shutil +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/AppsChat/v1").resolve() +dest = Path().resolve() +card_src = Path(f"../{php.STAGING_DIR}/AppsChat/card-protos/v1").resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_copy_version( + src=src, + dest=dest, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + ], + version_string="chat" +) + +php.owlbot_copy_version( + src=card_src, + dest=dest, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + ], + version_string="card" +) + +# move the GAPIC files into a "Chat" subdirectory +s.move(dest / 'src/V1', dest / 'src/Chat/V1', merge=php._merge) +shutil.rmtree(dest / "src/V1") + +# remove class_alias code +s.replace( + "src/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/AppsChat/phpunit.xml.dist b/AppsChat/phpunit.xml.dist new file mode 100644 index 000000000000..eb78ccf9d009 --- /dev/null +++ b/AppsChat/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/AppsChat/samples/V1/ChatServiceClient/complete_import_space.php b/AppsChat/samples/V1/ChatServiceClient/complete_import_space.php new file mode 100644 index 000000000000..3a70907c0c48 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/complete_import_space.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CompleteImportSpaceResponse $response */ + $response = $chatServiceClient->completeImportSpace($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::spaceName('[SPACE]'); + + complete_import_space_sample($formattedName); +} +// [END chat_v1_generated_ChatService_CompleteImportSpace_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/create_membership.php b/AppsChat/samples/V1/ChatServiceClient/create_membership.php new file mode 100644 index 000000000000..35d568d65268 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/create_membership.php @@ -0,0 +1,99 @@ +setParent($formattedParent) + ->setMembership($membership); + + // Call the API and handle any network failures. + try { + /** @var Membership $response */ + $response = $chatServiceClient->createMembership($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 +{ + $formattedParent = ChatServiceClient::spaceName('[SPACE]'); + + create_membership_sample($formattedParent); +} +// [END chat_v1_generated_ChatService_CreateMembership_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/create_message.php b/AppsChat/samples/V1/ChatServiceClient/create_message.php new file mode 100644 index 000000000000..e3b75029111e --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/create_message.php @@ -0,0 +1,85 @@ +setParent($formattedParent) + ->setMessage($message); + + // Call the API and handle any network failures. + try { + /** @var Message $response */ + $response = $chatServiceClient->createMessage($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 +{ + $formattedParent = ChatServiceClient::spaceName('[SPACE]'); + + create_message_sample($formattedParent); +} +// [END chat_v1_generated_ChatService_CreateMessage_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/create_reaction.php b/AppsChat/samples/V1/ChatServiceClient/create_reaction.php new file mode 100644 index 000000000000..708a409cecff --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/create_reaction.php @@ -0,0 +1,80 @@ +setParent($formattedParent) + ->setReaction($reaction); + + // Call the API and handle any network failures. + try { + /** @var Reaction $response */ + $response = $chatServiceClient->createReaction($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 +{ + $formattedParent = ChatServiceClient::messageName('[SPACE]', '[MESSAGE]'); + + create_reaction_sample($formattedParent); +} +// [END chat_v1_generated_ChatService_CreateReaction_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/create_space.php b/AppsChat/samples/V1/ChatServiceClient/create_space.php new file mode 100644 index 000000000000..bd8d809c8ed3 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/create_space.php @@ -0,0 +1,68 @@ +setSpace($space); + + // Call the API and handle any network failures. + try { + /** @var Space $response */ + $response = $chatServiceClient->createSpace($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_CreateSpace_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/delete_membership.php b/AppsChat/samples/V1/ChatServiceClient/delete_membership.php new file mode 100644 index 000000000000..cb6d26d75502 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/delete_membership.php @@ -0,0 +1,89 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Membership $response */ + $response = $chatServiceClient->deleteMembership($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::membershipName('[SPACE]', '[MEMBER]'); + + delete_membership_sample($formattedName); +} +// [END chat_v1_generated_ChatService_DeleteMembership_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/delete_message.php b/AppsChat/samples/V1/ChatServiceClient/delete_message.php new file mode 100644 index 000000000000..4cba6f6cda36 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/delete_message.php @@ -0,0 +1,88 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $chatServiceClient->deleteMessage($request); + printf('Call completed successfully.' . PHP_EOL); + } 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::messageName('[SPACE]', '[MESSAGE]'); + + delete_message_sample($formattedName); +} +// [END chat_v1_generated_ChatService_DeleteMessage_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/delete_reaction.php b/AppsChat/samples/V1/ChatServiceClient/delete_reaction.php new file mode 100644 index 000000000000..ff8e837d34a5 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/delete_reaction.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $chatServiceClient->deleteReaction($request); + printf('Call completed successfully.' . PHP_EOL); + } 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::reactionName('[SPACE]', '[MESSAGE]', '[REACTION]'); + + delete_reaction_sample($formattedName); +} +// [END chat_v1_generated_ChatService_DeleteReaction_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/delete_space.php b/AppsChat/samples/V1/ChatServiceClient/delete_space.php new file mode 100644 index 000000000000..d5cb8b8e282c --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/delete_space.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $chatServiceClient->deleteSpace($request); + printf('Call completed successfully.' . PHP_EOL); + } 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::spaceName('[SPACE]'); + + delete_space_sample($formattedName); +} +// [END chat_v1_generated_ChatService_DeleteSpace_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/find_direct_message.php b/AppsChat/samples/V1/ChatServiceClient/find_direct_message.php new file mode 100644 index 000000000000..db4dd111f3d3 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/find_direct_message.php @@ -0,0 +1,100 @@ +setName($name); + + // Call the API and handle any network failures. + try { + /** @var Space $response */ + $response = $chatServiceClient->findDirectMessage($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 +{ + $name = '[NAME]'; + + find_direct_message_sample($name); +} +// [END chat_v1_generated_ChatService_FindDirectMessage_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/get_attachment.php b/AppsChat/samples/V1/ChatServiceClient/get_attachment.php new file mode 100644 index 000000000000..85ee10dc3ee9 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/get_attachment.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Attachment $response */ + $response = $chatServiceClient->getAttachment($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::attachmentName('[SPACE]', '[MESSAGE]', '[ATTACHMENT]'); + + get_attachment_sample($formattedName); +} +// [END chat_v1_generated_ChatService_GetAttachment_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/get_membership.php b/AppsChat/samples/V1/ChatServiceClient/get_membership.php new file mode 100644 index 000000000000..9465db39e203 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/get_membership.php @@ -0,0 +1,92 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Membership $response */ + $response = $chatServiceClient->getMembership($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::membershipName('[SPACE]', '[MEMBER]'); + + get_membership_sample($formattedName); +} +// [END chat_v1_generated_ChatService_GetMembership_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/get_message.php b/AppsChat/samples/V1/ChatServiceClient/get_message.php new file mode 100644 index 000000000000..b37e14eb6ae3 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/get_message.php @@ -0,0 +1,90 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Message $response */ + $response = $chatServiceClient->getMessage($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::messageName('[SPACE]', '[MESSAGE]'); + + get_message_sample($formattedName); +} +// [END chat_v1_generated_ChatService_GetMessage_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/get_space.php b/AppsChat/samples/V1/ChatServiceClient/get_space.php new file mode 100644 index 000000000000..ab28f86398dc --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/get_space.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Space $response */ + $response = $chatServiceClient->getSpace($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::spaceName('[SPACE]'); + + get_space_sample($formattedName); +} +// [END chat_v1_generated_ChatService_GetSpace_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/list_memberships.php b/AppsChat/samples/V1/ChatServiceClient/list_memberships.php new file mode 100644 index 000000000000..2b1320f8efb4 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/list_memberships.php @@ -0,0 +1,97 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $chatServiceClient->listMemberships($request); + + /** @var Membership $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->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 +{ + $formattedParent = ChatServiceClient::spaceName('[SPACE]'); + + list_memberships_sample($formattedParent); +} +// [END chat_v1_generated_ChatService_ListMemberships_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/list_messages.php b/AppsChat/samples/V1/ChatServiceClient/list_messages.php new file mode 100644 index 000000000000..ad08845a872f --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/list_messages.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $chatServiceClient->listMessages($request); + + /** @var Message $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->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 +{ + $formattedParent = ChatServiceClient::spaceName('[SPACE]'); + + list_messages_sample($formattedParent); +} +// [END chat_v1_generated_ChatService_ListMessages_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/list_reactions.php b/AppsChat/samples/V1/ChatServiceClient/list_reactions.php new file mode 100644 index 000000000000..316b53751c4d --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/list_reactions.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $chatServiceClient->listReactions($request); + + /** @var Reaction $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->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 +{ + $formattedParent = ChatServiceClient::messageName('[SPACE]', '[MESSAGE]'); + + list_reactions_sample($formattedParent); +} +// [END chat_v1_generated_ChatService_ListReactions_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/list_spaces.php b/AppsChat/samples/V1/ChatServiceClient/list_spaces.php new file mode 100644 index 000000000000..5dcafd1f2f21 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/list_spaces.php @@ -0,0 +1,76 @@ +listSpaces($request); + + /** @var Space $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END chat_v1_generated_ChatService_ListSpaces_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/set_up_space.php b/AppsChat/samples/V1/ChatServiceClient/set_up_space.php new file mode 100644 index 000000000000..c78a70abfe24 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/set_up_space.php @@ -0,0 +1,99 @@ +setSpace($space); + + // Call the API and handle any network failures. + try { + /** @var Space $response */ + $response = $chatServiceClient->setUpSpace($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_SetUpSpace_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/update_message.php b/AppsChat/samples/V1/ChatServiceClient/update_message.php new file mode 100644 index 000000000000..1f748c1d8a50 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/update_message.php @@ -0,0 +1,74 @@ +setMessage($message); + + // Call the API and handle any network failures. + try { + /** @var Message $response */ + $response = $chatServiceClient->updateMessage($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_UpdateMessage_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/update_space.php b/AppsChat/samples/V1/ChatServiceClient/update_space.php new file mode 100644 index 000000000000..a50b3fcfbeff --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/update_space.php @@ -0,0 +1,68 @@ +setSpace($space); + + // Call the API and handle any network failures. + try { + /** @var Space $response */ + $response = $chatServiceClient->updateSpace($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_UpdateSpace_sync] diff --git a/AppsChat/samples/V1/ChatServiceClient/upload_attachment.php b/AppsChat/samples/V1/ChatServiceClient/upload_attachment.php new file mode 100644 index 000000000000..5312833b0722 --- /dev/null +++ b/AppsChat/samples/V1/ChatServiceClient/upload_attachment.php @@ -0,0 +1,83 @@ +setParent($formattedParent) + ->setFilename($filename); + + // Call the API and handle any network failures. + try { + /** @var UploadAttachmentResponse $response */ + $response = $chatServiceClient->uploadAttachment($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 +{ + $formattedParent = ChatServiceClient::spaceName('[SPACE]'); + $filename = '[FILENAME]'; + + upload_attachment_sample($formattedParent, $filename); +} +// [END chat_v1_generated_ChatService_UploadAttachment_sync] diff --git a/AppsChat/src/Card/V1/Action.php b/AppsChat/src/Card/V1/Action.php new file mode 100644 index 000000000000..b580ebad2ebc --- /dev/null +++ b/AppsChat/src/Card/V1/Action.php @@ -0,0 +1,331 @@ +google.apps.card.v1.Action + */ +class Action extends \Google\Protobuf\Internal\Message +{ + /** + * A custom function to invoke when the containing element is + * clicked or othrwise activated. + * For example usage, see [Read form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string function = 1; + */ + protected $function = ''; + /** + * List of action parameters. + * + * Generated from protobuf field repeated .google.apps.card.v1.Action.ActionParameter parameters = 2; + */ + private $parameters; + /** + * Specifies the loading indicator that the action displays while + * making the call to the action. + * + * Generated from protobuf field .google.apps.card.v1.Action.LoadIndicator load_indicator = 3; + */ + protected $load_indicator = 0; + /** + * Indicates whether form values persist after the action. The default value + * is `false`. + * If `true`, form values remain after the action is triggered. To let the + * user make changes while the action is being processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `NONE`. For [card + * messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/create#create) + * in Chat apps, you must also set the action's + * [`ResponseType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#responsetype) + * to `UPDATE_MESSAGE` and use the same + * [`card_id`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId) + * from the card that contained the action. + * If `false`, the form values are cleared when the action is triggered. + * To prevent the user from making changes while the action is being + * processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `SPINNER`. + * + * Generated from protobuf field bool persist_values = 4; + */ + protected $persist_values = false; + /** + * Optional. Required when opening a + * [dialog](https://developers.google.com/workspace/chat/dialogs). + * What to do in response to an interaction with a user, such as a user + * clicking a button in a card message. + * If unspecified, the app responds by executing an `action`—like opening a + * link or running a function—as normal. + * By specifying an `interaction`, the app can respond in special interactive + * ways. For example, by setting `interaction` to `OPEN_DIALOG`, the app can + * open a [dialog](https://developers.google.com/workspace/chat/dialogs). When + * specified, a loading indicator isn't shown. If specified for + * an add-on, the entire card is stripped and nothing is shown in the client. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field .google.apps.card.v1.Action.Interaction interaction = 5; + */ + protected $interaction = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $function + * A custom function to invoke when the containing element is + * clicked or othrwise activated. + * For example usage, see [Read form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type array<\Google\Apps\Card\V1\Action\ActionParameter>|\Google\Protobuf\Internal\RepeatedField $parameters + * List of action parameters. + * @type int $load_indicator + * Specifies the loading indicator that the action displays while + * making the call to the action. + * @type bool $persist_values + * Indicates whether form values persist after the action. The default value + * is `false`. + * If `true`, form values remain after the action is triggered. To let the + * user make changes while the action is being processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `NONE`. For [card + * messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/create#create) + * in Chat apps, you must also set the action's + * [`ResponseType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#responsetype) + * to `UPDATE_MESSAGE` and use the same + * [`card_id`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId) + * from the card that contained the action. + * If `false`, the form values are cleared when the action is triggered. + * To prevent the user from making changes while the action is being + * processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `SPINNER`. + * @type int $interaction + * Optional. Required when opening a + * [dialog](https://developers.google.com/workspace/chat/dialogs). + * What to do in response to an interaction with a user, such as a user + * clicking a button in a card message. + * If unspecified, the app responds by executing an `action`—like opening a + * link or running a function—as normal. + * By specifying an `interaction`, the app can respond in special interactive + * ways. For example, by setting `interaction` to `OPEN_DIALOG`, the app can + * open a [dialog](https://developers.google.com/workspace/chat/dialogs). When + * specified, a loading indicator isn't shown. If specified for + * an add-on, the entire card is stripped and nothing is shown in the client. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * A custom function to invoke when the containing element is + * clicked or othrwise activated. + * For example usage, see [Read form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string function = 1; + * @return string + */ + public function getFunction() + { + return $this->function; + } + + /** + * A custom function to invoke when the containing element is + * clicked or othrwise activated. + * For example usage, see [Read form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string function = 1; + * @param string $var + * @return $this + */ + public function setFunction($var) + { + GPBUtil::checkString($var, True); + $this->function = $var; + + return $this; + } + + /** + * List of action parameters. + * + * Generated from protobuf field repeated .google.apps.card.v1.Action.ActionParameter parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * List of action parameters. + * + * Generated from protobuf field repeated .google.apps.card.v1.Action.ActionParameter parameters = 2; + * @param array<\Google\Apps\Card\V1\Action\ActionParameter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Action\ActionParameter::class); + $this->parameters = $arr; + + return $this; + } + + /** + * Specifies the loading indicator that the action displays while + * making the call to the action. + * + * Generated from protobuf field .google.apps.card.v1.Action.LoadIndicator load_indicator = 3; + * @return int + */ + public function getLoadIndicator() + { + return $this->load_indicator; + } + + /** + * Specifies the loading indicator that the action displays while + * making the call to the action. + * + * Generated from protobuf field .google.apps.card.v1.Action.LoadIndicator load_indicator = 3; + * @param int $var + * @return $this + */ + public function setLoadIndicator($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Action\LoadIndicator::class); + $this->load_indicator = $var; + + return $this; + } + + /** + * Indicates whether form values persist after the action. The default value + * is `false`. + * If `true`, form values remain after the action is triggered. To let the + * user make changes while the action is being processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `NONE`. For [card + * messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/create#create) + * in Chat apps, you must also set the action's + * [`ResponseType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#responsetype) + * to `UPDATE_MESSAGE` and use the same + * [`card_id`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId) + * from the card that contained the action. + * If `false`, the form values are cleared when the action is triggered. + * To prevent the user from making changes while the action is being + * processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `SPINNER`. + * + * Generated from protobuf field bool persist_values = 4; + * @return bool + */ + public function getPersistValues() + { + return $this->persist_values; + } + + /** + * Indicates whether form values persist after the action. The default value + * is `false`. + * If `true`, form values remain after the action is triggered. To let the + * user make changes while the action is being processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `NONE`. For [card + * messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/create#create) + * in Chat apps, you must also set the action's + * [`ResponseType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#responsetype) + * to `UPDATE_MESSAGE` and use the same + * [`card_id`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages#CardWithId) + * from the card that contained the action. + * If `false`, the form values are cleared when the action is triggered. + * To prevent the user from making changes while the action is being + * processed, set + * [`LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) + * to `SPINNER`. + * + * Generated from protobuf field bool persist_values = 4; + * @param bool $var + * @return $this + */ + public function setPersistValues($var) + { + GPBUtil::checkBool($var); + $this->persist_values = $var; + + return $this; + } + + /** + * Optional. Required when opening a + * [dialog](https://developers.google.com/workspace/chat/dialogs). + * What to do in response to an interaction with a user, such as a user + * clicking a button in a card message. + * If unspecified, the app responds by executing an `action`—like opening a + * link or running a function—as normal. + * By specifying an `interaction`, the app can respond in special interactive + * ways. For example, by setting `interaction` to `OPEN_DIALOG`, the app can + * open a [dialog](https://developers.google.com/workspace/chat/dialogs). When + * specified, a loading indicator isn't shown. If specified for + * an add-on, the entire card is stripped and nothing is shown in the client. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field .google.apps.card.v1.Action.Interaction interaction = 5; + * @return int + */ + public function getInteraction() + { + return $this->interaction; + } + + /** + * Optional. Required when opening a + * [dialog](https://developers.google.com/workspace/chat/dialogs). + * What to do in response to an interaction with a user, such as a user + * clicking a button in a card message. + * If unspecified, the app responds by executing an `action`—like opening a + * link or running a function—as normal. + * By specifying an `interaction`, the app can respond in special interactive + * ways. For example, by setting `interaction` to `OPEN_DIALOG`, the app can + * open a [dialog](https://developers.google.com/workspace/chat/dialogs). When + * specified, a loading indicator isn't shown. If specified for + * an add-on, the entire card is stripped and nothing is shown in the client. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field .google.apps.card.v1.Action.Interaction interaction = 5; + * @param int $var + * @return $this + */ + public function setInteraction($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Action\Interaction::class); + $this->interaction = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Action/ActionParameter.php b/AppsChat/src/Card/V1/Action/ActionParameter.php new file mode 100644 index 000000000000..f9e28abd76d6 --- /dev/null +++ b/AppsChat/src/Card/V1/Action/ActionParameter.php @@ -0,0 +1,109 @@ +google.apps.card.v1.Action.ActionParameter + */ +class ActionParameter extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the parameter for the action script. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The value of the parameter. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The name of the parameter for the action script. + * @type string $value + * The value of the parameter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The name of the parameter for the action script. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The name of the parameter for the action script. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The value of the parameter. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the parameter. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Action/Interaction.php b/AppsChat/src/Card/V1/Action/Interaction.php new file mode 100644 index 000000000000..8e173f078cbe --- /dev/null +++ b/AppsChat/src/Card/V1/Action/Interaction.php @@ -0,0 +1,72 @@ +google.apps.card.v1.Action.Interaction + */ +class Interaction +{ + /** + * Default value. The `action` executes as normal. + * + * Generated from protobuf enum INTERACTION_UNSPECIFIED = 0; + */ + const INTERACTION_UNSPECIFIED = 0; + /** + * Opens a [dialog](https://developers.google.com/workspace/chat/dialogs), a + * windowed, card-based interface that Chat apps use to interact with users. + * Only supported by Chat apps in response to button-clicks on card + * messages. If specified for + * an add-on, the entire card is stripped and nothing is shown in the + * client. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf enum OPEN_DIALOG = 1; + */ + const OPEN_DIALOG = 1; + + private static $valueToName = [ + self::INTERACTION_UNSPECIFIED => 'INTERACTION_UNSPECIFIED', + self::OPEN_DIALOG => 'OPEN_DIALOG', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Action/LoadIndicator.php b/AppsChat/src/Card/V1/Action/LoadIndicator.php new file mode 100644 index 000000000000..cfb8070bcfdb --- /dev/null +++ b/AppsChat/src/Card/V1/Action/LoadIndicator.php @@ -0,0 +1,58 @@ +google.apps.card.v1.Action.LoadIndicator + */ +class LoadIndicator +{ + /** + * Displays a spinner to indicate that content is loading. + * + * Generated from protobuf enum SPINNER = 0; + */ + const SPINNER = 0; + /** + * Nothing is displayed. + * + * Generated from protobuf enum NONE = 1; + */ + const NONE = 1; + + private static $valueToName = [ + self::SPINNER => 'SPINNER', + self::NONE => 'NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/BorderStyle.php b/AppsChat/src/Card/V1/BorderStyle.php new file mode 100644 index 000000000000..4cf88c737048 --- /dev/null +++ b/AppsChat/src/Card/V1/BorderStyle.php @@ -0,0 +1,148 @@ +google.apps.card.v1.BorderStyle + */ +class BorderStyle extends \Google\Protobuf\Internal\Message +{ + /** + * The border type. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle.BorderType type = 1; + */ + protected $type = 0; + /** + * The colors to use when the type is `BORDER_TYPE_STROKE`. + * + * Generated from protobuf field .google.type.Color stroke_color = 2; + */ + protected $stroke_color = null; + /** + * The corner radius for the border. + * + * Generated from protobuf field int32 corner_radius = 3; + */ + protected $corner_radius = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The border type. + * @type \Google\Type\Color $stroke_color + * The colors to use when the type is `BORDER_TYPE_STROKE`. + * @type int $corner_radius + * The corner radius for the border. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The border type. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle.BorderType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The border type. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle.BorderType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\BorderStyle\BorderType::class); + $this->type = $var; + + return $this; + } + + /** + * The colors to use when the type is `BORDER_TYPE_STROKE`. + * + * Generated from protobuf field .google.type.Color stroke_color = 2; + * @return \Google\Type\Color|null + */ + public function getStrokeColor() + { + return $this->stroke_color; + } + + public function hasStrokeColor() + { + return isset($this->stroke_color); + } + + public function clearStrokeColor() + { + unset($this->stroke_color); + } + + /** + * The colors to use when the type is `BORDER_TYPE_STROKE`. + * + * Generated from protobuf field .google.type.Color stroke_color = 2; + * @param \Google\Type\Color $var + * @return $this + */ + public function setStrokeColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->stroke_color = $var; + + return $this; + } + + /** + * The corner radius for the border. + * + * Generated from protobuf field int32 corner_radius = 3; + * @return int + */ + public function getCornerRadius() + { + return $this->corner_radius; + } + + /** + * The corner radius for the border. + * + * Generated from protobuf field int32 corner_radius = 3; + * @param int $var + * @return $this + */ + public function setCornerRadius($var) + { + GPBUtil::checkInt32($var); + $this->corner_radius = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/BorderStyle/BorderType.php b/AppsChat/src/Card/V1/BorderStyle/BorderType.php new file mode 100644 index 000000000000..63f69e7726ec --- /dev/null +++ b/AppsChat/src/Card/V1/BorderStyle/BorderType.php @@ -0,0 +1,64 @@ +google.apps.card.v1.BorderStyle.BorderType + */ +class BorderType +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum BORDER_TYPE_UNSPECIFIED = 0; + */ + const BORDER_TYPE_UNSPECIFIED = 0; + /** + * Default value. No border. + * + * Generated from protobuf enum NO_BORDER = 1; + */ + const NO_BORDER = 1; + /** + * Outline. + * + * Generated from protobuf enum STROKE = 2; + */ + const STROKE = 2; + + private static $valueToName = [ + self::BORDER_TYPE_UNSPECIFIED => 'BORDER_TYPE_UNSPECIFIED', + self::NO_BORDER => 'NO_BORDER', + self::STROKE => 'STROKE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Button.php b/AppsChat/src/Card/V1/Button.php new file mode 100644 index 000000000000..8e966b18cf47 --- /dev/null +++ b/AppsChat/src/Card/V1/Button.php @@ -0,0 +1,400 @@ +google.apps.card.v1.Button + */ +class Button extends \Google\Protobuf\Internal\Message +{ + /** + * The text displayed inside the button. + * + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + /** + * The icon image. If both `icon` and `text` are set, then the icon appears + * before the text. + * + * Generated from protobuf field .google.apps.card.v1.Icon icon = 2; + */ + protected $icon = null; + /** + * If set, the button is filled with a solid background color and the font + * color changes to maintain contrast with the background color. For example, + * setting a blue background likely results in white text. + * If unset, the image background is white and the font color is blue. + * For red, green, and blue, the value of each field is a `float` number that + * you can express in either of two ways: as a number between 0 and 255 + * divided by 255 (153/255), or as a value between 0 and 1 (0.6). 0 represents + * the absence of a color and 1 or 255/255 represent the full presence of that + * color on the RGB scale. + * Optionally set `alpha`, which sets a level of transparency using this + * equation: + * ``` + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * ``` + * For `alpha`, a value of `1` corresponds with a solid color, and a value of + * `0` corresponds with a completely transparent color. + * For example, the following color represents a half transparent red: + * ``` + * "color": { + * "red": 1, + * "green": 0, + * "blue": 0, + * "alpha": 0.5 + * } + * ``` + * + * Generated from protobuf field .google.type.Color color = 3; + */ + protected $color = null; + /** + * Required. The action to perform when a user clicks the button, such as + * opening a hyperlink or running a custom function. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 4; + */ + protected $on_click = null; + /** + * If `true`, the button is displayed in an inactive state and doesn't respond + * to user actions. + * + * Generated from protobuf field bool disabled = 5; + */ + protected $disabled = false; + /** + * The alternative text that's used for accessibility. + * Set descriptive text that lets users know what the button does. For + * example, if a button opens a hyperlink, you might write: "Opens a new + * browser tab and navigates to the Google Chat developer documentation at + * https://developers.google.com/workspace/chat". + * + * Generated from protobuf field string alt_text = 6; + */ + protected $alt_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The text displayed inside the button. + * @type \Google\Apps\Card\V1\Icon $icon + * The icon image. If both `icon` and `text` are set, then the icon appears + * before the text. + * @type \Google\Type\Color $color + * If set, the button is filled with a solid background color and the font + * color changes to maintain contrast with the background color. For example, + * setting a blue background likely results in white text. + * If unset, the image background is white and the font color is blue. + * For red, green, and blue, the value of each field is a `float` number that + * you can express in either of two ways: as a number between 0 and 255 + * divided by 255 (153/255), or as a value between 0 and 1 (0.6). 0 represents + * the absence of a color and 1 or 255/255 represent the full presence of that + * color on the RGB scale. + * Optionally set `alpha`, which sets a level of transparency using this + * equation: + * ``` + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * ``` + * For `alpha`, a value of `1` corresponds with a solid color, and a value of + * `0` corresponds with a completely transparent color. + * For example, the following color represents a half transparent red: + * ``` + * "color": { + * "red": 1, + * "green": 0, + * "blue": 0, + * "alpha": 0.5 + * } + * ``` + * @type \Google\Apps\Card\V1\OnClick $on_click + * Required. The action to perform when a user clicks the button, such as + * opening a hyperlink or running a custom function. + * @type bool $disabled + * If `true`, the button is displayed in an inactive state and doesn't respond + * to user actions. + * @type string $alt_text + * The alternative text that's used for accessibility. + * Set descriptive text that lets users know what the button does. For + * example, if a button opens a hyperlink, you might write: "Opens a new + * browser tab and navigates to the Google Chat developer documentation at + * https://developers.google.com/workspace/chat". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The text displayed inside the button. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The text displayed inside the button. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * The icon image. If both `icon` and `text` are set, then the icon appears + * before the text. + * + * Generated from protobuf field .google.apps.card.v1.Icon icon = 2; + * @return \Google\Apps\Card\V1\Icon|null + */ + public function getIcon() + { + return $this->icon; + } + + public function hasIcon() + { + return isset($this->icon); + } + + public function clearIcon() + { + unset($this->icon); + } + + /** + * The icon image. If both `icon` and `text` are set, then the icon appears + * before the text. + * + * Generated from protobuf field .google.apps.card.v1.Icon icon = 2; + * @param \Google\Apps\Card\V1\Icon $var + * @return $this + */ + public function setIcon($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Icon::class); + $this->icon = $var; + + return $this; + } + + /** + * If set, the button is filled with a solid background color and the font + * color changes to maintain contrast with the background color. For example, + * setting a blue background likely results in white text. + * If unset, the image background is white and the font color is blue. + * For red, green, and blue, the value of each field is a `float` number that + * you can express in either of two ways: as a number between 0 and 255 + * divided by 255 (153/255), or as a value between 0 and 1 (0.6). 0 represents + * the absence of a color and 1 or 255/255 represent the full presence of that + * color on the RGB scale. + * Optionally set `alpha`, which sets a level of transparency using this + * equation: + * ``` + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * ``` + * For `alpha`, a value of `1` corresponds with a solid color, and a value of + * `0` corresponds with a completely transparent color. + * For example, the following color represents a half transparent red: + * ``` + * "color": { + * "red": 1, + * "green": 0, + * "blue": 0, + * "alpha": 0.5 + * } + * ``` + * + * Generated from protobuf field .google.type.Color color = 3; + * @return \Google\Type\Color|null + */ + public function getColor() + { + return $this->color; + } + + public function hasColor() + { + return isset($this->color); + } + + public function clearColor() + { + unset($this->color); + } + + /** + * If set, the button is filled with a solid background color and the font + * color changes to maintain contrast with the background color. For example, + * setting a blue background likely results in white text. + * If unset, the image background is white and the font color is blue. + * For red, green, and blue, the value of each field is a `float` number that + * you can express in either of two ways: as a number between 0 and 255 + * divided by 255 (153/255), or as a value between 0 and 1 (0.6). 0 represents + * the absence of a color and 1 or 255/255 represent the full presence of that + * color on the RGB scale. + * Optionally set `alpha`, which sets a level of transparency using this + * equation: + * ``` + * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + * ``` + * For `alpha`, a value of `1` corresponds with a solid color, and a value of + * `0` corresponds with a completely transparent color. + * For example, the following color represents a half transparent red: + * ``` + * "color": { + * "red": 1, + * "green": 0, + * "blue": 0, + * "alpha": 0.5 + * } + * ``` + * + * Generated from protobuf field .google.type.Color color = 3; + * @param \Google\Type\Color $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->color = $var; + + return $this; + } + + /** + * Required. The action to perform when a user clicks the button, such as + * opening a hyperlink or running a custom function. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 4; + * @return \Google\Apps\Card\V1\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * Required. The action to perform when a user clicks the button, such as + * opening a hyperlink or running a custom function. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 4; + * @param \Google\Apps\Card\V1\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\OnClick::class); + $this->on_click = $var; + + return $this; + } + + /** + * If `true`, the button is displayed in an inactive state and doesn't respond + * to user actions. + * + * Generated from protobuf field bool disabled = 5; + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * If `true`, the button is displayed in an inactive state and doesn't respond + * to user actions. + * + * Generated from protobuf field bool disabled = 5; + * @param bool $var + * @return $this + */ + public function setDisabled($var) + { + GPBUtil::checkBool($var); + $this->disabled = $var; + + return $this; + } + + /** + * The alternative text that's used for accessibility. + * Set descriptive text that lets users know what the button does. For + * example, if a button opens a hyperlink, you might write: "Opens a new + * browser tab and navigates to the Google Chat developer documentation at + * https://developers.google.com/workspace/chat". + * + * Generated from protobuf field string alt_text = 6; + * @return string + */ + public function getAltText() + { + return $this->alt_text; + } + + /** + * The alternative text that's used for accessibility. + * Set descriptive text that lets users know what the button does. For + * example, if a button opens a hyperlink, you might write: "Opens a new + * browser tab and navigates to the Google Chat developer documentation at + * https://developers.google.com/workspace/chat". + * + * Generated from protobuf field string alt_text = 6; + * @param string $var + * @return $this + */ + public function setAltText($var) + { + GPBUtil::checkString($var, True); + $this->alt_text = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/ButtonList.php b/AppsChat/src/Card/V1/ButtonList.php new file mode 100644 index 000000000000..10b74b56debe --- /dev/null +++ b/AppsChat/src/Card/V1/ButtonList.php @@ -0,0 +1,72 @@ +google.apps.card.v1.ButtonList + */ +class ButtonList extends \Google\Protobuf\Internal\Message +{ + /** + * An array of buttons. + * + * Generated from protobuf field repeated .google.apps.card.v1.Button buttons = 1; + */ + private $buttons; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Card\V1\Button>|\Google\Protobuf\Internal\RepeatedField $buttons + * An array of buttons. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * An array of buttons. + * + * Generated from protobuf field repeated .google.apps.card.v1.Button buttons = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getButtons() + { + return $this->buttons; + } + + /** + * An array of buttons. + * + * Generated from protobuf field repeated .google.apps.card.v1.Button buttons = 1; + * @param array<\Google\Apps\Card\V1\Button>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setButtons($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Button::class); + $this->buttons = $arr; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Card.php b/AppsChat/src/Card/V1/Card.php new file mode 100644 index 000000000000..75ffe057a2b8 --- /dev/null +++ b/AppsChat/src/Card/V1/Card.php @@ -0,0 +1,638 @@ +Online" + * } + * }, + * { + * "decoratedText": { + * "startIcon": { + * "knownIcon": "PHONE" + * }, + * "text": "+1 (555) 555-1234" + * } + * }, + * { + * "buttonList": { + * "buttons": [ + * { + * "text": "Share", + * "onClick": { + * "openLink": { + * "url": "https://example.com/share" + * } + * } + * }, + * { + * "text": "Edit", + * "onClick": { + * "action": { + * "function": "goToView", + * "parameters": [ + * { + * "key": "viewType", + * "value": "EDIT" + * } + * ] + * } + * } + * } + * ] + * } + * } + * ] + * } + * ] + * } + * } + * ] + * } + * ``` + * + * Generated from protobuf message google.apps.card.v1.Card + */ +class Card extends \Google\Protobuf\Internal\Message +{ + /** + * The header of the card. A header usually contains a leading image and a + * title. Headers always appear at the top of a card. + * + * Generated from protobuf field .google.apps.card.v1.Card.CardHeader header = 1; + */ + protected $header = null; + /** + * Contains a collection of widgets. Each section has its own, optional + * header. Sections are visually separated by a line divider. For an example + * in Google Chat apps, see [Define a section of a + * card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card). + * + * Generated from protobuf field repeated .google.apps.card.v1.Card.Section sections = 2; + */ + private $sections; + /** + * The divider style between sections. + * + * Generated from protobuf field .google.apps.card.v1.Card.DividerStyle section_divider_style = 9; + */ + protected $section_divider_style = 0; + /** + * The card's actions. Actions are added to the card's toolbar menu. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * For example, the following JSON constructs a card action menu with + * `Settings` and `Send Feedback` options: + * ``` + * "card_actions": [ + * { + * "actionLabel": "Settings", + * "onClick": { + * "action": { + * "functionName": "goToView", + * "parameters": [ + * { + * "key": "viewType", + * "value": "SETTING" + * } + * ], + * "loadIndicator": "LoadIndicator.SPINNER" + * } + * } + * }, + * { + * "actionLabel": "Send Feedback", + * "onClick": { + * "openLink": { + * "url": "https://example.com/feedback" + * } + * } + * } + * ] + * ``` + * + * Generated from protobuf field repeated .google.apps.card.v1.Card.CardAction card_actions = 3; + */ + private $card_actions; + /** + * Name of the card. Used as a card identifier in card navigation. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field string name = 4; + */ + protected $name = ''; + /** + * The fixed footer shown at the bottom of this card. + * Setting `fixedFooter` without specifying a `primaryButton` or a + * `secondaryButton` causes an error. For Chat apps, you can use fixed footers + * in + * [dialogs](https://developers.google.com/workspace/chat/dialogs), but not + * [card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5; + */ + protected $fixed_footer = null; + /** + * In Google Workspace Add-ons, sets the display properties of the + * `peekCardHeader`. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card.DisplayStyle display_style = 6; + */ + protected $display_style = 0; + /** + * When displaying contextual content, the peek card header acts as a + * placeholder so that the user can navigate forward between the homepage + * cards and the contextual cards. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card.CardHeader peek_card_header = 7; + */ + protected $peek_card_header = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\Card\CardHeader $header + * The header of the card. A header usually contains a leading image and a + * title. Headers always appear at the top of a card. + * @type array<\Google\Apps\Card\V1\Card\Section>|\Google\Protobuf\Internal\RepeatedField $sections + * Contains a collection of widgets. Each section has its own, optional + * header. Sections are visually separated by a line divider. For an example + * in Google Chat apps, see [Define a section of a + * card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card). + * @type int $section_divider_style + * The divider style between sections. + * @type array<\Google\Apps\Card\V1\Card\CardAction>|\Google\Protobuf\Internal\RepeatedField $card_actions + * The card's actions. Actions are added to the card's toolbar menu. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * For example, the following JSON constructs a card action menu with + * `Settings` and `Send Feedback` options: + * ``` + * "card_actions": [ + * { + * "actionLabel": "Settings", + * "onClick": { + * "action": { + * "functionName": "goToView", + * "parameters": [ + * { + * "key": "viewType", + * "value": "SETTING" + * } + * ], + * "loadIndicator": "LoadIndicator.SPINNER" + * } + * } + * }, + * { + * "actionLabel": "Send Feedback", + * "onClick": { + * "openLink": { + * "url": "https://example.com/feedback" + * } + * } + * } + * ] + * ``` + * @type string $name + * Name of the card. Used as a card identifier in card navigation. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * @type \Google\Apps\Card\V1\Card\CardFixedFooter $fixed_footer + * The fixed footer shown at the bottom of this card. + * Setting `fixedFooter` without specifying a `primaryButton` or a + * `secondaryButton` causes an error. For Chat apps, you can use fixed footers + * in + * [dialogs](https://developers.google.com/workspace/chat/dialogs), but not + * [card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * @type int $display_style + * In Google Workspace Add-ons, sets the display properties of the + * `peekCardHeader`. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * @type \Google\Apps\Card\V1\Card\CardHeader $peek_card_header + * When displaying contextual content, the peek card header acts as a + * placeholder so that the user can navigate forward between the homepage + * cards and the contextual cards. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The header of the card. A header usually contains a leading image and a + * title. Headers always appear at the top of a card. + * + * Generated from protobuf field .google.apps.card.v1.Card.CardHeader header = 1; + * @return \Google\Apps\Card\V1\Card\CardHeader|null + */ + public function getHeader() + { + return $this->header; + } + + public function hasHeader() + { + return isset($this->header); + } + + public function clearHeader() + { + unset($this->header); + } + + /** + * The header of the card. A header usually contains a leading image and a + * title. Headers always appear at the top of a card. + * + * Generated from protobuf field .google.apps.card.v1.Card.CardHeader header = 1; + * @param \Google\Apps\Card\V1\Card\CardHeader $var + * @return $this + */ + public function setHeader($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Card\CardHeader::class); + $this->header = $var; + + return $this; + } + + /** + * Contains a collection of widgets. Each section has its own, optional + * header. Sections are visually separated by a line divider. For an example + * in Google Chat apps, see [Define a section of a + * card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card). + * + * Generated from protobuf field repeated .google.apps.card.v1.Card.Section sections = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSections() + { + return $this->sections; + } + + /** + * Contains a collection of widgets. Each section has its own, optional + * header. Sections are visually separated by a line divider. For an example + * in Google Chat apps, see [Define a section of a + * card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card). + * + * Generated from protobuf field repeated .google.apps.card.v1.Card.Section sections = 2; + * @param array<\Google\Apps\Card\V1\Card\Section>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Card\Section::class); + $this->sections = $arr; + + return $this; + } + + /** + * The divider style between sections. + * + * Generated from protobuf field .google.apps.card.v1.Card.DividerStyle section_divider_style = 9; + * @return int + */ + public function getSectionDividerStyle() + { + return $this->section_divider_style; + } + + /** + * The divider style between sections. + * + * Generated from protobuf field .google.apps.card.v1.Card.DividerStyle section_divider_style = 9; + * @param int $var + * @return $this + */ + public function setSectionDividerStyle($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Card\DividerStyle::class); + $this->section_divider_style = $var; + + return $this; + } + + /** + * The card's actions. Actions are added to the card's toolbar menu. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * For example, the following JSON constructs a card action menu with + * `Settings` and `Send Feedback` options: + * ``` + * "card_actions": [ + * { + * "actionLabel": "Settings", + * "onClick": { + * "action": { + * "functionName": "goToView", + * "parameters": [ + * { + * "key": "viewType", + * "value": "SETTING" + * } + * ], + * "loadIndicator": "LoadIndicator.SPINNER" + * } + * } + * }, + * { + * "actionLabel": "Send Feedback", + * "onClick": { + * "openLink": { + * "url": "https://example.com/feedback" + * } + * } + * } + * ] + * ``` + * + * Generated from protobuf field repeated .google.apps.card.v1.Card.CardAction card_actions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCardActions() + { + return $this->card_actions; + } + + /** + * The card's actions. Actions are added to the card's toolbar menu. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * For example, the following JSON constructs a card action menu with + * `Settings` and `Send Feedback` options: + * ``` + * "card_actions": [ + * { + * "actionLabel": "Settings", + * "onClick": { + * "action": { + * "functionName": "goToView", + * "parameters": [ + * { + * "key": "viewType", + * "value": "SETTING" + * } + * ], + * "loadIndicator": "LoadIndicator.SPINNER" + * } + * } + * }, + * { + * "actionLabel": "Send Feedback", + * "onClick": { + * "openLink": { + * "url": "https://example.com/feedback" + * } + * } + * } + * ] + * ``` + * + * Generated from protobuf field repeated .google.apps.card.v1.Card.CardAction card_actions = 3; + * @param array<\Google\Apps\Card\V1\Card\CardAction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCardActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Card\CardAction::class); + $this->card_actions = $arr; + + return $this; + } + + /** + * Name of the card. Used as a card identifier in card navigation. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field string name = 4; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the card. Used as a card identifier in card navigation. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field string name = 4; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The fixed footer shown at the bottom of this card. + * Setting `fixedFooter` without specifying a `primaryButton` or a + * `secondaryButton` causes an error. For Chat apps, you can use fixed footers + * in + * [dialogs](https://developers.google.com/workspace/chat/dialogs), but not + * [card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5; + * @return \Google\Apps\Card\V1\Card\CardFixedFooter|null + */ + public function getFixedFooter() + { + return $this->fixed_footer; + } + + public function hasFixedFooter() + { + return isset($this->fixed_footer); + } + + public function clearFixedFooter() + { + unset($this->fixed_footer); + } + + /** + * The fixed footer shown at the bottom of this card. + * Setting `fixedFooter` without specifying a `primaryButton` or a + * `secondaryButton` causes an error. For Chat apps, you can use fixed footers + * in + * [dialogs](https://developers.google.com/workspace/chat/dialogs), but not + * [card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5; + * @param \Google\Apps\Card\V1\Card\CardFixedFooter $var + * @return $this + */ + public function setFixedFooter($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Card\CardFixedFooter::class); + $this->fixed_footer = $var; + + return $this; + } + + /** + * In Google Workspace Add-ons, sets the display properties of the + * `peekCardHeader`. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card.DisplayStyle display_style = 6; + * @return int + */ + public function getDisplayStyle() + { + return $this->display_style; + } + + /** + * In Google Workspace Add-ons, sets the display properties of the + * `peekCardHeader`. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card.DisplayStyle display_style = 6; + * @param int $var + * @return $this + */ + public function setDisplayStyle($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Card\DisplayStyle::class); + $this->display_style = $var; + + return $this; + } + + /** + * When displaying contextual content, the peek card header acts as a + * placeholder so that the user can navigate forward between the homepage + * cards and the contextual cards. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card.CardHeader peek_card_header = 7; + * @return \Google\Apps\Card\V1\Card\CardHeader|null + */ + public function getPeekCardHeader() + { + return $this->peek_card_header; + } + + public function hasPeekCardHeader() + { + return isset($this->peek_card_header); + } + + public function clearPeekCardHeader() + { + unset($this->peek_card_header); + } + + /** + * When displaying contextual content, the peek card header acts as a + * placeholder so that the user can navigate forward between the homepage + * cards and the contextual cards. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card.CardHeader peek_card_header = 7; + * @param \Google\Apps\Card\V1\Card\CardHeader $var + * @return $this + */ + public function setPeekCardHeader($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Card\CardHeader::class); + $this->peek_card_header = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Card/CardAction.php b/AppsChat/src/Card/V1/Card/CardAction.php new file mode 100644 index 000000000000..42ec91741486 --- /dev/null +++ b/AppsChat/src/Card/V1/Card/CardAction.php @@ -0,0 +1,116 @@ +google.apps.card.v1.Card.CardAction + */ +class CardAction extends \Google\Protobuf\Internal\Message +{ + /** + * The label that displays as the action menu item. + * + * Generated from protobuf field string action_label = 1; + */ + protected $action_label = ''; + /** + * The `onClick` action for this action item. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 2; + */ + protected $on_click = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action_label + * The label that displays as the action menu item. + * @type \Google\Apps\Card\V1\OnClick $on_click + * The `onClick` action for this action item. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The label that displays as the action menu item. + * + * Generated from protobuf field string action_label = 1; + * @return string + */ + public function getActionLabel() + { + return $this->action_label; + } + + /** + * The label that displays as the action menu item. + * + * Generated from protobuf field string action_label = 1; + * @param string $var + * @return $this + */ + public function setActionLabel($var) + { + GPBUtil::checkString($var, True); + $this->action_label = $var; + + return $this; + } + + /** + * The `onClick` action for this action item. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 2; + * @return \Google\Apps\Card\V1\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * The `onClick` action for this action item. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 2; + * @param \Google\Apps\Card\V1\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\OnClick::class); + $this->on_click = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Card/CardFixedFooter.php b/AppsChat/src/Card/V1/Card/CardFixedFooter.php new file mode 100644 index 000000000000..7cd59d1a1fd3 --- /dev/null +++ b/AppsChat/src/Card/V1/Card/CardFixedFooter.php @@ -0,0 +1,144 @@ +google.apps.card.v1.Card.CardFixedFooter + */ +class CardFixedFooter extends \Google\Protobuf\Internal\Message +{ + /** + * The primary button of the fixed footer. The button must be a text button + * with text and color set. + * + * Generated from protobuf field .google.apps.card.v1.Button primary_button = 1; + */ + protected $primary_button = null; + /** + * The secondary button of the fixed footer. The button must be a text + * button with text and color set. + * If `secondaryButton` is set, you must also set `primaryButton`. + * + * Generated from protobuf field .google.apps.card.v1.Button secondary_button = 2; + */ + protected $secondary_button = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\Button $primary_button + * The primary button of the fixed footer. The button must be a text button + * with text and color set. + * @type \Google\Apps\Card\V1\Button $secondary_button + * The secondary button of the fixed footer. The button must be a text + * button with text and color set. + * If `secondaryButton` is set, you must also set `primaryButton`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The primary button of the fixed footer. The button must be a text button + * with text and color set. + * + * Generated from protobuf field .google.apps.card.v1.Button primary_button = 1; + * @return \Google\Apps\Card\V1\Button|null + */ + public function getPrimaryButton() + { + return $this->primary_button; + } + + public function hasPrimaryButton() + { + return isset($this->primary_button); + } + + public function clearPrimaryButton() + { + unset($this->primary_button); + } + + /** + * The primary button of the fixed footer. The button must be a text button + * with text and color set. + * + * Generated from protobuf field .google.apps.card.v1.Button primary_button = 1; + * @param \Google\Apps\Card\V1\Button $var + * @return $this + */ + public function setPrimaryButton($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Button::class); + $this->primary_button = $var; + + return $this; + } + + /** + * The secondary button of the fixed footer. The button must be a text + * button with text and color set. + * If `secondaryButton` is set, you must also set `primaryButton`. + * + * Generated from protobuf field .google.apps.card.v1.Button secondary_button = 2; + * @return \Google\Apps\Card\V1\Button|null + */ + public function getSecondaryButton() + { + return $this->secondary_button; + } + + public function hasSecondaryButton() + { + return isset($this->secondary_button); + } + + public function clearSecondaryButton() + { + unset($this->secondary_button); + } + + /** + * The secondary button of the fixed footer. The button must be a text + * button with text and color set. + * If `secondaryButton` is set, you must also set `primaryButton`. + * + * Generated from protobuf field .google.apps.card.v1.Button secondary_button = 2; + * @param \Google\Apps\Card\V1\Button $var + * @return $this + */ + public function setSecondaryButton($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Button::class); + $this->secondary_button = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Card/CardHeader.php b/AppsChat/src/Card/V1/Card/CardHeader.php new file mode 100644 index 000000000000..37724de78a3f --- /dev/null +++ b/AppsChat/src/Card/V1/Card/CardHeader.php @@ -0,0 +1,231 @@ +google.apps.card.v1.Card.CardHeader + */ +class CardHeader extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The title of the card header. + * The header has a fixed height: if both a + * title and subtitle are specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * + * Generated from protobuf field string title = 1; + */ + protected $title = ''; + /** + * The subtitle of the card header. If specified, appears on its own line + * below the `title`. + * + * Generated from protobuf field string subtitle = 2; + */ + protected $subtitle = ''; + /** + * The shape used to crop the image. + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Widget.ImageType image_type = 3; + */ + protected $image_type = 0; + /** + * The HTTPS URL of the image in the card header. + * + * Generated from protobuf field string image_url = 4; + */ + protected $image_url = ''; + /** + * The alternative text of this image that's used for accessibility. + * + * Generated from protobuf field string image_alt_text = 5; + */ + protected $image_alt_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $title + * Required. The title of the card header. + * The header has a fixed height: if both a + * title and subtitle are specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * @type string $subtitle + * The subtitle of the card header. If specified, appears on its own line + * below the `title`. + * @type int $image_type + * The shape used to crop the image. + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * @type string $image_url + * The HTTPS URL of the image in the card header. + * @type string $image_alt_text + * The alternative text of this image that's used for accessibility. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * Required. The title of the card header. + * The header has a fixed height: if both a + * title and subtitle are specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * + * Generated from protobuf field string title = 1; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Required. The title of the card header. + * The header has a fixed height: if both a + * title and subtitle are specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * + * Generated from protobuf field string title = 1; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The subtitle of the card header. If specified, appears on its own line + * below the `title`. + * + * Generated from protobuf field string subtitle = 2; + * @return string + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * The subtitle of the card header. If specified, appears on its own line + * below the `title`. + * + * Generated from protobuf field string subtitle = 2; + * @param string $var + * @return $this + */ + public function setSubtitle($var) + { + GPBUtil::checkString($var, True); + $this->subtitle = $var; + + return $this; + } + + /** + * The shape used to crop the image. + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Widget.ImageType image_type = 3; + * @return int + */ + public function getImageType() + { + return $this->image_type; + } + + /** + * The shape used to crop the image. + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Widget.ImageType image_type = 3; + * @param int $var + * @return $this + */ + public function setImageType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Widget\ImageType::class); + $this->image_type = $var; + + return $this; + } + + /** + * The HTTPS URL of the image in the card header. + * + * Generated from protobuf field string image_url = 4; + * @return string + */ + public function getImageUrl() + { + return $this->image_url; + } + + /** + * The HTTPS URL of the image in the card header. + * + * Generated from protobuf field string image_url = 4; + * @param string $var + * @return $this + */ + public function setImageUrl($var) + { + GPBUtil::checkString($var, True); + $this->image_url = $var; + + return $this; + } + + /** + * The alternative text of this image that's used for accessibility. + * + * Generated from protobuf field string image_alt_text = 5; + * @return string + */ + public function getImageAltText() + { + return $this->image_alt_text; + } + + /** + * The alternative text of this image that's used for accessibility. + * + * Generated from protobuf field string image_alt_text = 5; + * @param string $var + * @return $this + */ + public function setImageAltText($var) + { + GPBUtil::checkString($var, True); + $this->image_alt_text = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Card/DisplayStyle.php b/AppsChat/src/Card/V1/Card/DisplayStyle.php new file mode 100644 index 000000000000..c2c07bc46cd2 --- /dev/null +++ b/AppsChat/src/Card/V1/Card/DisplayStyle.php @@ -0,0 +1,69 @@ +google.apps.card.v1.Card.DisplayStyle + */ +class DisplayStyle +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum DISPLAY_STYLE_UNSPECIFIED = 0; + */ + const DISPLAY_STYLE_UNSPECIFIED = 0; + /** + * The header of the card appears at the bottom of the + * sidebar, partially covering the current top card of the stack. Clicking + * the header pops the card into the card stack. If the card has no header, + * a generated header is used instead. + * + * Generated from protobuf enum PEEK = 1; + */ + const PEEK = 1; + /** + * Default value. The card is shown by replacing the view of the top card in + * the card stack. + * + * Generated from protobuf enum REPLACE = 2; + */ + const REPLACE = 2; + + private static $valueToName = [ + self::DISPLAY_STYLE_UNSPECIFIED => 'DISPLAY_STYLE_UNSPECIFIED', + self::PEEK => 'PEEK', + self::REPLACE => 'REPLACE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Card/DividerStyle.php b/AppsChat/src/Card/V1/Card/DividerStyle.php new file mode 100644 index 000000000000..666a0ada0063 --- /dev/null +++ b/AppsChat/src/Card/V1/Card/DividerStyle.php @@ -0,0 +1,65 @@ +google.apps.card.v1.Card.DividerStyle + */ +class DividerStyle +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum DIVIDER_STYLE_UNSPECIFIED = 0; + */ + const DIVIDER_STYLE_UNSPECIFIED = 0; + /** + * Default option. Render a solid divider between sections. + * + * Generated from protobuf enum SOLID_DIVIDER = 1; + */ + const SOLID_DIVIDER = 1; + /** + * If set, no divider is rendered between sections. + * + * Generated from protobuf enum NO_DIVIDER = 2; + */ + const NO_DIVIDER = 2; + + private static $valueToName = [ + self::DIVIDER_STYLE_UNSPECIFIED => 'DIVIDER_STYLE_UNSPECIFIED', + self::SOLID_DIVIDER => 'SOLID_DIVIDER', + self::NO_DIVIDER => 'NO_DIVIDER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Card/Section.php b/AppsChat/src/Card/V1/Card/Section.php new file mode 100644 index 000000000000..67f9538f92b0 --- /dev/null +++ b/AppsChat/src/Card/V1/Card/Section.php @@ -0,0 +1,253 @@ +google.apps.card.v1.Card.Section + */ +class Section extends \Google\Protobuf\Internal\Message +{ + /** + * Text that appears at the top of a section. + * Supports simple HTML formatted text. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string header = 1; + */ + protected $header = ''; + /** + * All the widgets in the section. + * Must contain at least one widget. + * + * Generated from protobuf field repeated .google.apps.card.v1.Widget widgets = 2; + */ + private $widgets; + /** + * Indicates whether this section is collapsible. + * Collapsible sections hide some or all widgets, but users can expand the + * section to reveal the hidden widgets by clicking **Show more**. Users + * can hide the widgets again by clicking **Show less**. + * To determine which widgets are hidden, specify + * `uncollapsibleWidgetsCount`. + * + * Generated from protobuf field bool collapsible = 5; + */ + protected $collapsible = false; + /** + * The number of uncollapsible widgets which remain visible even when a + * section is collapsed. + * For example, when a section + * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`, + * the first two widgets are always shown and the last three are collapsed + * by default. The `uncollapsibleWidgetsCount` is taken into account only + * when `collapsible` is `true`. + * + * Generated from protobuf field int32 uncollapsible_widgets_count = 6; + */ + protected $uncollapsible_widgets_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $header + * Text that appears at the top of a section. + * Supports simple HTML formatted text. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * @type array<\Google\Apps\Card\V1\Widget>|\Google\Protobuf\Internal\RepeatedField $widgets + * All the widgets in the section. + * Must contain at least one widget. + * @type bool $collapsible + * Indicates whether this section is collapsible. + * Collapsible sections hide some or all widgets, but users can expand the + * section to reveal the hidden widgets by clicking **Show more**. Users + * can hide the widgets again by clicking **Show less**. + * To determine which widgets are hidden, specify + * `uncollapsibleWidgetsCount`. + * @type int $uncollapsible_widgets_count + * The number of uncollapsible widgets which remain visible even when a + * section is collapsed. + * For example, when a section + * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`, + * the first two widgets are always shown and the last three are collapsed + * by default. The `uncollapsibleWidgetsCount` is taken into account only + * when `collapsible` is `true`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * Text that appears at the top of a section. + * Supports simple HTML formatted text. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string header = 1; + * @return string + */ + public function getHeader() + { + return $this->header; + } + + /** + * Text that appears at the top of a section. + * Supports simple HTML formatted text. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string header = 1; + * @param string $var + * @return $this + */ + public function setHeader($var) + { + GPBUtil::checkString($var, True); + $this->header = $var; + + return $this; + } + + /** + * All the widgets in the section. + * Must contain at least one widget. + * + * Generated from protobuf field repeated .google.apps.card.v1.Widget widgets = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWidgets() + { + return $this->widgets; + } + + /** + * All the widgets in the section. + * Must contain at least one widget. + * + * Generated from protobuf field repeated .google.apps.card.v1.Widget widgets = 2; + * @param array<\Google\Apps\Card\V1\Widget>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWidgets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Widget::class); + $this->widgets = $arr; + + return $this; + } + + /** + * Indicates whether this section is collapsible. + * Collapsible sections hide some or all widgets, but users can expand the + * section to reveal the hidden widgets by clicking **Show more**. Users + * can hide the widgets again by clicking **Show less**. + * To determine which widgets are hidden, specify + * `uncollapsibleWidgetsCount`. + * + * Generated from protobuf field bool collapsible = 5; + * @return bool + */ + public function getCollapsible() + { + return $this->collapsible; + } + + /** + * Indicates whether this section is collapsible. + * Collapsible sections hide some or all widgets, but users can expand the + * section to reveal the hidden widgets by clicking **Show more**. Users + * can hide the widgets again by clicking **Show less**. + * To determine which widgets are hidden, specify + * `uncollapsibleWidgetsCount`. + * + * Generated from protobuf field bool collapsible = 5; + * @param bool $var + * @return $this + */ + public function setCollapsible($var) + { + GPBUtil::checkBool($var); + $this->collapsible = $var; + + return $this; + } + + /** + * The number of uncollapsible widgets which remain visible even when a + * section is collapsed. + * For example, when a section + * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`, + * the first two widgets are always shown and the last three are collapsed + * by default. The `uncollapsibleWidgetsCount` is taken into account only + * when `collapsible` is `true`. + * + * Generated from protobuf field int32 uncollapsible_widgets_count = 6; + * @return int + */ + public function getUncollapsibleWidgetsCount() + { + return $this->uncollapsible_widgets_count; + } + + /** + * The number of uncollapsible widgets which remain visible even when a + * section is collapsed. + * For example, when a section + * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`, + * the first two widgets are always shown and the last three are collapsed + * by default. The `uncollapsibleWidgetsCount` is taken into account only + * when `collapsible` is `true`. + * + * Generated from protobuf field int32 uncollapsible_widgets_count = 6; + * @param int $var + * @return $this + */ + public function setUncollapsibleWidgetsCount($var) + { + GPBUtil::checkInt32($var); + $this->uncollapsible_widgets_count = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Columns.php b/AppsChat/src/Card/V1/Columns.php new file mode 100644 index 000000000000..f2e8cff1b175 --- /dev/null +++ b/AppsChat/src/Card/V1/Columns.php @@ -0,0 +1,91 @@ +google.apps.card.v1.Columns + */ +class Columns extends \Google\Protobuf\Internal\Message +{ + /** + * An array of columns. You can include up to 2 columns in a card or dialog. + * + * Generated from protobuf field repeated .google.apps.card.v1.Columns.Column column_items = 2; + */ + private $column_items; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Card\V1\Columns\Column>|\Google\Protobuf\Internal\RepeatedField $column_items + * An array of columns. You can include up to 2 columns in a card or dialog. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * An array of columns. You can include up to 2 columns in a card or dialog. + * + * Generated from protobuf field repeated .google.apps.card.v1.Columns.Column column_items = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColumnItems() + { + return $this->column_items; + } + + /** + * An array of columns. You can include up to 2 columns in a card or dialog. + * + * Generated from protobuf field repeated .google.apps.card.v1.Columns.Column column_items = 2; + * @param array<\Google\Apps\Card\V1\Columns\Column>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColumnItems($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Columns\Column::class); + $this->column_items = $arr; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Columns/Column.php b/AppsChat/src/Card/V1/Columns/Column.php new file mode 100644 index 000000000000..e53399f551df --- /dev/null +++ b/AppsChat/src/Card/V1/Columns/Column.php @@ -0,0 +1,186 @@ +google.apps.card.v1.Columns.Column + */ +class Column extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies how a column fills the width of the card. + * + * Generated from protobuf field .google.apps.card.v1.Columns.Column.HorizontalSizeStyle horizontal_size_style = 1; + */ + protected $horizontal_size_style = 0; + /** + * Specifies whether widgets align to the left, right, or center of a + * column. + * + * Generated from protobuf field .google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 2; + */ + protected $horizontal_alignment = 0; + /** + * Specifies whether widgets align to the top, bottom, or center of a + * column. + * + * Generated from protobuf field .google.apps.card.v1.Columns.Column.VerticalAlignment vertical_alignment = 3; + */ + protected $vertical_alignment = 0; + /** + * An array of widgets included in a column. Widgets appear in the order + * that they are specified. + * + * Generated from protobuf field repeated .google.apps.card.v1.Columns.Column.Widgets widgets = 4; + */ + private $widgets; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $horizontal_size_style + * Specifies how a column fills the width of the card. + * @type int $horizontal_alignment + * Specifies whether widgets align to the left, right, or center of a + * column. + * @type int $vertical_alignment + * Specifies whether widgets align to the top, bottom, or center of a + * column. + * @type array<\Google\Apps\Card\V1\Columns\Column\Widgets>|\Google\Protobuf\Internal\RepeatedField $widgets + * An array of widgets included in a column. Widgets appear in the order + * that they are specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * Specifies how a column fills the width of the card. + * + * Generated from protobuf field .google.apps.card.v1.Columns.Column.HorizontalSizeStyle horizontal_size_style = 1; + * @return int + */ + public function getHorizontalSizeStyle() + { + return $this->horizontal_size_style; + } + + /** + * Specifies how a column fills the width of the card. + * + * Generated from protobuf field .google.apps.card.v1.Columns.Column.HorizontalSizeStyle horizontal_size_style = 1; + * @param int $var + * @return $this + */ + public function setHorizontalSizeStyle($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Columns\Column\HorizontalSizeStyle::class); + $this->horizontal_size_style = $var; + + return $this; + } + + /** + * Specifies whether widgets align to the left, right, or center of a + * column. + * + * Generated from protobuf field .google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 2; + * @return int + */ + public function getHorizontalAlignment() + { + return $this->horizontal_alignment; + } + + /** + * Specifies whether widgets align to the left, right, or center of a + * column. + * + * Generated from protobuf field .google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 2; + * @param int $var + * @return $this + */ + public function setHorizontalAlignment($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Widget\HorizontalAlignment::class); + $this->horizontal_alignment = $var; + + return $this; + } + + /** + * Specifies whether widgets align to the top, bottom, or center of a + * column. + * + * Generated from protobuf field .google.apps.card.v1.Columns.Column.VerticalAlignment vertical_alignment = 3; + * @return int + */ + public function getVerticalAlignment() + { + return $this->vertical_alignment; + } + + /** + * Specifies whether widgets align to the top, bottom, or center of a + * column. + * + * Generated from protobuf field .google.apps.card.v1.Columns.Column.VerticalAlignment vertical_alignment = 3; + * @param int $var + * @return $this + */ + public function setVerticalAlignment($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Columns\Column\VerticalAlignment::class); + $this->vertical_alignment = $var; + + return $this; + } + + /** + * An array of widgets included in a column. Widgets appear in the order + * that they are specified. + * + * Generated from protobuf field repeated .google.apps.card.v1.Columns.Column.Widgets widgets = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWidgets() + { + return $this->widgets; + } + + /** + * An array of widgets included in a column. Widgets appear in the order + * that they are specified. + * + * Generated from protobuf field repeated .google.apps.card.v1.Columns.Column.Widgets widgets = 4; + * @param array<\Google\Apps\Card\V1\Columns\Column\Widgets>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWidgets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Columns\Column\Widgets::class); + $this->widgets = $arr; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Columns/Column/HorizontalSizeStyle.php b/AppsChat/src/Card/V1/Columns/Column/HorizontalSizeStyle.php new file mode 100644 index 000000000000..a09691dc7bb8 --- /dev/null +++ b/AppsChat/src/Card/V1/Columns/Column/HorizontalSizeStyle.php @@ -0,0 +1,71 @@ +google.apps.card.v1.Columns.Column.HorizontalSizeStyle + */ +class HorizontalSizeStyle +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum HORIZONTAL_SIZE_STYLE_UNSPECIFIED = 0; + */ + const HORIZONTAL_SIZE_STYLE_UNSPECIFIED = 0; + /** + * Default value. Column fills the available space, up to 70% of the + * card's width. If both columns are set to `FILL_AVAILABLE_SPACE`, each + * column fills 50% of the space. + * + * Generated from protobuf enum FILL_AVAILABLE_SPACE = 1; + */ + const FILL_AVAILABLE_SPACE = 1; + /** + * Column fills the least amount of space possible and no more than 30% of + * the card's width. + * + * Generated from protobuf enum FILL_MINIMUM_SPACE = 2; + */ + const FILL_MINIMUM_SPACE = 2; + + private static $valueToName = [ + self::HORIZONTAL_SIZE_STYLE_UNSPECIFIED => 'HORIZONTAL_SIZE_STYLE_UNSPECIFIED', + self::FILL_AVAILABLE_SPACE => 'FILL_AVAILABLE_SPACE', + self::FILL_MINIMUM_SPACE => 'FILL_MINIMUM_SPACE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Columns/Column/VerticalAlignment.php b/AppsChat/src/Card/V1/Columns/Column/VerticalAlignment.php new file mode 100644 index 000000000000..5418be763e9b --- /dev/null +++ b/AppsChat/src/Card/V1/Columns/Column/VerticalAlignment.php @@ -0,0 +1,74 @@ +google.apps.card.v1.Columns.Column.VerticalAlignment + */ +class VerticalAlignment +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum VERTICAL_ALIGNMENT_UNSPECIFIED = 0; + */ + const VERTICAL_ALIGNMENT_UNSPECIFIED = 0; + /** + * Default value. Aligns widgets to the center of a column. + * + * Generated from protobuf enum CENTER = 1; + */ + const CENTER = 1; + /** + * Aligns widgets to the top of a column. + * + * Generated from protobuf enum TOP = 2; + */ + const TOP = 2; + /** + * Aligns widgets to the bottom of a column. + * + * Generated from protobuf enum BOTTOM = 3; + */ + const BOTTOM = 3; + + private static $valueToName = [ + self::VERTICAL_ALIGNMENT_UNSPECIFIED => 'VERTICAL_ALIGNMENT_UNSPECIFIED', + self::CENTER => 'CENTER', + self::TOP => 'TOP', + self::BOTTOM => 'BOTTOM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Columns/Column/Widgets.php b/AppsChat/src/Card/V1/Columns/Column/Widgets.php new file mode 100644 index 000000000000..c543b1b57682 --- /dev/null +++ b/AppsChat/src/Card/V1/Columns/Column/Widgets.php @@ -0,0 +1,278 @@ +google.apps.card.v1.Columns.Column.Widgets + */ +class Widgets extends \Google\Protobuf\Internal\Message +{ + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\TextParagraph $text_paragraph + * [TextParagraph][google.apps.card.v1.TextParagraph] widget. + * @type \Google\Apps\Card\V1\Image $image + * [Image][google.apps.card.v1.Image] widget. + * @type \Google\Apps\Card\V1\DecoratedText $decorated_text + * [DecoratedText][google.apps.card.v1.DecoratedText] widget. + * @type \Google\Apps\Card\V1\ButtonList $button_list + * [ButtonList][google.apps.card.v1.ButtonList] widget. + * @type \Google\Apps\Card\V1\TextInput $text_input + * [TextInput][google.apps.card.v1.TextInput] widget. + * @type \Google\Apps\Card\V1\SelectionInput $selection_input + * [SelectionInput][google.apps.card.v1.SelectionInput] widget. + * @type \Google\Apps\Card\V1\DateTimePicker $date_time_picker + * [DateTimePicker][google.apps.card.v1.DateTimePicker] widget. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * [TextParagraph][google.apps.card.v1.TextParagraph] widget. + * + * Generated from protobuf field .google.apps.card.v1.TextParagraph text_paragraph = 1; + * @return \Google\Apps\Card\V1\TextParagraph|null + */ + public function getTextParagraph() + { + return $this->readOneof(1); + } + + public function hasTextParagraph() + { + return $this->hasOneof(1); + } + + /** + * [TextParagraph][google.apps.card.v1.TextParagraph] widget. + * + * Generated from protobuf field .google.apps.card.v1.TextParagraph text_paragraph = 1; + * @param \Google\Apps\Card\V1\TextParagraph $var + * @return $this + */ + public function setTextParagraph($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\TextParagraph::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * [Image][google.apps.card.v1.Image] widget. + * + * Generated from protobuf field .google.apps.card.v1.Image image = 2; + * @return \Google\Apps\Card\V1\Image|null + */ + public function getImage() + { + return $this->readOneof(2); + } + + public function hasImage() + { + return $this->hasOneof(2); + } + + /** + * [Image][google.apps.card.v1.Image] widget. + * + * Generated from protobuf field .google.apps.card.v1.Image image = 2; + * @param \Google\Apps\Card\V1\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Image::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * [DecoratedText][google.apps.card.v1.DecoratedText] widget. + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText decorated_text = 3; + * @return \Google\Apps\Card\V1\DecoratedText|null + */ + public function getDecoratedText() + { + return $this->readOneof(3); + } + + public function hasDecoratedText() + { + return $this->hasOneof(3); + } + + /** + * [DecoratedText][google.apps.card.v1.DecoratedText] widget. + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText decorated_text = 3; + * @param \Google\Apps\Card\V1\DecoratedText $var + * @return $this + */ + public function setDecoratedText($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\DecoratedText::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * [ButtonList][google.apps.card.v1.ButtonList] widget. + * + * Generated from protobuf field .google.apps.card.v1.ButtonList button_list = 4; + * @return \Google\Apps\Card\V1\ButtonList|null + */ + public function getButtonList() + { + return $this->readOneof(4); + } + + public function hasButtonList() + { + return $this->hasOneof(4); + } + + /** + * [ButtonList][google.apps.card.v1.ButtonList] widget. + * + * Generated from protobuf field .google.apps.card.v1.ButtonList button_list = 4; + * @param \Google\Apps\Card\V1\ButtonList $var + * @return $this + */ + public function setButtonList($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\ButtonList::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * [TextInput][google.apps.card.v1.TextInput] widget. + * + * Generated from protobuf field .google.apps.card.v1.TextInput text_input = 5; + * @return \Google\Apps\Card\V1\TextInput|null + */ + public function getTextInput() + { + return $this->readOneof(5); + } + + public function hasTextInput() + { + return $this->hasOneof(5); + } + + /** + * [TextInput][google.apps.card.v1.TextInput] widget. + * + * Generated from protobuf field .google.apps.card.v1.TextInput text_input = 5; + * @param \Google\Apps\Card\V1\TextInput $var + * @return $this + */ + public function setTextInput($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\TextInput::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * [SelectionInput][google.apps.card.v1.SelectionInput] widget. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput selection_input = 6; + * @return \Google\Apps\Card\V1\SelectionInput|null + */ + public function getSelectionInput() + { + return $this->readOneof(6); + } + + public function hasSelectionInput() + { + return $this->hasOneof(6); + } + + /** + * [SelectionInput][google.apps.card.v1.SelectionInput] widget. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput selection_input = 6; + * @param \Google\Apps\Card\V1\SelectionInput $var + * @return $this + */ + public function setSelectionInput($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\SelectionInput::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * [DateTimePicker][google.apps.card.v1.DateTimePicker] widget. + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker date_time_picker = 7; + * @return \Google\Apps\Card\V1\DateTimePicker|null + */ + public function getDateTimePicker() + { + return $this->readOneof(7); + } + + public function hasDateTimePicker() + { + return $this->hasOneof(7); + } + + /** + * [DateTimePicker][google.apps.card.v1.DateTimePicker] widget. + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker date_time_picker = 7; + * @param \Google\Apps\Card\V1\DateTimePicker $var + * @return $this + */ + public function setDateTimePicker($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\DateTimePicker::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + + diff --git a/AppsChat/src/Card/V1/DateTimePicker.php b/AppsChat/src/Card/V1/DateTimePicker.php new file mode 100644 index 000000000000..324bcac7ae7c --- /dev/null +++ b/AppsChat/src/Card/V1/DateTimePicker.php @@ -0,0 +1,314 @@ +google.apps.card.v1.DateTimePicker + */ +class DateTimePicker extends \Google\Protobuf\Internal\Message +{ + /** + * The name by which the `DateTimePicker` is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The text that prompts users to input a date, a time, or a date and time. + * For example, if users are scheduling an appointment, use a label such as + * `Appointment date` or `Appointment date and time`. + * + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + /** + * Whether the widget supports inputting a date, a time, or the date and time. + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker.DateTimePickerType type = 3; + */ + protected $type = 0; + /** + * The default value displayed in the widget, in milliseconds since [Unix + * epoch time](https://en.wikipedia.org/wiki/Unix_time). + * Specify the value based on the type of picker (`DateTimePickerType`): + * * `DATE_AND_TIME`: a calendar date and time in UTC. For example, to + * represent January 1, 2023 at 12:00 PM UTC, use `1672574400000`. + * * `DATE_ONLY`: a calendar date at 00:00:00 UTC. For example, to represent + * January 1, 2023, use `1672531200000`. + * * `TIME_ONLY`: a time in UTC. For example, to represent 12:00 PM, use + * `43200000` (or `12 * 60 * 60 * 1000`). + * + * Generated from protobuf field int64 value_ms_epoch = 4; + */ + protected $value_ms_epoch = 0; + /** + * The number representing the time zone offset from UTC, in minutes. + * If set, the `value_ms_epoch` is displayed in the specified time zone. + * If unset, the value defaults to the user's time zone setting. + * + * Generated from protobuf field int32 timezone_offset_date = 5; + */ + protected $timezone_offset_date = 0; + /** + * Triggered when the user clicks **Save** or **Clear** from the + * `DateTimePicker` interface. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 6; + */ + protected $on_change_action = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name by which the `DateTimePicker` is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type string $label + * The text that prompts users to input a date, a time, or a date and time. + * For example, if users are scheduling an appointment, use a label such as + * `Appointment date` or `Appointment date and time`. + * @type int $type + * Whether the widget supports inputting a date, a time, or the date and time. + * @type int|string $value_ms_epoch + * The default value displayed in the widget, in milliseconds since [Unix + * epoch time](https://en.wikipedia.org/wiki/Unix_time). + * Specify the value based on the type of picker (`DateTimePickerType`): + * * `DATE_AND_TIME`: a calendar date and time in UTC. For example, to + * represent January 1, 2023 at 12:00 PM UTC, use `1672574400000`. + * * `DATE_ONLY`: a calendar date at 00:00:00 UTC. For example, to represent + * January 1, 2023, use `1672531200000`. + * * `TIME_ONLY`: a time in UTC. For example, to represent 12:00 PM, use + * `43200000` (or `12 * 60 * 60 * 1000`). + * @type int $timezone_offset_date + * The number representing the time zone offset from UTC, in minutes. + * If set, the `value_ms_epoch` is displayed in the specified time zone. + * If unset, the value defaults to the user's time zone setting. + * @type \Google\Apps\Card\V1\Action $on_change_action + * Triggered when the user clicks **Save** or **Clear** from the + * `DateTimePicker` interface. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The name by which the `DateTimePicker` is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name by which the `DateTimePicker` is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The text that prompts users to input a date, a time, or a date and time. + * For example, if users are scheduling an appointment, use a label such as + * `Appointment date` or `Appointment date and time`. + * + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * The text that prompts users to input a date, a time, or a date and time. + * For example, if users are scheduling an appointment, use a label such as + * `Appointment date` or `Appointment date and time`. + * + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Whether the widget supports inputting a date, a time, or the date and time. + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker.DateTimePickerType type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Whether the widget supports inputting a date, a time, or the date and time. + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker.DateTimePickerType type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\DateTimePicker\DateTimePickerType::class); + $this->type = $var; + + return $this; + } + + /** + * The default value displayed in the widget, in milliseconds since [Unix + * epoch time](https://en.wikipedia.org/wiki/Unix_time). + * Specify the value based on the type of picker (`DateTimePickerType`): + * * `DATE_AND_TIME`: a calendar date and time in UTC. For example, to + * represent January 1, 2023 at 12:00 PM UTC, use `1672574400000`. + * * `DATE_ONLY`: a calendar date at 00:00:00 UTC. For example, to represent + * January 1, 2023, use `1672531200000`. + * * `TIME_ONLY`: a time in UTC. For example, to represent 12:00 PM, use + * `43200000` (or `12 * 60 * 60 * 1000`). + * + * Generated from protobuf field int64 value_ms_epoch = 4; + * @return int|string + */ + public function getValueMsEpoch() + { + return $this->value_ms_epoch; + } + + /** + * The default value displayed in the widget, in milliseconds since [Unix + * epoch time](https://en.wikipedia.org/wiki/Unix_time). + * Specify the value based on the type of picker (`DateTimePickerType`): + * * `DATE_AND_TIME`: a calendar date and time in UTC. For example, to + * represent January 1, 2023 at 12:00 PM UTC, use `1672574400000`. + * * `DATE_ONLY`: a calendar date at 00:00:00 UTC. For example, to represent + * January 1, 2023, use `1672531200000`. + * * `TIME_ONLY`: a time in UTC. For example, to represent 12:00 PM, use + * `43200000` (or `12 * 60 * 60 * 1000`). + * + * Generated from protobuf field int64 value_ms_epoch = 4; + * @param int|string $var + * @return $this + */ + public function setValueMsEpoch($var) + { + GPBUtil::checkInt64($var); + $this->value_ms_epoch = $var; + + return $this; + } + + /** + * The number representing the time zone offset from UTC, in minutes. + * If set, the `value_ms_epoch` is displayed in the specified time zone. + * If unset, the value defaults to the user's time zone setting. + * + * Generated from protobuf field int32 timezone_offset_date = 5; + * @return int + */ + public function getTimezoneOffsetDate() + { + return $this->timezone_offset_date; + } + + /** + * The number representing the time zone offset from UTC, in minutes. + * If set, the `value_ms_epoch` is displayed in the specified time zone. + * If unset, the value defaults to the user's time zone setting. + * + * Generated from protobuf field int32 timezone_offset_date = 5; + * @param int $var + * @return $this + */ + public function setTimezoneOffsetDate($var) + { + GPBUtil::checkInt32($var); + $this->timezone_offset_date = $var; + + return $this; + } + + /** + * Triggered when the user clicks **Save** or **Clear** from the + * `DateTimePicker` interface. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 6; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getOnChangeAction() + { + return $this->on_change_action; + } + + public function hasOnChangeAction() + { + return isset($this->on_change_action); + } + + public function clearOnChangeAction() + { + unset($this->on_change_action); + } + + /** + * Triggered when the user clicks **Save** or **Clear** from the + * `DateTimePicker` interface. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 6; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setOnChangeAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->on_change_action = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/DateTimePicker/DateTimePickerType.php b/AppsChat/src/Card/V1/DateTimePicker/DateTimePickerType.php new file mode 100644 index 000000000000..63b03d361218 --- /dev/null +++ b/AppsChat/src/Card/V1/DateTimePicker/DateTimePickerType.php @@ -0,0 +1,65 @@ +google.apps.card.v1.DateTimePicker.DateTimePickerType + */ +class DateTimePickerType +{ + /** + * Users input a date and time. + * + * Generated from protobuf enum DATE_AND_TIME = 0; + */ + const DATE_AND_TIME = 0; + /** + * Users input a date. + * + * Generated from protobuf enum DATE_ONLY = 1; + */ + const DATE_ONLY = 1; + /** + * Users input a time. + * + * Generated from protobuf enum TIME_ONLY = 2; + */ + const TIME_ONLY = 2; + + private static $valueToName = [ + self::DATE_AND_TIME => 'DATE_AND_TIME', + self::DATE_ONLY => 'DATE_ONLY', + self::TIME_ONLY => 'TIME_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/DecoratedText.php b/AppsChat/src/Card/V1/DecoratedText.php new file mode 100644 index 000000000000..b8526ef893b8 --- /dev/null +++ b/AppsChat/src/Card/V1/DecoratedText.php @@ -0,0 +1,480 @@ +google.apps.card.v1.DecoratedText + */ +class DecoratedText extends \Google\Protobuf\Internal\Message +{ + /** + * Deprecated in favor of `startIcon`. + * + * Generated from protobuf field .google.apps.card.v1.Icon icon = 1 [deprecated = true]; + * @deprecated + */ + protected $icon = null; + /** + * The icon displayed in front of the text. + * + * Generated from protobuf field .google.apps.card.v1.Icon start_icon = 12; + */ + protected $start_icon = null; + /** + * The text that appears above `text`. Always truncates. + * + * Generated from protobuf field string top_label = 3; + */ + protected $top_label = ''; + /** + * Required. The primary text. + * Supports simple formatting. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string text = 4; + */ + protected $text = ''; + /** + * The wrap text setting. If `true`, the text wraps and displays on + * multiple lines. Otherwise, the text is truncated. + * Only applies to `text`, not `topLabel` and `bottomLabel`. + * + * Generated from protobuf field bool wrap_text = 5; + */ + protected $wrap_text = false; + /** + * The text that appears below `text`. Always wraps. + * + * Generated from protobuf field string bottom_label = 6; + */ + protected $bottom_label = ''; + /** + * This action is triggered when users click `topLabel` or `bottomLabel`. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 7; + */ + protected $on_click = null; + protected $control; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\Icon $icon + * Deprecated in favor of `startIcon`. + * @type \Google\Apps\Card\V1\Icon $start_icon + * The icon displayed in front of the text. + * @type string $top_label + * The text that appears above `text`. Always truncates. + * @type string $text + * Required. The primary text. + * Supports simple formatting. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * @type bool $wrap_text + * The wrap text setting. If `true`, the text wraps and displays on + * multiple lines. Otherwise, the text is truncated. + * Only applies to `text`, not `topLabel` and `bottomLabel`. + * @type string $bottom_label + * The text that appears below `text`. Always wraps. + * @type \Google\Apps\Card\V1\OnClick $on_click + * This action is triggered when users click `topLabel` or `bottomLabel`. + * @type \Google\Apps\Card\V1\Button $button + * A button that a user can click to trigger an action. + * @type \Google\Apps\Card\V1\DecoratedText\SwitchControl $switch_control + * A switch widget that a user can click to change its state and trigger an + * action. + * @type \Google\Apps\Card\V1\Icon $end_icon + * An icon displayed after the text. + * Supports + * [built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons) + * and + * [custom](https://developers.google.com/workspace/chat/format-messages#customicons) + * icons. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * Deprecated in favor of `startIcon`. + * + * Generated from protobuf field .google.apps.card.v1.Icon icon = 1 [deprecated = true]; + * @return \Google\Apps\Card\V1\Icon|null + * @deprecated + */ + public function getIcon() + { + @trigger_error('icon is deprecated.', E_USER_DEPRECATED); + return $this->icon; + } + + public function hasIcon() + { + @trigger_error('icon is deprecated.', E_USER_DEPRECATED); + return isset($this->icon); + } + + public function clearIcon() + { + @trigger_error('icon is deprecated.', E_USER_DEPRECATED); + unset($this->icon); + } + + /** + * Deprecated in favor of `startIcon`. + * + * Generated from protobuf field .google.apps.card.v1.Icon icon = 1 [deprecated = true]; + * @param \Google\Apps\Card\V1\Icon $var + * @return $this + * @deprecated + */ + public function setIcon($var) + { + @trigger_error('icon is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Icon::class); + $this->icon = $var; + + return $this; + } + + /** + * The icon displayed in front of the text. + * + * Generated from protobuf field .google.apps.card.v1.Icon start_icon = 12; + * @return \Google\Apps\Card\V1\Icon|null + */ + public function getStartIcon() + { + return $this->start_icon; + } + + public function hasStartIcon() + { + return isset($this->start_icon); + } + + public function clearStartIcon() + { + unset($this->start_icon); + } + + /** + * The icon displayed in front of the text. + * + * Generated from protobuf field .google.apps.card.v1.Icon start_icon = 12; + * @param \Google\Apps\Card\V1\Icon $var + * @return $this + */ + public function setStartIcon($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Icon::class); + $this->start_icon = $var; + + return $this; + } + + /** + * The text that appears above `text`. Always truncates. + * + * Generated from protobuf field string top_label = 3; + * @return string + */ + public function getTopLabel() + { + return $this->top_label; + } + + /** + * The text that appears above `text`. Always truncates. + * + * Generated from protobuf field string top_label = 3; + * @param string $var + * @return $this + */ + public function setTopLabel($var) + { + GPBUtil::checkString($var, True); + $this->top_label = $var; + + return $this; + } + + /** + * Required. The primary text. + * Supports simple formatting. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string text = 4; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. The primary text. + * Supports simple formatting. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string text = 4; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * The wrap text setting. If `true`, the text wraps and displays on + * multiple lines. Otherwise, the text is truncated. + * Only applies to `text`, not `topLabel` and `bottomLabel`. + * + * Generated from protobuf field bool wrap_text = 5; + * @return bool + */ + public function getWrapText() + { + return $this->wrap_text; + } + + /** + * The wrap text setting. If `true`, the text wraps and displays on + * multiple lines. Otherwise, the text is truncated. + * Only applies to `text`, not `topLabel` and `bottomLabel`. + * + * Generated from protobuf field bool wrap_text = 5; + * @param bool $var + * @return $this + */ + public function setWrapText($var) + { + GPBUtil::checkBool($var); + $this->wrap_text = $var; + + return $this; + } + + /** + * The text that appears below `text`. Always wraps. + * + * Generated from protobuf field string bottom_label = 6; + * @return string + */ + public function getBottomLabel() + { + return $this->bottom_label; + } + + /** + * The text that appears below `text`. Always wraps. + * + * Generated from protobuf field string bottom_label = 6; + * @param string $var + * @return $this + */ + public function setBottomLabel($var) + { + GPBUtil::checkString($var, True); + $this->bottom_label = $var; + + return $this; + } + + /** + * This action is triggered when users click `topLabel` or `bottomLabel`. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 7; + * @return \Google\Apps\Card\V1\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * This action is triggered when users click `topLabel` or `bottomLabel`. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 7; + * @param \Google\Apps\Card\V1\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\OnClick::class); + $this->on_click = $var; + + return $this; + } + + /** + * A button that a user can click to trigger an action. + * + * Generated from protobuf field .google.apps.card.v1.Button button = 8; + * @return \Google\Apps\Card\V1\Button|null + */ + public function getButton() + { + return $this->readOneof(8); + } + + public function hasButton() + { + return $this->hasOneof(8); + } + + /** + * A button that a user can click to trigger an action. + * + * Generated from protobuf field .google.apps.card.v1.Button button = 8; + * @param \Google\Apps\Card\V1\Button $var + * @return $this + */ + public function setButton($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Button::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * A switch widget that a user can click to change its state and trigger an + * action. + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText.SwitchControl switch_control = 9; + * @return \Google\Apps\Card\V1\DecoratedText\SwitchControl|null + */ + public function getSwitchControl() + { + return $this->readOneof(9); + } + + public function hasSwitchControl() + { + return $this->hasOneof(9); + } + + /** + * A switch widget that a user can click to change its state and trigger an + * action. + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText.SwitchControl switch_control = 9; + * @param \Google\Apps\Card\V1\DecoratedText\SwitchControl $var + * @return $this + */ + public function setSwitchControl($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\DecoratedText\SwitchControl::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * An icon displayed after the text. + * Supports + * [built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons) + * and + * [custom](https://developers.google.com/workspace/chat/format-messages#customicons) + * icons. + * + * Generated from protobuf field .google.apps.card.v1.Icon end_icon = 11; + * @return \Google\Apps\Card\V1\Icon|null + */ + public function getEndIcon() + { + return $this->readOneof(11); + } + + public function hasEndIcon() + { + return $this->hasOneof(11); + } + + /** + * An icon displayed after the text. + * Supports + * [built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons) + * and + * [custom](https://developers.google.com/workspace/chat/format-messages#customicons) + * icons. + * + * Generated from protobuf field .google.apps.card.v1.Icon end_icon = 11; + * @param \Google\Apps\Card\V1\Icon $var + * @return $this + */ + public function setEndIcon($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Icon::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * @return string + */ + public function getControl() + { + return $this->whichOneof("control"); + } + +} + diff --git a/AppsChat/src/Card/V1/DecoratedText/SwitchControl.php b/AppsChat/src/Card/V1/DecoratedText/SwitchControl.php new file mode 100644 index 000000000000..36934fcc38aa --- /dev/null +++ b/AppsChat/src/Card/V1/DecoratedText/SwitchControl.php @@ -0,0 +1,245 @@ +google.apps.card.v1.DecoratedText.SwitchControl + */ +class SwitchControl extends \Google\Protobuf\Internal\Message +{ + /** + * The name by which the switch widget is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + /** + * When `true`, the switch is selected. + * + * Generated from protobuf field bool selected = 3; + */ + protected $selected = false; + /** + * The action to perform when the switch state is changed, such as what + * function to run. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 4; + */ + protected $on_change_action = null; + /** + * How the switch appears in the user interface. + * [Google Workspace Add-ons + * and Chat apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText.SwitchControl.ControlType control_type = 5; + */ + protected $control_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name by which the switch widget is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type string $value + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type bool $selected + * When `true`, the switch is selected. + * @type \Google\Apps\Card\V1\Action $on_change_action + * The action to perform when the switch state is changed, such as what + * function to run. + * @type int $control_type + * How the switch appears in the user interface. + * [Google Workspace Add-ons + * and Chat apps](https://developers.google.com/workspace/extend): + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The name by which the switch widget is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name by which the switch widget is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * When `true`, the switch is selected. + * + * Generated from protobuf field bool selected = 3; + * @return bool + */ + public function getSelected() + { + return $this->selected; + } + + /** + * When `true`, the switch is selected. + * + * Generated from protobuf field bool selected = 3; + * @param bool $var + * @return $this + */ + public function setSelected($var) + { + GPBUtil::checkBool($var); + $this->selected = $var; + + return $this; + } + + /** + * The action to perform when the switch state is changed, such as what + * function to run. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 4; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getOnChangeAction() + { + return $this->on_change_action; + } + + public function hasOnChangeAction() + { + return isset($this->on_change_action); + } + + public function clearOnChangeAction() + { + unset($this->on_change_action); + } + + /** + * The action to perform when the switch state is changed, such as what + * function to run. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 4; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setOnChangeAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->on_change_action = $var; + + return $this; + } + + /** + * How the switch appears in the user interface. + * [Google Workspace Add-ons + * and Chat apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText.SwitchControl.ControlType control_type = 5; + * @return int + */ + public function getControlType() + { + return $this->control_type; + } + + /** + * How the switch appears in the user interface. + * [Google Workspace Add-ons + * and Chat apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText.SwitchControl.ControlType control_type = 5; + * @param int $var + * @return $this + */ + public function setControlType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\DecoratedText\SwitchControl\ControlType::class); + $this->control_type = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/DecoratedText/SwitchControl/ControlType.php b/AppsChat/src/Card/V1/DecoratedText/SwitchControl/ControlType.php new file mode 100644 index 000000000000..5b7622dc4b81 --- /dev/null +++ b/AppsChat/src/Card/V1/DecoratedText/SwitchControl/ControlType.php @@ -0,0 +1,68 @@ +google.apps.card.v1.DecoratedText.SwitchControl.ControlType + */ +class ControlType +{ + /** + * A toggle-style switch. + * + * Generated from protobuf enum SWITCH = 0; + */ + const PBSWITCH = 0; + /** + * Deprecated in favor of `CHECK_BOX`. + * + * Generated from protobuf enum CHECKBOX = 1; + */ + const CHECKBOX = 1; + /** + * A checkbox. + * + * Generated from protobuf enum CHECK_BOX = 2; + */ + const CHECK_BOX = 2; + + private static $valueToName = [ + self::PBSWITCH => 'SWITCH', + self::CHECKBOX => 'CHECKBOX', + self::CHECK_BOX => 'CHECK_BOX', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Divider.php b/AppsChat/src/Card/V1/Divider.php new file mode 100644 index 000000000000..302c3a2b4e4f --- /dev/null +++ b/AppsChat/src/Card/V1/Divider.php @@ -0,0 +1,42 @@ +google.apps.card.v1.Divider + */ +class Divider extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + +} + diff --git a/AppsChat/src/Card/V1/Grid.php b/AppsChat/src/Card/V1/Grid.php new file mode 100644 index 000000000000..daf8a87f9278 --- /dev/null +++ b/AppsChat/src/Card/V1/Grid.php @@ -0,0 +1,281 @@ +google.apps.card.v1.Grid + */ +class Grid extends \Google\Protobuf\Internal\Message +{ + /** + * The text that displays in the grid header. + * + * Generated from protobuf field string title = 1; + */ + protected $title = ''; + /** + * The items to display in the grid. + * + * Generated from protobuf field repeated .google.apps.card.v1.Grid.GridItem items = 2; + */ + private $items; + /** + * The border style to apply to each grid item. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle border_style = 3; + */ + protected $border_style = null; + /** + * The number of columns to display in the grid. A default value + * is used if this field isn't specified, and that default value is + * different depending on where the grid is shown (dialog versus companion). + * + * Generated from protobuf field int32 column_count = 4; + */ + protected $column_count = 0; + /** + * This callback is reused by each individual grid item, but with the + * item's identifier and index in the items list added to the callback's + * parameters. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 5; + */ + protected $on_click = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $title + * The text that displays in the grid header. + * @type array<\Google\Apps\Card\V1\Grid\GridItem>|\Google\Protobuf\Internal\RepeatedField $items + * The items to display in the grid. + * @type \Google\Apps\Card\V1\BorderStyle $border_style + * The border style to apply to each grid item. + * @type int $column_count + * The number of columns to display in the grid. A default value + * is used if this field isn't specified, and that default value is + * different depending on where the grid is shown (dialog versus companion). + * @type \Google\Apps\Card\V1\OnClick $on_click + * This callback is reused by each individual grid item, but with the + * item's identifier and index in the items list added to the callback's + * parameters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The text that displays in the grid header. + * + * Generated from protobuf field string title = 1; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The text that displays in the grid header. + * + * Generated from protobuf field string title = 1; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The items to display in the grid. + * + * Generated from protobuf field repeated .google.apps.card.v1.Grid.GridItem items = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItems() + { + return $this->items; + } + + /** + * The items to display in the grid. + * + * Generated from protobuf field repeated .google.apps.card.v1.Grid.GridItem items = 2; + * @param array<\Google\Apps\Card\V1\Grid\GridItem>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItems($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Grid\GridItem::class); + $this->items = $arr; + + return $this; + } + + /** + * The border style to apply to each grid item. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle border_style = 3; + * @return \Google\Apps\Card\V1\BorderStyle|null + */ + public function getBorderStyle() + { + return $this->border_style; + } + + public function hasBorderStyle() + { + return isset($this->border_style); + } + + public function clearBorderStyle() + { + unset($this->border_style); + } + + /** + * The border style to apply to each grid item. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle border_style = 3; + * @param \Google\Apps\Card\V1\BorderStyle $var + * @return $this + */ + public function setBorderStyle($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\BorderStyle::class); + $this->border_style = $var; + + return $this; + } + + /** + * The number of columns to display in the grid. A default value + * is used if this field isn't specified, and that default value is + * different depending on where the grid is shown (dialog versus companion). + * + * Generated from protobuf field int32 column_count = 4; + * @return int + */ + public function getColumnCount() + { + return $this->column_count; + } + + /** + * The number of columns to display in the grid. A default value + * is used if this field isn't specified, and that default value is + * different depending on where the grid is shown (dialog versus companion). + * + * Generated from protobuf field int32 column_count = 4; + * @param int $var + * @return $this + */ + public function setColumnCount($var) + { + GPBUtil::checkInt32($var); + $this->column_count = $var; + + return $this; + } + + /** + * This callback is reused by each individual grid item, but with the + * item's identifier and index in the items list added to the callback's + * parameters. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 5; + * @return \Google\Apps\Card\V1\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * This callback is reused by each individual grid item, but with the + * item's identifier and index in the items list added to the callback's + * parameters. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 5; + * @param \Google\Apps\Card\V1\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\OnClick::class); + $this->on_click = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Grid/GridItem.php b/AppsChat/src/Card/V1/Grid/GridItem.php new file mode 100644 index 000000000000..bc296728ff7a --- /dev/null +++ b/AppsChat/src/Card/V1/Grid/GridItem.php @@ -0,0 +1,221 @@ +google.apps.card.v1.Grid.GridItem + */ +class GridItem extends \Google\Protobuf\Internal\Message +{ + /** + * A user-specified identifier for this grid item. This identifier is + * returned in the parent grid's `onClick` callback parameters. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * The image that displays in the grid item. + * + * Generated from protobuf field .google.apps.card.v1.ImageComponent image = 2; + */ + protected $image = null; + /** + * The grid item's title. + * + * Generated from protobuf field string title = 3; + */ + protected $title = ''; + /** + * The grid item's subtitle. + * + * Generated from protobuf field string subtitle = 4; + */ + protected $subtitle = ''; + /** + * The layout to use for the grid item. + * + * Generated from protobuf field .google.apps.card.v1.Grid.GridItem.GridItemLayout layout = 9; + */ + protected $layout = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * A user-specified identifier for this grid item. This identifier is + * returned in the parent grid's `onClick` callback parameters. + * @type \Google\Apps\Card\V1\ImageComponent $image + * The image that displays in the grid item. + * @type string $title + * The grid item's title. + * @type string $subtitle + * The grid item's subtitle. + * @type int $layout + * The layout to use for the grid item. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * A user-specified identifier for this grid item. This identifier is + * returned in the parent grid's `onClick` callback parameters. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * A user-specified identifier for this grid item. This identifier is + * returned in the parent grid's `onClick` callback parameters. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The image that displays in the grid item. + * + * Generated from protobuf field .google.apps.card.v1.ImageComponent image = 2; + * @return \Google\Apps\Card\V1\ImageComponent|null + */ + public function getImage() + { + return $this->image; + } + + public function hasImage() + { + return isset($this->image); + } + + public function clearImage() + { + unset($this->image); + } + + /** + * The image that displays in the grid item. + * + * Generated from protobuf field .google.apps.card.v1.ImageComponent image = 2; + * @param \Google\Apps\Card\V1\ImageComponent $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\ImageComponent::class); + $this->image = $var; + + return $this; + } + + /** + * The grid item's title. + * + * Generated from protobuf field string title = 3; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The grid item's title. + * + * Generated from protobuf field string title = 3; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The grid item's subtitle. + * + * Generated from protobuf field string subtitle = 4; + * @return string + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * The grid item's subtitle. + * + * Generated from protobuf field string subtitle = 4; + * @param string $var + * @return $this + */ + public function setSubtitle($var) + { + GPBUtil::checkString($var, True); + $this->subtitle = $var; + + return $this; + } + + /** + * The layout to use for the grid item. + * + * Generated from protobuf field .google.apps.card.v1.Grid.GridItem.GridItemLayout layout = 9; + * @return int + */ + public function getLayout() + { + return $this->layout; + } + + /** + * The layout to use for the grid item. + * + * Generated from protobuf field .google.apps.card.v1.Grid.GridItem.GridItemLayout layout = 9; + * @param int $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Grid\GridItem\GridItemLayout::class); + $this->layout = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/Grid/GridItem/GridItemLayout.php b/AppsChat/src/Card/V1/Grid/GridItem/GridItemLayout.php new file mode 100644 index 000000000000..979273fc70bb --- /dev/null +++ b/AppsChat/src/Card/V1/Grid/GridItem/GridItemLayout.php @@ -0,0 +1,64 @@ +google.apps.card.v1.Grid.GridItem.GridItemLayout + */ +class GridItemLayout +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum GRID_ITEM_LAYOUT_UNSPECIFIED = 0; + */ + const GRID_ITEM_LAYOUT_UNSPECIFIED = 0; + /** + * The title and subtitle are shown below the grid item's image. + * + * Generated from protobuf enum TEXT_BELOW = 1; + */ + const TEXT_BELOW = 1; + /** + * The title and subtitle are shown above the grid item's image. + * + * Generated from protobuf enum TEXT_ABOVE = 2; + */ + const TEXT_ABOVE = 2; + + private static $valueToName = [ + self::GRID_ITEM_LAYOUT_UNSPECIFIED => 'GRID_ITEM_LAYOUT_UNSPECIFIED', + self::TEXT_BELOW => 'TEXT_BELOW', + self::TEXT_ABOVE => 'TEXT_ABOVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Icon.php b/AppsChat/src/Card/V1/Icon.php new file mode 100644 index 000000000000..e3ef2178b1cb --- /dev/null +++ b/AppsChat/src/Card/V1/Icon.php @@ -0,0 +1,318 @@ +google.apps.card.v1.Icon + */ +class Icon extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A description of the icon used for accessibility. + * If unspecified, the default value `Button` is provided. As a best practice, + * you should set a helpful description for what the icon displays, and if + * applicable, what it does. For example, `A user's account portrait`, or + * `Opens a new browser tab and navigates to the Google Chat developer + * documentation at https://developers.google.com/workspace/chat`. + * If the icon is set in a [`Button`][google.apps.card.v1.Button], the + * `altText` appears as helper text when the user hovers over the button. + * However, if the button also sets `text`, the icon's `altText` is ignored. + * + * Generated from protobuf field string alt_text = 3; + */ + protected $alt_text = ''; + /** + * The crop style applied to the image. In some cases, applying a + * `CIRCLE` crop causes the image to be drawn larger than a built-in + * icon. + * + * Generated from protobuf field .google.apps.card.v1.Widget.ImageType image_type = 4; + */ + protected $image_type = 0; + protected $icons; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $known_icon + * Display one of the built-in icons provided by Google Workspace. + * For example, to display an airplane icon, specify `AIRPLANE`. + * For a bus, specify `BUS`. + * For a full list of supported icons, see [built-in + * icons](https://developers.google.com/workspace/chat/format-messages#builtinicons). + * @type string $icon_url + * Display a custom icon hosted at an HTTPS URL. + * For example: + * ``` + * "iconUrl": + * "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png" + * ``` + * Supported file types include `.png` and `.jpg`. + * @type \Google\Apps\Card\V1\MaterialIcon $material_icon + * Display one of the [Google Material + * Icons](https://fonts.google.com/icons). + * For example, to display a [checkbox + * icon](https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck_box%3AFILL%400%3Bwght%40400%3BGRAD%400%3Bopsz%4048), + * use + * ``` + * "material_icon": { + * "name": "check_box" + * } + * ``` + * [Google Chat apps](https://developers.google.com/workspace/chat): + * @type string $alt_text + * Optional. A description of the icon used for accessibility. + * If unspecified, the default value `Button` is provided. As a best practice, + * you should set a helpful description for what the icon displays, and if + * applicable, what it does. For example, `A user's account portrait`, or + * `Opens a new browser tab and navigates to the Google Chat developer + * documentation at https://developers.google.com/workspace/chat`. + * If the icon is set in a [`Button`][google.apps.card.v1.Button], the + * `altText` appears as helper text when the user hovers over the button. + * However, if the button also sets `text`, the icon's `altText` is ignored. + * @type int $image_type + * The crop style applied to the image. In some cases, applying a + * `CIRCLE` crop causes the image to be drawn larger than a built-in + * icon. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * Display one of the built-in icons provided by Google Workspace. + * For example, to display an airplane icon, specify `AIRPLANE`. + * For a bus, specify `BUS`. + * For a full list of supported icons, see [built-in + * icons](https://developers.google.com/workspace/chat/format-messages#builtinicons). + * + * Generated from protobuf field string known_icon = 1; + * @return string + */ + public function getKnownIcon() + { + return $this->readOneof(1); + } + + public function hasKnownIcon() + { + return $this->hasOneof(1); + } + + /** + * Display one of the built-in icons provided by Google Workspace. + * For example, to display an airplane icon, specify `AIRPLANE`. + * For a bus, specify `BUS`. + * For a full list of supported icons, see [built-in + * icons](https://developers.google.com/workspace/chat/format-messages#builtinicons). + * + * Generated from protobuf field string known_icon = 1; + * @param string $var + * @return $this + */ + public function setKnownIcon($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Display a custom icon hosted at an HTTPS URL. + * For example: + * ``` + * "iconUrl": + * "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png" + * ``` + * Supported file types include `.png` and `.jpg`. + * + * Generated from protobuf field string icon_url = 2; + * @return string + */ + public function getIconUrl() + { + return $this->readOneof(2); + } + + public function hasIconUrl() + { + return $this->hasOneof(2); + } + + /** + * Display a custom icon hosted at an HTTPS URL. + * For example: + * ``` + * "iconUrl": + * "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png" + * ``` + * Supported file types include `.png` and `.jpg`. + * + * Generated from protobuf field string icon_url = 2; + * @param string $var + * @return $this + */ + public function setIconUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Display one of the [Google Material + * Icons](https://fonts.google.com/icons). + * For example, to display a [checkbox + * icon](https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck_box%3AFILL%400%3Bwght%40400%3BGRAD%400%3Bopsz%4048), + * use + * ``` + * "material_icon": { + * "name": "check_box" + * } + * ``` + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field .google.apps.card.v1.MaterialIcon material_icon = 5; + * @return \Google\Apps\Card\V1\MaterialIcon|null + */ + public function getMaterialIcon() + { + return $this->readOneof(5); + } + + public function hasMaterialIcon() + { + return $this->hasOneof(5); + } + + /** + * Display one of the [Google Material + * Icons](https://fonts.google.com/icons). + * For example, to display a [checkbox + * icon](https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck_box%3AFILL%400%3Bwght%40400%3BGRAD%400%3Bopsz%4048), + * use + * ``` + * "material_icon": { + * "name": "check_box" + * } + * ``` + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field .google.apps.card.v1.MaterialIcon material_icon = 5; + * @param \Google\Apps\Card\V1\MaterialIcon $var + * @return $this + */ + public function setMaterialIcon($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\MaterialIcon::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Optional. A description of the icon used for accessibility. + * If unspecified, the default value `Button` is provided. As a best practice, + * you should set a helpful description for what the icon displays, and if + * applicable, what it does. For example, `A user's account portrait`, or + * `Opens a new browser tab and navigates to the Google Chat developer + * documentation at https://developers.google.com/workspace/chat`. + * If the icon is set in a [`Button`][google.apps.card.v1.Button], the + * `altText` appears as helper text when the user hovers over the button. + * However, if the button also sets `text`, the icon's `altText` is ignored. + * + * Generated from protobuf field string alt_text = 3; + * @return string + */ + public function getAltText() + { + return $this->alt_text; + } + + /** + * Optional. A description of the icon used for accessibility. + * If unspecified, the default value `Button` is provided. As a best practice, + * you should set a helpful description for what the icon displays, and if + * applicable, what it does. For example, `A user's account portrait`, or + * `Opens a new browser tab and navigates to the Google Chat developer + * documentation at https://developers.google.com/workspace/chat`. + * If the icon is set in a [`Button`][google.apps.card.v1.Button], the + * `altText` appears as helper text when the user hovers over the button. + * However, if the button also sets `text`, the icon's `altText` is ignored. + * + * Generated from protobuf field string alt_text = 3; + * @param string $var + * @return $this + */ + public function setAltText($var) + { + GPBUtil::checkString($var, True); + $this->alt_text = $var; + + return $this; + } + + /** + * The crop style applied to the image. In some cases, applying a + * `CIRCLE` crop causes the image to be drawn larger than a built-in + * icon. + * + * Generated from protobuf field .google.apps.card.v1.Widget.ImageType image_type = 4; + * @return int + */ + public function getImageType() + { + return $this->image_type; + } + + /** + * The crop style applied to the image. In some cases, applying a + * `CIRCLE` crop causes the image to be drawn larger than a built-in + * icon. + * + * Generated from protobuf field .google.apps.card.v1.Widget.ImageType image_type = 4; + * @param int $var + * @return $this + */ + public function setImageType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Widget\ImageType::class); + $this->image_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getIcons() + { + return $this->whichOneof("icons"); + } + +} + diff --git a/AppsChat/src/Card/V1/Image.php b/AppsChat/src/Card/V1/Image.php new file mode 100644 index 000000000000..9cd6c58f1608 --- /dev/null +++ b/AppsChat/src/Card/V1/Image.php @@ -0,0 +1,165 @@ +google.apps.card.v1.Image + */ +class Image extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTPS URL that hosts the image. + * For example: + * ``` + * https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png + * ``` + * + * Generated from protobuf field string image_url = 1; + */ + protected $image_url = ''; + /** + * When a user clicks the image, the click triggers this action. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 2; + */ + protected $on_click = null; + /** + * The alternative text of this image that's used for accessibility. + * + * Generated from protobuf field string alt_text = 3; + */ + protected $alt_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $image_url + * The HTTPS URL that hosts the image. + * For example: + * ``` + * https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png + * ``` + * @type \Google\Apps\Card\V1\OnClick $on_click + * When a user clicks the image, the click triggers this action. + * @type string $alt_text + * The alternative text of this image that's used for accessibility. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The HTTPS URL that hosts the image. + * For example: + * ``` + * https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png + * ``` + * + * Generated from protobuf field string image_url = 1; + * @return string + */ + public function getImageUrl() + { + return $this->image_url; + } + + /** + * The HTTPS URL that hosts the image. + * For example: + * ``` + * https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png + * ``` + * + * Generated from protobuf field string image_url = 1; + * @param string $var + * @return $this + */ + public function setImageUrl($var) + { + GPBUtil::checkString($var, True); + $this->image_url = $var; + + return $this; + } + + /** + * When a user clicks the image, the click triggers this action. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 2; + * @return \Google\Apps\Card\V1\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * When a user clicks the image, the click triggers this action. + * + * Generated from protobuf field .google.apps.card.v1.OnClick on_click = 2; + * @param \Google\Apps\Card\V1\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\OnClick::class); + $this->on_click = $var; + + return $this; + } + + /** + * The alternative text of this image that's used for accessibility. + * + * Generated from protobuf field string alt_text = 3; + * @return string + */ + public function getAltText() + { + return $this->alt_text; + } + + /** + * The alternative text of this image that's used for accessibility. + * + * Generated from protobuf field string alt_text = 3; + * @param string $var + * @return $this + */ + public function setAltText($var) + { + GPBUtil::checkString($var, True); + $this->alt_text = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/ImageComponent.php b/AppsChat/src/Card/V1/ImageComponent.php new file mode 100644 index 000000000000..b0b07608f838 --- /dev/null +++ b/AppsChat/src/Card/V1/ImageComponent.php @@ -0,0 +1,191 @@ +google.apps.card.v1.ImageComponent + */ +class ImageComponent extends \Google\Protobuf\Internal\Message +{ + /** + * The image URL. + * + * Generated from protobuf field string image_uri = 1; + */ + protected $image_uri = ''; + /** + * The accessibility label for the image. + * + * Generated from protobuf field string alt_text = 2; + */ + protected $alt_text = ''; + /** + * The crop style to apply to the image. + * + * Generated from protobuf field .google.apps.card.v1.ImageCropStyle crop_style = 3; + */ + protected $crop_style = null; + /** + * The border style to apply to the image. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle border_style = 4; + */ + protected $border_style = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $image_uri + * The image URL. + * @type string $alt_text + * The accessibility label for the image. + * @type \Google\Apps\Card\V1\ImageCropStyle $crop_style + * The crop style to apply to the image. + * @type \Google\Apps\Card\V1\BorderStyle $border_style + * The border style to apply to the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The image URL. + * + * Generated from protobuf field string image_uri = 1; + * @return string + */ + public function getImageUri() + { + return $this->image_uri; + } + + /** + * The image URL. + * + * Generated from protobuf field string image_uri = 1; + * @param string $var + * @return $this + */ + public function setImageUri($var) + { + GPBUtil::checkString($var, True); + $this->image_uri = $var; + + return $this; + } + + /** + * The accessibility label for the image. + * + * Generated from protobuf field string alt_text = 2; + * @return string + */ + public function getAltText() + { + return $this->alt_text; + } + + /** + * The accessibility label for the image. + * + * Generated from protobuf field string alt_text = 2; + * @param string $var + * @return $this + */ + public function setAltText($var) + { + GPBUtil::checkString($var, True); + $this->alt_text = $var; + + return $this; + } + + /** + * The crop style to apply to the image. + * + * Generated from protobuf field .google.apps.card.v1.ImageCropStyle crop_style = 3; + * @return \Google\Apps\Card\V1\ImageCropStyle|null + */ + public function getCropStyle() + { + return $this->crop_style; + } + + public function hasCropStyle() + { + return isset($this->crop_style); + } + + public function clearCropStyle() + { + unset($this->crop_style); + } + + /** + * The crop style to apply to the image. + * + * Generated from protobuf field .google.apps.card.v1.ImageCropStyle crop_style = 3; + * @param \Google\Apps\Card\V1\ImageCropStyle $var + * @return $this + */ + public function setCropStyle($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\ImageCropStyle::class); + $this->crop_style = $var; + + return $this; + } + + /** + * The border style to apply to the image. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle border_style = 4; + * @return \Google\Apps\Card\V1\BorderStyle|null + */ + public function getBorderStyle() + { + return $this->border_style; + } + + public function hasBorderStyle() + { + return isset($this->border_style); + } + + public function clearBorderStyle() + { + unset($this->border_style); + } + + /** + * The border style to apply to the image. + * + * Generated from protobuf field .google.apps.card.v1.BorderStyle border_style = 4; + * @param \Google\Apps\Card\V1\BorderStyle $var + * @return $this + */ + public function setBorderStyle($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\BorderStyle::class); + $this->border_style = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/ImageCropStyle.php b/AppsChat/src/Card/V1/ImageCropStyle.php new file mode 100644 index 000000000000..eb70bd52adf0 --- /dev/null +++ b/AppsChat/src/Card/V1/ImageCropStyle.php @@ -0,0 +1,138 @@ +google.apps.card.v1.ImageCropStyle + */ +class ImageCropStyle extends \Google\Protobuf\Internal\Message +{ + /** + * The crop type. + * + * Generated from protobuf field .google.apps.card.v1.ImageCropStyle.ImageCropType type = 1; + */ + protected $type = 0; + /** + * The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + * For example, here's how to apply a 16:9 aspect ratio: + * ``` + * cropStyle { + * "type": "RECTANGLE_CUSTOM", + * "aspectRatio": 16/9 + * } + * ``` + * + * Generated from protobuf field double aspect_ratio = 2; + */ + protected $aspect_ratio = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The crop type. + * @type float $aspect_ratio + * The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + * For example, here's how to apply a 16:9 aspect ratio: + * ``` + * cropStyle { + * "type": "RECTANGLE_CUSTOM", + * "aspectRatio": 16/9 + * } + * ``` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The crop type. + * + * Generated from protobuf field .google.apps.card.v1.ImageCropStyle.ImageCropType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The crop type. + * + * Generated from protobuf field .google.apps.card.v1.ImageCropStyle.ImageCropType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\ImageCropStyle\ImageCropType::class); + $this->type = $var; + + return $this; + } + + /** + * The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + * For example, here's how to apply a 16:9 aspect ratio: + * ``` + * cropStyle { + * "type": "RECTANGLE_CUSTOM", + * "aspectRatio": 16/9 + * } + * ``` + * + * Generated from protobuf field double aspect_ratio = 2; + * @return float + */ + public function getAspectRatio() + { + return $this->aspect_ratio; + } + + /** + * The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. + * For example, here's how to apply a 16:9 aspect ratio: + * ``` + * cropStyle { + * "type": "RECTANGLE_CUSTOM", + * "aspectRatio": 16/9 + * } + * ``` + * + * Generated from protobuf field double aspect_ratio = 2; + * @param float $var + * @return $this + */ + public function setAspectRatio($var) + { + GPBUtil::checkDouble($var); + $this->aspect_ratio = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/ImageCropStyle/ImageCropType.php b/AppsChat/src/Card/V1/ImageCropStyle/ImageCropType.php new file mode 100644 index 000000000000..a9699aa12ff8 --- /dev/null +++ b/AppsChat/src/Card/V1/ImageCropStyle/ImageCropType.php @@ -0,0 +1,79 @@ +google.apps.card.v1.ImageCropStyle.ImageCropType + */ +class ImageCropType +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum IMAGE_CROP_TYPE_UNSPECIFIED = 0; + */ + const IMAGE_CROP_TYPE_UNSPECIFIED = 0; + /** + * Default value. Applies a square crop. + * + * Generated from protobuf enum SQUARE = 1; + */ + const SQUARE = 1; + /** + * Applies a circular crop. + * + * Generated from protobuf enum CIRCLE = 2; + */ + const CIRCLE = 2; + /** + * Applies a rectangular crop with a custom aspect ratio. Set the custom + * aspect ratio with `aspectRatio`. + * + * Generated from protobuf enum RECTANGLE_CUSTOM = 3; + */ + const RECTANGLE_CUSTOM = 3; + /** + * Applies a rectangular crop with a 4:3 aspect ratio. + * + * Generated from protobuf enum RECTANGLE_4_3 = 4; + */ + const RECTANGLE_4_3 = 4; + + private static $valueToName = [ + self::IMAGE_CROP_TYPE_UNSPECIFIED => 'IMAGE_CROP_TYPE_UNSPECIFIED', + self::SQUARE => 'SQUARE', + self::CIRCLE => 'CIRCLE', + self::RECTANGLE_CUSTOM => 'RECTANGLE_CUSTOM', + self::RECTANGLE_4_3 => 'RECTANGLE_4_3', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/MaterialIcon.php b/AppsChat/src/Card/V1/MaterialIcon.php new file mode 100644 index 000000000000..f37b5ed6e401 --- /dev/null +++ b/AppsChat/src/Card/V1/MaterialIcon.php @@ -0,0 +1,250 @@ +google.apps.card.v1.MaterialIcon + */ +class MaterialIcon extends \Google\Protobuf\Internal\Message +{ + /** + * The icon name defined in the [Google Material + * Icon](https://fonts.google.com/icons), for example, `check_box`. Any + * invalid names are abandoned and replaced with empty string and + * results in the icon failing to render. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Whether the icon renders as filled. Default value is false. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field bool fill = 2; + */ + protected $fill = false; + /** + * The stroke weight of the icon. Choose from {100, 200, 300, 400, + * 500, 600, 700}. If absent, default value is 400. If any other value is + * specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field int32 weight = 3; + */ + protected $weight = 0; + /** + * Weight and grade affect a symbol’s thickness. Adjustments to grade are more + * granular than adjustments to weight and have a small impact on the size of + * the symbol. Choose from {-25, 0, 200}. If absent, default value is 0. If + * any other value is specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field int32 grade = 4; + */ + protected $grade = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The icon name defined in the [Google Material + * Icon](https://fonts.google.com/icons), for example, `check_box`. Any + * invalid names are abandoned and replaced with empty string and + * results in the icon failing to render. + * @type bool $fill + * Whether the icon renders as filled. Default value is false. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * @type int $weight + * The stroke weight of the icon. Choose from {100, 200, 300, 400, + * 500, 600, 700}. If absent, default value is 400. If any other value is + * specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * @type int $grade + * Weight and grade affect a symbol’s thickness. Adjustments to grade are more + * granular than adjustments to weight and have a small impact on the size of + * the symbol. Choose from {-25, 0, 200}. If absent, default value is 0. If + * any other value is specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The icon name defined in the [Google Material + * Icon](https://fonts.google.com/icons), for example, `check_box`. Any + * invalid names are abandoned and replaced with empty string and + * results in the icon failing to render. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The icon name defined in the [Google Material + * Icon](https://fonts.google.com/icons), for example, `check_box`. Any + * invalid names are abandoned and replaced with empty string and + * results in the icon failing to render. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Whether the icon renders as filled. Default value is false. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field bool fill = 2; + * @return bool + */ + public function getFill() + { + return $this->fill; + } + + /** + * Whether the icon renders as filled. Default value is false. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field bool fill = 2; + * @param bool $var + * @return $this + */ + public function setFill($var) + { + GPBUtil::checkBool($var); + $this->fill = $var; + + return $this; + } + + /** + * The stroke weight of the icon. Choose from {100, 200, 300, 400, + * 500, 600, 700}. If absent, default value is 400. If any other value is + * specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field int32 weight = 3; + * @return int + */ + public function getWeight() + { + return $this->weight; + } + + /** + * The stroke weight of the icon. Choose from {100, 200, 300, 400, + * 500, 600, 700}. If absent, default value is 400. If any other value is + * specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field int32 weight = 3; + * @param int $var + * @return $this + */ + public function setWeight($var) + { + GPBUtil::checkInt32($var); + $this->weight = $var; + + return $this; + } + + /** + * Weight and grade affect a symbol’s thickness. Adjustments to grade are more + * granular than adjustments to weight and have a small impact on the size of + * the symbol. Choose from {-25, 0, 200}. If absent, default value is 0. If + * any other value is specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field int32 grade = 4; + * @return int + */ + public function getGrade() + { + return $this->grade; + } + + /** + * Weight and grade affect a symbol’s thickness. Adjustments to grade are more + * granular than adjustments to weight and have a small impact on the size of + * the symbol. Choose from {-25, 0, 200}. If absent, default value is 0. If + * any other value is specified, the default value is used. + * To preview different icon settings, go to + * [Google Font Icons](https://fonts.google.com/icons) and adjust the + * settings under **Customize**. + * + * Generated from protobuf field int32 grade = 4; + * @param int $var + * @return $this + */ + public function setGrade($var) + { + GPBUtil::checkInt32($var); + $this->grade = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/OnClick.php b/AppsChat/src/Card/V1/OnClick.php new file mode 100644 index 000000000000..7fe0139a6eda --- /dev/null +++ b/AppsChat/src/Card/V1/OnClick.php @@ -0,0 +1,198 @@ +google.apps.card.v1.OnClick + */ +class OnClick extends \Google\Protobuf\Internal\Message +{ + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\Action $action + * If specified, an action is triggered by this `onClick`. + * @type \Google\Apps\Card\V1\OpenLink $open_link + * If specified, this `onClick` triggers an open link action. + * @type \Google\Apps\Card\V1\Action $open_dynamic_link_action + * An add-on triggers this action when the action needs to open a + * link. This differs from the `open_link` above in that this needs to talk + * to server to get the link. Thus some preparation work is required for + * web client to do before the open link action response comes back. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * @type \Google\Apps\Card\V1\Card $card + * A new card is pushed to the card stack after clicking if specified. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * If specified, an action is triggered by this `onClick`. + * + * Generated from protobuf field .google.apps.card.v1.Action action = 1; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getAction() + { + return $this->readOneof(1); + } + + public function hasAction() + { + return $this->hasOneof(1); + } + + /** + * If specified, an action is triggered by this `onClick`. + * + * Generated from protobuf field .google.apps.card.v1.Action action = 1; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If specified, this `onClick` triggers an open link action. + * + * Generated from protobuf field .google.apps.card.v1.OpenLink open_link = 2; + * @return \Google\Apps\Card\V1\OpenLink|null + */ + public function getOpenLink() + { + return $this->readOneof(2); + } + + public function hasOpenLink() + { + return $this->hasOneof(2); + } + + /** + * If specified, this `onClick` triggers an open link action. + * + * Generated from protobuf field .google.apps.card.v1.OpenLink open_link = 2; + * @param \Google\Apps\Card\V1\OpenLink $var + * @return $this + */ + public function setOpenLink($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\OpenLink::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * An add-on triggers this action when the action needs to open a + * link. This differs from the `open_link` above in that this needs to talk + * to server to get the link. Thus some preparation work is required for + * web client to do before the open link action response comes back. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Action open_dynamic_link_action = 3; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getOpenDynamicLinkAction() + { + return $this->readOneof(3); + } + + public function hasOpenDynamicLinkAction() + { + return $this->hasOneof(3); + } + + /** + * An add-on triggers this action when the action needs to open a + * link. This differs from the `open_link` above in that this needs to talk + * to server to get the link. Thus some preparation work is required for + * web client to do before the open link action response comes back. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Action open_dynamic_link_action = 3; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setOpenDynamicLinkAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * A new card is pushed to the card stack after clicking if specified. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card card = 4; + * @return \Google\Apps\Card\V1\Card|null + */ + public function getCard() + { + return $this->readOneof(4); + } + + public function hasCard() + { + return $this->hasOneof(4); + } + + /** + * A new card is pushed to the card stack after clicking if specified. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Card card = 4; + * @param \Google\Apps\Card\V1\Card $var + * @return $this + */ + public function setCard($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Card::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + diff --git a/AppsChat/src/Card/V1/OpenLink.php b/AppsChat/src/Card/V1/OpenLink.php new file mode 100644 index 000000000000..f401cd8d1c40 --- /dev/null +++ b/AppsChat/src/Card/V1/OpenLink.php @@ -0,0 +1,157 @@ +google.apps.card.v1.OpenLink + */ +class OpenLink extends \Google\Protobuf\Internal\Message +{ + /** + * The URL to open. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * How to open a link. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.OpenLink.OpenAs open_as = 2; + */ + protected $open_as = 0; + /** + * Whether the client forgets about a link after opening it, or observes it + * until the window closes. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.OpenLink.OnClose on_close = 3; + */ + protected $on_close = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The URL to open. + * @type int $open_as + * How to open a link. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * @type int $on_close + * Whether the client forgets about a link after opening it, or observes it + * until the window closes. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The URL to open. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL to open. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * How to open a link. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.OpenLink.OpenAs open_as = 2; + * @return int + */ + public function getOpenAs() + { + return $this->open_as; + } + + /** + * How to open a link. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.OpenLink.OpenAs open_as = 2; + * @param int $var + * @return $this + */ + public function setOpenAs($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\OpenLink\OpenAs::class); + $this->open_as = $var; + + return $this; + } + + /** + * Whether the client forgets about a link after opening it, or observes it + * until the window closes. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.OpenLink.OnClose on_close = 3; + * @return int + */ + public function getOnClose() + { + return $this->on_close; + } + + /** + * Whether the client forgets about a link after opening it, or observes it + * until the window closes. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.OpenLink.OnClose on_close = 3; + * @param int $var + * @return $this + */ + public function setOnClose($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\OpenLink\OnClose::class); + $this->on_close = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/OpenLink/OnClose.php b/AppsChat/src/Card/V1/OpenLink/OnClose.php new file mode 100644 index 000000000000..998685bc26f4 --- /dev/null +++ b/AppsChat/src/Card/V1/OpenLink/OnClose.php @@ -0,0 +1,65 @@ +google.apps.card.v1.OpenLink.OnClose + */ +class OnClose +{ + /** + * Default value. The card doesn't reload; nothing happens. + * + * Generated from protobuf enum NOTHING = 0; + */ + const NOTHING = 0; + /** + * Reloads the card after the child window closes. + * If used in conjunction with + * [`OpenAs.OVERLAY`](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#openas), + * the child window acts as a modal dialog and the parent card is blocked + * until the child window closes. + * + * Generated from protobuf enum RELOAD = 1; + */ + const RELOAD = 1; + + private static $valueToName = [ + self::NOTHING => 'NOTHING', + self::RELOAD => 'RELOAD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/OpenLink/OpenAs.php b/AppsChat/src/Card/V1/OpenLink/OpenAs.php new file mode 100644 index 000000000000..c5058bb03a61 --- /dev/null +++ b/AppsChat/src/Card/V1/OpenLink/OpenAs.php @@ -0,0 +1,62 @@ +google.apps.card.v1.OpenLink.OpenAs + */ +class OpenAs +{ + /** + * The link opens as a full-size window (if that's the frame used by the + * client). + * + * Generated from protobuf enum FULL_SIZE = 0; + */ + const FULL_SIZE = 0; + /** + * The link opens as an overlay, such as a pop-up. + * + * Generated from protobuf enum OVERLAY = 1; + */ + const OVERLAY = 1; + + private static $valueToName = [ + self::FULL_SIZE => 'FULL_SIZE', + self::OVERLAY => 'OVERLAY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/SelectionInput.php b/AppsChat/src/Card/V1/SelectionInput.php new file mode 100644 index 000000000000..8ae42a18e5d9 --- /dev/null +++ b/AppsChat/src/Card/V1/SelectionInput.php @@ -0,0 +1,439 @@ +google.apps.card.v1.SelectionInput + */ +class SelectionInput extends \Google\Protobuf\Internal\Message +{ + /** + * The name that identifies the selection input in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The text that appears above the selection input field in the user + * interface. + * Specify text that helps the user enter the information your app needs. + * For example, if users are selecting the urgency of a work ticket from a + * drop-down menu, the label might be "Urgency" or "Select urgency". + * + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + /** + * The type of items that are displayed to users in a `SelectionInput` widget. + * Selection types support different types of interactions. For example, users + * can select one or more checkboxes, but they can only select one value from + * a dropdown menu. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.SelectionType type = 3; + */ + protected $type = 0; + /** + * An array of selectable items. For example, an array of radio buttons or + * checkboxes. Supports up to 100 items. + * + * Generated from protobuf field repeated .google.apps.card.v1.SelectionInput.SelectionItem items = 4; + */ + private $items; + /** + * If specified, the form is submitted when the selection changes. If not + * specified, you must specify a separate button that submits the form. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 5; + */ + protected $on_change_action = null; + /** + * For multiselect menus, the maximum number of items that a user can select. + * Minimum value is 1 item. If unspecified, defaults to 3 items. + * + * Generated from protobuf field int32 multi_select_max_selected_items = 6; + */ + protected $multi_select_max_selected_items = 0; + /** + * For multiselect menus, the number of text characters that a user inputs + * before the app queries autocomplete and displays suggested items + * in the menu. + * If unspecified, defaults to 0 characters for static data sources and 3 + * characters for external data sources. + * + * Generated from protobuf field int32 multi_select_min_query_length = 7; + */ + protected $multi_select_min_query_length = 0; + protected $multi_select_data_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name that identifies the selection input in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type string $label + * The text that appears above the selection input field in the user + * interface. + * Specify text that helps the user enter the information your app needs. + * For example, if users are selecting the urgency of a work ticket from a + * drop-down menu, the label might be "Urgency" or "Select urgency". + * @type int $type + * The type of items that are displayed to users in a `SelectionInput` widget. + * Selection types support different types of interactions. For example, users + * can select one or more checkboxes, but they can only select one value from + * a dropdown menu. + * @type array<\Google\Apps\Card\V1\SelectionInput\SelectionItem>|\Google\Protobuf\Internal\RepeatedField $items + * An array of selectable items. For example, an array of radio buttons or + * checkboxes. Supports up to 100 items. + * @type \Google\Apps\Card\V1\Action $on_change_action + * If specified, the form is submitted when the selection changes. If not + * specified, you must specify a separate button that submits the form. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type int $multi_select_max_selected_items + * For multiselect menus, the maximum number of items that a user can select. + * Minimum value is 1 item. If unspecified, defaults to 3 items. + * @type int $multi_select_min_query_length + * For multiselect menus, the number of text characters that a user inputs + * before the app queries autocomplete and displays suggested items + * in the menu. + * If unspecified, defaults to 0 characters for static data sources and 3 + * characters for external data sources. + * @type \Google\Apps\Card\V1\Action $external_data_source + * An external data source, such as a relational data base. + * @type \Google\Apps\Card\V1\SelectionInput\PlatformDataSource $platform_data_source + * A data source from Google Workspace. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The name that identifies the selection input in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name that identifies the selection input in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The text that appears above the selection input field in the user + * interface. + * Specify text that helps the user enter the information your app needs. + * For example, if users are selecting the urgency of a work ticket from a + * drop-down menu, the label might be "Urgency" or "Select urgency". + * + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * The text that appears above the selection input field in the user + * interface. + * Specify text that helps the user enter the information your app needs. + * For example, if users are selecting the urgency of a work ticket from a + * drop-down menu, the label might be "Urgency" or "Select urgency". + * + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * The type of items that are displayed to users in a `SelectionInput` widget. + * Selection types support different types of interactions. For example, users + * can select one or more checkboxes, but they can only select one value from + * a dropdown menu. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.SelectionType type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of items that are displayed to users in a `SelectionInput` widget. + * Selection types support different types of interactions. For example, users + * can select one or more checkboxes, but they can only select one value from + * a dropdown menu. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.SelectionType type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\SelectionInput\SelectionType::class); + $this->type = $var; + + return $this; + } + + /** + * An array of selectable items. For example, an array of radio buttons or + * checkboxes. Supports up to 100 items. + * + * Generated from protobuf field repeated .google.apps.card.v1.SelectionInput.SelectionItem items = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItems() + { + return $this->items; + } + + /** + * An array of selectable items. For example, an array of radio buttons or + * checkboxes. Supports up to 100 items. + * + * Generated from protobuf field repeated .google.apps.card.v1.SelectionInput.SelectionItem items = 4; + * @param array<\Google\Apps\Card\V1\SelectionInput\SelectionItem>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItems($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\SelectionInput\SelectionItem::class); + $this->items = $arr; + + return $this; + } + + /** + * If specified, the form is submitted when the selection changes. If not + * specified, you must specify a separate button that submits the form. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 5; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getOnChangeAction() + { + return $this->on_change_action; + } + + public function hasOnChangeAction() + { + return isset($this->on_change_action); + } + + public function clearOnChangeAction() + { + unset($this->on_change_action); + } + + /** + * If specified, the form is submitted when the selection changes. If not + * specified, you must specify a separate button that submits the form. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 5; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setOnChangeAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->on_change_action = $var; + + return $this; + } + + /** + * For multiselect menus, the maximum number of items that a user can select. + * Minimum value is 1 item. If unspecified, defaults to 3 items. + * + * Generated from protobuf field int32 multi_select_max_selected_items = 6; + * @return int + */ + public function getMultiSelectMaxSelectedItems() + { + return $this->multi_select_max_selected_items; + } + + /** + * For multiselect menus, the maximum number of items that a user can select. + * Minimum value is 1 item. If unspecified, defaults to 3 items. + * + * Generated from protobuf field int32 multi_select_max_selected_items = 6; + * @param int $var + * @return $this + */ + public function setMultiSelectMaxSelectedItems($var) + { + GPBUtil::checkInt32($var); + $this->multi_select_max_selected_items = $var; + + return $this; + } + + /** + * For multiselect menus, the number of text characters that a user inputs + * before the app queries autocomplete and displays suggested items + * in the menu. + * If unspecified, defaults to 0 characters for static data sources and 3 + * characters for external data sources. + * + * Generated from protobuf field int32 multi_select_min_query_length = 7; + * @return int + */ + public function getMultiSelectMinQueryLength() + { + return $this->multi_select_min_query_length; + } + + /** + * For multiselect menus, the number of text characters that a user inputs + * before the app queries autocomplete and displays suggested items + * in the menu. + * If unspecified, defaults to 0 characters for static data sources and 3 + * characters for external data sources. + * + * Generated from protobuf field int32 multi_select_min_query_length = 7; + * @param int $var + * @return $this + */ + public function setMultiSelectMinQueryLength($var) + { + GPBUtil::checkInt32($var); + $this->multi_select_min_query_length = $var; + + return $this; + } + + /** + * An external data source, such as a relational data base. + * + * Generated from protobuf field .google.apps.card.v1.Action external_data_source = 8; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getExternalDataSource() + { + return $this->readOneof(8); + } + + public function hasExternalDataSource() + { + return $this->hasOneof(8); + } + + /** + * An external data source, such as a relational data base. + * + * Generated from protobuf field .google.apps.card.v1.Action external_data_source = 8; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setExternalDataSource($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * A data source from Google Workspace. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.PlatformDataSource platform_data_source = 9; + * @return \Google\Apps\Card\V1\SelectionInput\PlatformDataSource|null + */ + public function getPlatformDataSource() + { + return $this->readOneof(9); + } + + public function hasPlatformDataSource() + { + return $this->hasOneof(9); + } + + /** + * A data source from Google Workspace. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.PlatformDataSource platform_data_source = 9; + * @param \Google\Apps\Card\V1\SelectionInput\PlatformDataSource $var + * @return $this + */ + public function setPlatformDataSource($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\SelectionInput\PlatformDataSource::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * @return string + */ + public function getMultiSelectDataSource() + { + return $this->whichOneof("multi_select_data_source"); + } + +} + diff --git a/AppsChat/src/Card/V1/SelectionInput/PlatformDataSource.php b/AppsChat/src/Card/V1/SelectionInput/PlatformDataSource.php new file mode 100644 index 000000000000..c57b4ca69fec --- /dev/null +++ b/AppsChat/src/Card/V1/SelectionInput/PlatformDataSource.php @@ -0,0 +1,83 @@ +google.apps.card.v1.SelectionInput.PlatformDataSource + */ +class PlatformDataSource extends \Google\Protobuf\Internal\Message +{ + protected $data_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $common_data_source + * A data source shared by all Google Workspace applications, such as + * users in a Google Workspace organization. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * A data source shared by all Google Workspace applications, such as + * users in a Google Workspace organization. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.PlatformDataSource.CommonDataSource common_data_source = 1; + * @return int + */ + public function getCommonDataSource() + { + return $this->readOneof(1); + } + + public function hasCommonDataSource() + { + return $this->hasOneof(1); + } + + /** + * A data source shared by all Google Workspace applications, such as + * users in a Google Workspace organization. + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput.PlatformDataSource.CommonDataSource common_data_source = 1; + * @param int $var + * @return $this + */ + public function setCommonDataSource($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\SelectionInput\PlatformDataSource\CommonDataSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDataSource() + { + return $this->whichOneof("data_source"); + } + +} + + diff --git a/AppsChat/src/Card/V1/SelectionInput/PlatformDataSource/CommonDataSource.php b/AppsChat/src/Card/V1/SelectionInput/PlatformDataSource/CommonDataSource.php new file mode 100644 index 000000000000..cb9973e908a0 --- /dev/null +++ b/AppsChat/src/Card/V1/SelectionInput/PlatformDataSource/CommonDataSource.php @@ -0,0 +1,59 @@ +google.apps.card.v1.SelectionInput.PlatformDataSource.CommonDataSource + */ +class CommonDataSource +{ + /** + * Default value. Don't use. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Google Workspace users. The user can only view and select users from + * their Google Workspace organization. + * + * Generated from protobuf enum USER = 1; + */ + const USER = 1; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::USER => 'USER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/SelectionInput/SelectionItem.php b/AppsChat/src/Card/V1/SelectionInput/SelectionItem.php new file mode 100644 index 000000000000..3ed2ba659cf9 --- /dev/null +++ b/AppsChat/src/Card/V1/SelectionInput/SelectionItem.php @@ -0,0 +1,243 @@ +google.apps.card.v1.SelectionInput.SelectionItem + */ +class SelectionItem extends \Google\Protobuf\Internal\Message +{ + /** + * The text that identifies or describes the item to users. + * + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + /** + * The value associated with this item. The client should use this as a form + * input value. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + /** + * Whether the item is selected by default. If the selection input only + * accepts one value (such as for radio buttons or a dropdown menu), only + * set this field for one item. + * + * Generated from protobuf field bool selected = 3; + */ + protected $selected = false; + /** + * For multiselect menus, the URL for the icon displayed next to + * the item's `text` field. Supports PNG and JPEG files. Must be an `HTTPS` + * URL. For example, + * `https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png`. + * + * Generated from protobuf field string start_icon_uri = 4; + */ + protected $start_icon_uri = ''; + /** + * For multiselect menus, a text description or label that's + * displayed below the item's `text` field. + * + * Generated from protobuf field string bottom_text = 5; + */ + protected $bottom_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The text that identifies or describes the item to users. + * @type string $value + * The value associated with this item. The client should use this as a form + * input value. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type bool $selected + * Whether the item is selected by default. If the selection input only + * accepts one value (such as for radio buttons or a dropdown menu), only + * set this field for one item. + * @type string $start_icon_uri + * For multiselect menus, the URL for the icon displayed next to + * the item's `text` field. Supports PNG and JPEG files. Must be an `HTTPS` + * URL. For example, + * `https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png`. + * @type string $bottom_text + * For multiselect menus, a text description or label that's + * displayed below the item's `text` field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The text that identifies or describes the item to users. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The text that identifies or describes the item to users. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * The value associated with this item. The client should use this as a form + * input value. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value associated with this item. The client should use this as a form + * input value. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Whether the item is selected by default. If the selection input only + * accepts one value (such as for radio buttons or a dropdown menu), only + * set this field for one item. + * + * Generated from protobuf field bool selected = 3; + * @return bool + */ + public function getSelected() + { + return $this->selected; + } + + /** + * Whether the item is selected by default. If the selection input only + * accepts one value (such as for radio buttons or a dropdown menu), only + * set this field for one item. + * + * Generated from protobuf field bool selected = 3; + * @param bool $var + * @return $this + */ + public function setSelected($var) + { + GPBUtil::checkBool($var); + $this->selected = $var; + + return $this; + } + + /** + * For multiselect menus, the URL for the icon displayed next to + * the item's `text` field. Supports PNG and JPEG files. Must be an `HTTPS` + * URL. For example, + * `https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png`. + * + * Generated from protobuf field string start_icon_uri = 4; + * @return string + */ + public function getStartIconUri() + { + return $this->start_icon_uri; + } + + /** + * For multiselect menus, the URL for the icon displayed next to + * the item's `text` field. Supports PNG and JPEG files. Must be an `HTTPS` + * URL. For example, + * `https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png`. + * + * Generated from protobuf field string start_icon_uri = 4; + * @param string $var + * @return $this + */ + public function setStartIconUri($var) + { + GPBUtil::checkString($var, True); + $this->start_icon_uri = $var; + + return $this; + } + + /** + * For multiselect menus, a text description or label that's + * displayed below the item's `text` field. + * + * Generated from protobuf field string bottom_text = 5; + * @return string + */ + public function getBottomText() + { + return $this->bottom_text; + } + + /** + * For multiselect menus, a text description or label that's + * displayed below the item's `text` field. + * + * Generated from protobuf field string bottom_text = 5; + * @param string $var + * @return $this + */ + public function setBottomText($var) + { + GPBUtil::checkString($var, True); + $this->bottom_text = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Card/V1/SelectionInput/SelectionType.php b/AppsChat/src/Card/V1/SelectionInput/SelectionType.php new file mode 100644 index 000000000000..1a84c939688c --- /dev/null +++ b/AppsChat/src/Card/V1/SelectionInput/SelectionType.php @@ -0,0 +1,104 @@ +google.apps.card.v1.SelectionInput.SelectionType + */ +class SelectionType +{ + /** + * A set of checkboxes. Users can select one or more checkboxes. + * + * Generated from protobuf enum CHECK_BOX = 0; + */ + const CHECK_BOX = 0; + /** + * A set of radio buttons. Users can select one radio button. + * + * Generated from protobuf enum RADIO_BUTTON = 1; + */ + const RADIO_BUTTON = 1; + /** + * A set of switches. Users can turn on one or more switches. + * + * Generated from protobuf enum SWITCH = 2; + */ + const PBSWITCH = 2; + /** + * A dropdown menu. Users can select one item from the menu. + * + * Generated from protobuf enum DROPDOWN = 3; + */ + const DROPDOWN = 3; + /** + * A multiselect menu for static or dynamic data. From the menu bar, + * users select one or more items. Users can also input values to populate + * dynamic data. For example, users can start typing the name of a Google + * Chat space and the widget autosuggests the space. + * To populate items for a multiselect menu, you can use one of the + * following types of data sources: + * * Static data: Items are specified as `SelectionItem` objects in the + * widget. Up to 100 items. + * * Google Workspace data: Items are populated using data from Google + * Workspace, such as Google Workspace users or Google Chat spaces. + * * External data: Items are populated from an external data + * source outside of Google Workspace. + * For examples of how to implement multiselect menus, see + * [Add a multiselect + * menu](https://developers.google.com/workspace/chat/design-interactive-card-dialog#multiselect-menu). + * [Google Workspace Add-ons and Chat + * apps](https://developers.google.com/workspace/extend): + * Multiselect for Google Workspace Add-ons are in + * Developer Preview. + * + * Generated from protobuf enum MULTI_SELECT = 4; + */ + const MULTI_SELECT = 4; + + private static $valueToName = [ + self::CHECK_BOX => 'CHECK_BOX', + self::RADIO_BUTTON => 'RADIO_BUTTON', + self::PBSWITCH => 'SWITCH', + self::DROPDOWN => 'DROPDOWN', + self::MULTI_SELECT => 'MULTI_SELECT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Suggestions.php b/AppsChat/src/Card/V1/Suggestions.php new file mode 100644 index 000000000000..7efd8f319cfc --- /dev/null +++ b/AppsChat/src/Card/V1/Suggestions.php @@ -0,0 +1,84 @@ +google.apps.card.v1.Suggestions + */ +class Suggestions extends \Google\Protobuf\Internal\Message +{ + /** + * A list of suggestions used for autocomplete recommendations in text input + * fields. + * + * Generated from protobuf field repeated .google.apps.card.v1.Suggestions.SuggestionItem items = 1; + */ + private $items; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Card\V1\Suggestions\SuggestionItem>|\Google\Protobuf\Internal\RepeatedField $items + * A list of suggestions used for autocomplete recommendations in text input + * fields. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * A list of suggestions used for autocomplete recommendations in text input + * fields. + * + * Generated from protobuf field repeated .google.apps.card.v1.Suggestions.SuggestionItem items = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItems() + { + return $this->items; + } + + /** + * A list of suggestions used for autocomplete recommendations in text input + * fields. + * + * Generated from protobuf field repeated .google.apps.card.v1.Suggestions.SuggestionItem items = 1; + * @param array<\Google\Apps\Card\V1\Suggestions\SuggestionItem>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItems($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Suggestions\SuggestionItem::class); + $this->items = $arr; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Suggestions/SuggestionItem.php b/AppsChat/src/Card/V1/Suggestions/SuggestionItem.php new file mode 100644 index 000000000000..9a60812c03f7 --- /dev/null +++ b/AppsChat/src/Card/V1/Suggestions/SuggestionItem.php @@ -0,0 +1,81 @@ +google.apps.card.v1.Suggestions.SuggestionItem + */ +class SuggestionItem extends \Google\Protobuf\Internal\Message +{ + protected $content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The value of a suggested input to a text input field. This is + * equivalent to what users enter themselves. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The value of a suggested input to a text input field. This is + * equivalent to what users enter themselves. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * The value of a suggested input to a text input field. This is + * equivalent to what users enter themselves. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + return $this->whichOneof("content"); + } + +} + + diff --git a/AppsChat/src/Card/V1/TextInput.php b/AppsChat/src/Card/V1/TextInput.php new file mode 100644 index 000000000000..60c7cfbed1c4 --- /dev/null +++ b/AppsChat/src/Card/V1/TextInput.php @@ -0,0 +1,532 @@ +google.apps.card.v1.TextInput + */ +class TextInput extends \Google\Protobuf\Internal\Message +{ + /** + * The name by which the text input is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The text that appears above the text input field in the user interface. + * Specify text that helps the user enter the information your app needs. + * For example, if you are asking someone's name, but specifically need their + * surname, write `surname` instead of `name`. + * Required if `hintText` is unspecified. Otherwise, optional. + * + * Generated from protobuf field string label = 2; + */ + protected $label = ''; + /** + * Text that appears below the text input field meant to assist users by + * prompting them to enter a certain value. This text is always visible. + * Required if `label` is unspecified. Otherwise, optional. + * + * Generated from protobuf field string hint_text = 3; + */ + protected $hint_text = ''; + /** + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 4; + */ + protected $value = ''; + /** + * How a text input field appears in the user interface. + * For example, whether the field is single or multi-line. + * + * Generated from protobuf field .google.apps.card.v1.TextInput.Type type = 5; + */ + protected $type = 0; + /** + * What to do when a change occurs in the text input field. For example, a + * user adding to the field or deleting text. + * Examples of actions to take include running a custom function or opening + * a [dialog](https://developers.google.com/workspace/chat/dialogs) + * in Google Chat. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 6; + */ + protected $on_change_action = null; + /** + * Suggested values that users can enter. These values appear when users click + * inside the text input field. As users type, the suggested values + * dynamically filter to match what the users have typed. + * For example, a text input field for programming language might suggest + * Java, JavaScript, Python, and C++. When users start typing `Jav`, the list + * of suggestions filters to show just `Java` and `JavaScript`. + * Suggested values help guide users to enter values that your app can make + * sense of. When referring to JavaScript, some users might enter `javascript` + * and others `java script`. Suggesting `JavaScript` can standardize how users + * interact with your app. + * When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set + * to `MULTIPLE_LINE`. + * [Google Workspace + * Add-ons and Chat apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Suggestions initial_suggestions = 7; + */ + protected $initial_suggestions = null; + /** + * Optional. Specify what action to take when the text input field provides + * suggestions to users who interact with it. + * If unspecified, the suggestions are set by `initialSuggestions` and + * are processed by the client. + * If specified, the app takes the action specified here, such as running + * a custom function. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Action auto_complete_action = 8; + */ + protected $auto_complete_action = null; + /** + * Text that appears in the text input field when the field is empty. + * Use this text to prompt users to enter a value. For example, `Enter a + * number from 0 to 100`. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field string placeholder_text = 12; + */ + protected $placeholder_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name by which the text input is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type string $label + * The text that appears above the text input field in the user interface. + * Specify text that helps the user enter the information your app needs. + * For example, if you are asking someone's name, but specifically need their + * surname, write `surname` instead of `name`. + * Required if `hintText` is unspecified. Otherwise, optional. + * @type string $hint_text + * Text that appears below the text input field meant to assist users by + * prompting them to enter a certain value. This text is always visible. + * Required if `label` is unspecified. Otherwise, optional. + * @type string $value + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * @type int $type + * How a text input field appears in the user interface. + * For example, whether the field is single or multi-line. + * @type \Google\Apps\Card\V1\Action $on_change_action + * What to do when a change occurs in the text input field. For example, a + * user adding to the field or deleting text. + * Examples of actions to take include running a custom function or opening + * a [dialog](https://developers.google.com/workspace/chat/dialogs) + * in Google Chat. + * @type \Google\Apps\Card\V1\Suggestions $initial_suggestions + * Suggested values that users can enter. These values appear when users click + * inside the text input field. As users type, the suggested values + * dynamically filter to match what the users have typed. + * For example, a text input field for programming language might suggest + * Java, JavaScript, Python, and C++. When users start typing `Jav`, the list + * of suggestions filters to show just `Java` and `JavaScript`. + * Suggested values help guide users to enter values that your app can make + * sense of. When referring to JavaScript, some users might enter `javascript` + * and others `java script`. Suggesting `JavaScript` can standardize how users + * interact with your app. + * When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set + * to `MULTIPLE_LINE`. + * [Google Workspace + * Add-ons and Chat apps](https://developers.google.com/workspace/extend): + * @type \Google\Apps\Card\V1\Action $auto_complete_action + * Optional. Specify what action to take when the text input field provides + * suggestions to users who interact with it. + * If unspecified, the suggestions are set by `initialSuggestions` and + * are processed by the client. + * If specified, the app takes the action specified here, such as running + * a custom function. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * @type string $placeholder_text + * Text that appears in the text input field when the field is empty. + * Use this text to prompt users to enter a value. For example, `Enter a + * number from 0 to 100`. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The name by which the text input is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name by which the text input is identified in a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The text that appears above the text input field in the user interface. + * Specify text that helps the user enter the information your app needs. + * For example, if you are asking someone's name, but specifically need their + * surname, write `surname` instead of `name`. + * Required if `hintText` is unspecified. Otherwise, optional. + * + * Generated from protobuf field string label = 2; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * The text that appears above the text input field in the user interface. + * Specify text that helps the user enter the information your app needs. + * For example, if you are asking someone's name, but specifically need their + * surname, write `surname` instead of `name`. + * Required if `hintText` is unspecified. Otherwise, optional. + * + * Generated from protobuf field string label = 2; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * Text that appears below the text input field meant to assist users by + * prompting them to enter a certain value. This text is always visible. + * Required if `label` is unspecified. Otherwise, optional. + * + * Generated from protobuf field string hint_text = 3; + * @return string + */ + public function getHintText() + { + return $this->hint_text; + } + + /** + * Text that appears below the text input field meant to assist users by + * prompting them to enter a certain value. This text is always visible. + * Required if `label` is unspecified. Otherwise, optional. + * + * Generated from protobuf field string hint_text = 3; + * @param string $var + * @return $this + */ + public function setHintText($var) + { + GPBUtil::checkString($var, True); + $this->hint_text = $var; + + return $this; + } + + /** + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 4; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value entered by a user, returned as part of a form input event. + * For details about working with form inputs, see [Receive form + * data](https://developers.google.com/workspace/chat/read-form-data). + * + * Generated from protobuf field string value = 4; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * How a text input field appears in the user interface. + * For example, whether the field is single or multi-line. + * + * Generated from protobuf field .google.apps.card.v1.TextInput.Type type = 5; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * How a text input field appears in the user interface. + * For example, whether the field is single or multi-line. + * + * Generated from protobuf field .google.apps.card.v1.TextInput.Type type = 5; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\TextInput\Type::class); + $this->type = $var; + + return $this; + } + + /** + * What to do when a change occurs in the text input field. For example, a + * user adding to the field or deleting text. + * Examples of actions to take include running a custom function or opening + * a [dialog](https://developers.google.com/workspace/chat/dialogs) + * in Google Chat. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 6; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getOnChangeAction() + { + return $this->on_change_action; + } + + public function hasOnChangeAction() + { + return isset($this->on_change_action); + } + + public function clearOnChangeAction() + { + unset($this->on_change_action); + } + + /** + * What to do when a change occurs in the text input field. For example, a + * user adding to the field or deleting text. + * Examples of actions to take include running a custom function or opening + * a [dialog](https://developers.google.com/workspace/chat/dialogs) + * in Google Chat. + * + * Generated from protobuf field .google.apps.card.v1.Action on_change_action = 6; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setOnChangeAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->on_change_action = $var; + + return $this; + } + + /** + * Suggested values that users can enter. These values appear when users click + * inside the text input field. As users type, the suggested values + * dynamically filter to match what the users have typed. + * For example, a text input field for programming language might suggest + * Java, JavaScript, Python, and C++. When users start typing `Jav`, the list + * of suggestions filters to show just `Java` and `JavaScript`. + * Suggested values help guide users to enter values that your app can make + * sense of. When referring to JavaScript, some users might enter `javascript` + * and others `java script`. Suggesting `JavaScript` can standardize how users + * interact with your app. + * When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set + * to `MULTIPLE_LINE`. + * [Google Workspace + * Add-ons and Chat apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Suggestions initial_suggestions = 7; + * @return \Google\Apps\Card\V1\Suggestions|null + */ + public function getInitialSuggestions() + { + return $this->initial_suggestions; + } + + public function hasInitialSuggestions() + { + return isset($this->initial_suggestions); + } + + public function clearInitialSuggestions() + { + unset($this->initial_suggestions); + } + + /** + * Suggested values that users can enter. These values appear when users click + * inside the text input field. As users type, the suggested values + * dynamically filter to match what the users have typed. + * For example, a text input field for programming language might suggest + * Java, JavaScript, Python, and C++. When users start typing `Jav`, the list + * of suggestions filters to show just `Java` and `JavaScript`. + * Suggested values help guide users to enter values that your app can make + * sense of. When referring to JavaScript, some users might enter `javascript` + * and others `java script`. Suggesting `JavaScript` can standardize how users + * interact with your app. + * When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set + * to `MULTIPLE_LINE`. + * [Google Workspace + * Add-ons and Chat apps](https://developers.google.com/workspace/extend): + * + * Generated from protobuf field .google.apps.card.v1.Suggestions initial_suggestions = 7; + * @param \Google\Apps\Card\V1\Suggestions $var + * @return $this + */ + public function setInitialSuggestions($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Suggestions::class); + $this->initial_suggestions = $var; + + return $this; + } + + /** + * Optional. Specify what action to take when the text input field provides + * suggestions to users who interact with it. + * If unspecified, the suggestions are set by `initialSuggestions` and + * are processed by the client. + * If specified, the app takes the action specified here, such as running + * a custom function. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Action auto_complete_action = 8; + * @return \Google\Apps\Card\V1\Action|null + */ + public function getAutoCompleteAction() + { + return $this->auto_complete_action; + } + + public function hasAutoCompleteAction() + { + return isset($this->auto_complete_action); + } + + public function clearAutoCompleteAction() + { + unset($this->auto_complete_action); + } + + /** + * Optional. Specify what action to take when the text input field provides + * suggestions to users who interact with it. + * If unspecified, the suggestions are set by `initialSuggestions` and + * are processed by the client. + * If specified, the app takes the action specified here, such as running + * a custom function. + * [Google Workspace + * Add-ons](https://developers.google.com/workspace/add-ons): + * + * Generated from protobuf field .google.apps.card.v1.Action auto_complete_action = 8; + * @param \Google\Apps\Card\V1\Action $var + * @return $this + */ + public function setAutoCompleteAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Action::class); + $this->auto_complete_action = $var; + + return $this; + } + + /** + * Text that appears in the text input field when the field is empty. + * Use this text to prompt users to enter a value. For example, `Enter a + * number from 0 to 100`. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field string placeholder_text = 12; + * @return string + */ + public function getPlaceholderText() + { + return $this->placeholder_text; + } + + /** + * Text that appears in the text input field when the field is empty. + * Use this text to prompt users to enter a value. For example, `Enter a + * number from 0 to 100`. + * [Google Chat apps](https://developers.google.com/workspace/chat): + * + * Generated from protobuf field string placeholder_text = 12; + * @param string $var + * @return $this + */ + public function setPlaceholderText($var) + { + GPBUtil::checkString($var, True); + $this->placeholder_text = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/TextInput/Type.php b/AppsChat/src/Card/V1/TextInput/Type.php new file mode 100644 index 000000000000..edb779e74918 --- /dev/null +++ b/AppsChat/src/Card/V1/TextInput/Type.php @@ -0,0 +1,60 @@ +google.apps.card.v1.TextInput.Type + */ +class Type +{ + /** + * The text input field has a fixed height of one line. + * + * Generated from protobuf enum SINGLE_LINE = 0; + */ + const SINGLE_LINE = 0; + /** + * The text input field has a fixed height of multiple lines. + * + * Generated from protobuf enum MULTIPLE_LINE = 1; + */ + const MULTIPLE_LINE = 1; + + private static $valueToName = [ + self::SINGLE_LINE => 'SINGLE_LINE', + self::MULTIPLE_LINE => 'MULTIPLE_LINE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/TextParagraph.php b/AppsChat/src/Card/V1/TextParagraph.php new file mode 100644 index 000000000000..029cb54e8a3c --- /dev/null +++ b/AppsChat/src/Card/V1/TextParagraph.php @@ -0,0 +1,79 @@ +google.apps.card.v1.TextParagraph + */ +class TextParagraph extends \Google\Protobuf\Internal\Message +{ + /** + * The text that's shown in the widget. + * + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The text that's shown in the widget. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * The text that's shown in the widget. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The text that's shown in the widget. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Card/V1/Widget.php b/AppsChat/src/Card/V1/Widget.php new file mode 100644 index 000000000000..9299d133d355 --- /dev/null +++ b/AppsChat/src/Card/V1/Widget.php @@ -0,0 +1,1062 @@ +google.apps.card.v1.Widget + */ +class Widget extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies whether widgets align to the left, right, or center of a column. + * + * Generated from protobuf field .google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 8; + */ + protected $horizontal_alignment = 0; + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\TextParagraph $text_paragraph + * Displays a text paragraph. Supports simple HTML formatted text. For more + * information about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * For example, the following JSON creates a bolded text: + * ``` + * "textParagraph": { + * "text": " bold text" + * } + * ``` + * @type \Google\Apps\Card\V1\Image $image + * Displays an image. + * For example, the following JSON creates an image with alternative text: + * ``` + * "image": { + * "imageUrl": + * "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png", + * "altText": "Chat app avatar" + * } + * ``` + * @type \Google\Apps\Card\V1\DecoratedText $decorated_text + * Displays a decorated text item. + * For example, the following JSON creates a decorated text widget showing + * email address: + * ``` + * "decoratedText": { + * "icon": { + * "knownIcon": "EMAIL" + * }, + * "topLabel": "Email Address", + * "text": "sasha@example.com", + * "bottomLabel": "This is a new Email address!", + * "switchControl": { + * "name": "has_send_welcome_email_to_sasha", + * "selected": false, + * "controlType": "CHECKBOX" + * } + * } + * ``` + * @type \Google\Apps\Card\V1\ButtonList $button_list + * A list of buttons. + * For example, the following JSON creates two buttons. The first + * is a blue text button and the second is an image button that opens a + * link: + * ``` + * "buttonList": { + * "buttons": [ + * { + * "text": "Edit", + * "color": { + * "red": 0, + * "green": 0, + * "blue": 1, + * "alpha": 1 + * }, + * "disabled": true, + * }, + * { + * "icon": { + * "knownIcon": "INVITE", + * "altText": "check calendar" + * }, + * "onClick": { + * "openLink": { + * "url": "https://example.com/calendar" + * } + * } + * } + * ] + * } + * ``` + * @type \Google\Apps\Card\V1\TextInput $text_input + * Displays a text box that users can type into. + * For example, the following JSON creates a text input for an email + * address: + * ``` + * "textInput": { + * "name": "mailing_address", + * "label": "Mailing Address" + * } + * ``` + * As another example, the following JSON creates a text input for a + * programming language with static suggestions: + * ``` + * "textInput": { + * "name": "preferred_programing_language", + * "label": "Preferred Language", + * "initialSuggestions": { + * "items": [ + * { + * "text": "C++" + * }, + * { + * "text": "Java" + * }, + * { + * "text": "JavaScript" + * }, + * { + * "text": "Python" + * } + * ] + * } + * } + * ``` + * @type \Google\Apps\Card\V1\SelectionInput $selection_input + * Displays a selection control that lets users select items. Selection + * controls can be checkboxes, radio buttons, switches, or dropdown menus. + * For example, the following JSON creates a dropdown menu that lets users + * choose a size: + * ``` + * "selectionInput": { + * "name": "size", + * "label": "Size" + * "type": "DROPDOWN", + * "items": [ + * { + * "text": "S", + * "value": "small", + * "selected": false + * }, + * { + * "text": "M", + * "value": "medium", + * "selected": true + * }, + * { + * "text": "L", + * "value": "large", + * "selected": false + * }, + * { + * "text": "XL", + * "value": "extra_large", + * "selected": false + * } + * ] + * } + * ``` + * @type \Google\Apps\Card\V1\DateTimePicker $date_time_picker + * Displays a widget that lets users input a date, time, or date and time. + * For example, the following JSON creates a date time picker to schedule an + * appointment: + * ``` + * "dateTimePicker": { + * "name": "appointment_time", + * "label": "Book your appointment at:", + * "type": "DATE_AND_TIME", + * "valueMsEpoch": "796435200000" + * } + * ``` + * @type \Google\Apps\Card\V1\Divider $divider + * Displays a horizontal line divider between widgets. + * For example, the following JSON creates a divider: + * ``` + * "divider": { + * } + * ``` + * @type \Google\Apps\Card\V1\Grid $grid + * Displays a grid with a collection of items. + * A grid supports any number of columns and items. The number of rows is + * determined by the upper bounds of the number items divided by the number + * of columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 + * items and 2 columns has 6 rows. + * [Google Workspace Add-ons and + * Chat apps](https://developers.google.com/workspace/extend): + * For example, the following JSON creates a 2 column grid with a single + * item: + * ``` + * "grid": { + * "title": "A fine collection of items", + * "columnCount": 2, + * "borderStyle": { + * "type": "STROKE", + * "cornerRadius": 4 + * }, + * "items": [ + * { + * "image": { + * "imageUri": "https://www.example.com/image.png", + * "cropStyle": { + * "type": "SQUARE" + * }, + * "borderStyle": { + * "type": "STROKE" + * } + * }, + * "title": "An item", + * "textAlignment": "CENTER" + * } + * ], + * "onClick": { + * "openLink": { + * "url": "https://www.example.com" + * } + * } + * } + * ``` + * @type \Google\Apps\Card\V1\Columns $columns + * Displays up to 2 columns. + * To include more than 2 columns, or to use rows, use the `Grid` widget. + * For example, the following JSON creates 2 columns that each contain + * text paragraphs: + * ``` + * "columns": { + * "columnItems": [ + * { + * "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", + * "horizontalAlignment": "CENTER", + * "verticalAlignment": "CENTER", + * "widgets": [ + * { + * "textParagraph": { + * "text": "First column text paragraph" + * } + * } + * ] + * }, + * { + * "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", + * "horizontalAlignment": "CENTER", + * "verticalAlignment": "CENTER", + * "widgets": [ + * { + * "textParagraph": { + * "text": "Second column text paragraph" + * } + * } + * ] + * } + * ] + * } + * ``` + * @type int $horizontal_alignment + * Specifies whether widgets align to the left, right, or center of a column. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Card\V1\Card::initOnce(); + parent::__construct($data); + } + + /** + * Displays a text paragraph. Supports simple HTML formatted text. For more + * information about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * For example, the following JSON creates a bolded text: + * ``` + * "textParagraph": { + * "text": " bold text" + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.TextParagraph text_paragraph = 1; + * @return \Google\Apps\Card\V1\TextParagraph|null + */ + public function getTextParagraph() + { + return $this->readOneof(1); + } + + public function hasTextParagraph() + { + return $this->hasOneof(1); + } + + /** + * Displays a text paragraph. Supports simple HTML formatted text. For more + * information about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * For example, the following JSON creates a bolded text: + * ``` + * "textParagraph": { + * "text": " bold text" + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.TextParagraph text_paragraph = 1; + * @param \Google\Apps\Card\V1\TextParagraph $var + * @return $this + */ + public function setTextParagraph($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\TextParagraph::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Displays an image. + * For example, the following JSON creates an image with alternative text: + * ``` + * "image": { + * "imageUrl": + * "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png", + * "altText": "Chat app avatar" + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Image image = 2; + * @return \Google\Apps\Card\V1\Image|null + */ + public function getImage() + { + return $this->readOneof(2); + } + + public function hasImage() + { + return $this->hasOneof(2); + } + + /** + * Displays an image. + * For example, the following JSON creates an image with alternative text: + * ``` + * "image": { + * "imageUrl": + * "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png", + * "altText": "Chat app avatar" + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Image image = 2; + * @param \Google\Apps\Card\V1\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Image::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Displays a decorated text item. + * For example, the following JSON creates a decorated text widget showing + * email address: + * ``` + * "decoratedText": { + * "icon": { + * "knownIcon": "EMAIL" + * }, + * "topLabel": "Email Address", + * "text": "sasha@example.com", + * "bottomLabel": "This is a new Email address!", + * "switchControl": { + * "name": "has_send_welcome_email_to_sasha", + * "selected": false, + * "controlType": "CHECKBOX" + * } + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText decorated_text = 3; + * @return \Google\Apps\Card\V1\DecoratedText|null + */ + public function getDecoratedText() + { + return $this->readOneof(3); + } + + public function hasDecoratedText() + { + return $this->hasOneof(3); + } + + /** + * Displays a decorated text item. + * For example, the following JSON creates a decorated text widget showing + * email address: + * ``` + * "decoratedText": { + * "icon": { + * "knownIcon": "EMAIL" + * }, + * "topLabel": "Email Address", + * "text": "sasha@example.com", + * "bottomLabel": "This is a new Email address!", + * "switchControl": { + * "name": "has_send_welcome_email_to_sasha", + * "selected": false, + * "controlType": "CHECKBOX" + * } + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.DecoratedText decorated_text = 3; + * @param \Google\Apps\Card\V1\DecoratedText $var + * @return $this + */ + public function setDecoratedText($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\DecoratedText::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * A list of buttons. + * For example, the following JSON creates two buttons. The first + * is a blue text button and the second is an image button that opens a + * link: + * ``` + * "buttonList": { + * "buttons": [ + * { + * "text": "Edit", + * "color": { + * "red": 0, + * "green": 0, + * "blue": 1, + * "alpha": 1 + * }, + * "disabled": true, + * }, + * { + * "icon": { + * "knownIcon": "INVITE", + * "altText": "check calendar" + * }, + * "onClick": { + * "openLink": { + * "url": "https://example.com/calendar" + * } + * } + * } + * ] + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.ButtonList button_list = 4; + * @return \Google\Apps\Card\V1\ButtonList|null + */ + public function getButtonList() + { + return $this->readOneof(4); + } + + public function hasButtonList() + { + return $this->hasOneof(4); + } + + /** + * A list of buttons. + * For example, the following JSON creates two buttons. The first + * is a blue text button and the second is an image button that opens a + * link: + * ``` + * "buttonList": { + * "buttons": [ + * { + * "text": "Edit", + * "color": { + * "red": 0, + * "green": 0, + * "blue": 1, + * "alpha": 1 + * }, + * "disabled": true, + * }, + * { + * "icon": { + * "knownIcon": "INVITE", + * "altText": "check calendar" + * }, + * "onClick": { + * "openLink": { + * "url": "https://example.com/calendar" + * } + * } + * } + * ] + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.ButtonList button_list = 4; + * @param \Google\Apps\Card\V1\ButtonList $var + * @return $this + */ + public function setButtonList($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\ButtonList::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Displays a text box that users can type into. + * For example, the following JSON creates a text input for an email + * address: + * ``` + * "textInput": { + * "name": "mailing_address", + * "label": "Mailing Address" + * } + * ``` + * As another example, the following JSON creates a text input for a + * programming language with static suggestions: + * ``` + * "textInput": { + * "name": "preferred_programing_language", + * "label": "Preferred Language", + * "initialSuggestions": { + * "items": [ + * { + * "text": "C++" + * }, + * { + * "text": "Java" + * }, + * { + * "text": "JavaScript" + * }, + * { + * "text": "Python" + * } + * ] + * } + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.TextInput text_input = 5; + * @return \Google\Apps\Card\V1\TextInput|null + */ + public function getTextInput() + { + return $this->readOneof(5); + } + + public function hasTextInput() + { + return $this->hasOneof(5); + } + + /** + * Displays a text box that users can type into. + * For example, the following JSON creates a text input for an email + * address: + * ``` + * "textInput": { + * "name": "mailing_address", + * "label": "Mailing Address" + * } + * ``` + * As another example, the following JSON creates a text input for a + * programming language with static suggestions: + * ``` + * "textInput": { + * "name": "preferred_programing_language", + * "label": "Preferred Language", + * "initialSuggestions": { + * "items": [ + * { + * "text": "C++" + * }, + * { + * "text": "Java" + * }, + * { + * "text": "JavaScript" + * }, + * { + * "text": "Python" + * } + * ] + * } + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.TextInput text_input = 5; + * @param \Google\Apps\Card\V1\TextInput $var + * @return $this + */ + public function setTextInput($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\TextInput::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Displays a selection control that lets users select items. Selection + * controls can be checkboxes, radio buttons, switches, or dropdown menus. + * For example, the following JSON creates a dropdown menu that lets users + * choose a size: + * ``` + * "selectionInput": { + * "name": "size", + * "label": "Size" + * "type": "DROPDOWN", + * "items": [ + * { + * "text": "S", + * "value": "small", + * "selected": false + * }, + * { + * "text": "M", + * "value": "medium", + * "selected": true + * }, + * { + * "text": "L", + * "value": "large", + * "selected": false + * }, + * { + * "text": "XL", + * "value": "extra_large", + * "selected": false + * } + * ] + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput selection_input = 6; + * @return \Google\Apps\Card\V1\SelectionInput|null + */ + public function getSelectionInput() + { + return $this->readOneof(6); + } + + public function hasSelectionInput() + { + return $this->hasOneof(6); + } + + /** + * Displays a selection control that lets users select items. Selection + * controls can be checkboxes, radio buttons, switches, or dropdown menus. + * For example, the following JSON creates a dropdown menu that lets users + * choose a size: + * ``` + * "selectionInput": { + * "name": "size", + * "label": "Size" + * "type": "DROPDOWN", + * "items": [ + * { + * "text": "S", + * "value": "small", + * "selected": false + * }, + * { + * "text": "M", + * "value": "medium", + * "selected": true + * }, + * { + * "text": "L", + * "value": "large", + * "selected": false + * }, + * { + * "text": "XL", + * "value": "extra_large", + * "selected": false + * } + * ] + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.SelectionInput selection_input = 6; + * @param \Google\Apps\Card\V1\SelectionInput $var + * @return $this + */ + public function setSelectionInput($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\SelectionInput::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Displays a widget that lets users input a date, time, or date and time. + * For example, the following JSON creates a date time picker to schedule an + * appointment: + * ``` + * "dateTimePicker": { + * "name": "appointment_time", + * "label": "Book your appointment at:", + * "type": "DATE_AND_TIME", + * "valueMsEpoch": "796435200000" + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker date_time_picker = 7; + * @return \Google\Apps\Card\V1\DateTimePicker|null + */ + public function getDateTimePicker() + { + return $this->readOneof(7); + } + + public function hasDateTimePicker() + { + return $this->hasOneof(7); + } + + /** + * Displays a widget that lets users input a date, time, or date and time. + * For example, the following JSON creates a date time picker to schedule an + * appointment: + * ``` + * "dateTimePicker": { + * "name": "appointment_time", + * "label": "Book your appointment at:", + * "type": "DATE_AND_TIME", + * "valueMsEpoch": "796435200000" + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.DateTimePicker date_time_picker = 7; + * @param \Google\Apps\Card\V1\DateTimePicker $var + * @return $this + */ + public function setDateTimePicker($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\DateTimePicker::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Displays a horizontal line divider between widgets. + * For example, the following JSON creates a divider: + * ``` + * "divider": { + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Divider divider = 9; + * @return \Google\Apps\Card\V1\Divider|null + */ + public function getDivider() + { + return $this->readOneof(9); + } + + public function hasDivider() + { + return $this->hasOneof(9); + } + + /** + * Displays a horizontal line divider between widgets. + * For example, the following JSON creates a divider: + * ``` + * "divider": { + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Divider divider = 9; + * @param \Google\Apps\Card\V1\Divider $var + * @return $this + */ + public function setDivider($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Divider::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Displays a grid with a collection of items. + * A grid supports any number of columns and items. The number of rows is + * determined by the upper bounds of the number items divided by the number + * of columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 + * items and 2 columns has 6 rows. + * [Google Workspace Add-ons and + * Chat apps](https://developers.google.com/workspace/extend): + * For example, the following JSON creates a 2 column grid with a single + * item: + * ``` + * "grid": { + * "title": "A fine collection of items", + * "columnCount": 2, + * "borderStyle": { + * "type": "STROKE", + * "cornerRadius": 4 + * }, + * "items": [ + * { + * "image": { + * "imageUri": "https://www.example.com/image.png", + * "cropStyle": { + * "type": "SQUARE" + * }, + * "borderStyle": { + * "type": "STROKE" + * } + * }, + * "title": "An item", + * "textAlignment": "CENTER" + * } + * ], + * "onClick": { + * "openLink": { + * "url": "https://www.example.com" + * } + * } + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Grid grid = 10; + * @return \Google\Apps\Card\V1\Grid|null + */ + public function getGrid() + { + return $this->readOneof(10); + } + + public function hasGrid() + { + return $this->hasOneof(10); + } + + /** + * Displays a grid with a collection of items. + * A grid supports any number of columns and items. The number of rows is + * determined by the upper bounds of the number items divided by the number + * of columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 + * items and 2 columns has 6 rows. + * [Google Workspace Add-ons and + * Chat apps](https://developers.google.com/workspace/extend): + * For example, the following JSON creates a 2 column grid with a single + * item: + * ``` + * "grid": { + * "title": "A fine collection of items", + * "columnCount": 2, + * "borderStyle": { + * "type": "STROKE", + * "cornerRadius": 4 + * }, + * "items": [ + * { + * "image": { + * "imageUri": "https://www.example.com/image.png", + * "cropStyle": { + * "type": "SQUARE" + * }, + * "borderStyle": { + * "type": "STROKE" + * } + * }, + * "title": "An item", + * "textAlignment": "CENTER" + * } + * ], + * "onClick": { + * "openLink": { + * "url": "https://www.example.com" + * } + * } + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Grid grid = 10; + * @param \Google\Apps\Card\V1\Grid $var + * @return $this + */ + public function setGrid($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Grid::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Displays up to 2 columns. + * To include more than 2 columns, or to use rows, use the `Grid` widget. + * For example, the following JSON creates 2 columns that each contain + * text paragraphs: + * ``` + * "columns": { + * "columnItems": [ + * { + * "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", + * "horizontalAlignment": "CENTER", + * "verticalAlignment": "CENTER", + * "widgets": [ + * { + * "textParagraph": { + * "text": "First column text paragraph" + * } + * } + * ] + * }, + * { + * "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", + * "horizontalAlignment": "CENTER", + * "verticalAlignment": "CENTER", + * "widgets": [ + * { + * "textParagraph": { + * "text": "Second column text paragraph" + * } + * } + * ] + * } + * ] + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Columns columns = 11; + * @return \Google\Apps\Card\V1\Columns|null + */ + public function getColumns() + { + return $this->readOneof(11); + } + + public function hasColumns() + { + return $this->hasOneof(11); + } + + /** + * Displays up to 2 columns. + * To include more than 2 columns, or to use rows, use the `Grid` widget. + * For example, the following JSON creates 2 columns that each contain + * text paragraphs: + * ``` + * "columns": { + * "columnItems": [ + * { + * "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", + * "horizontalAlignment": "CENTER", + * "verticalAlignment": "CENTER", + * "widgets": [ + * { + * "textParagraph": { + * "text": "First column text paragraph" + * } + * } + * ] + * }, + * { + * "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", + * "horizontalAlignment": "CENTER", + * "verticalAlignment": "CENTER", + * "widgets": [ + * { + * "textParagraph": { + * "text": "Second column text paragraph" + * } + * } + * ] + * } + * ] + * } + * ``` + * + * Generated from protobuf field .google.apps.card.v1.Columns columns = 11; + * @param \Google\Apps\Card\V1\Columns $var + * @return $this + */ + public function setColumns($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Columns::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Specifies whether widgets align to the left, right, or center of a column. + * + * Generated from protobuf field .google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 8; + * @return int + */ + public function getHorizontalAlignment() + { + return $this->horizontal_alignment; + } + + /** + * Specifies whether widgets align to the left, right, or center of a column. + * + * Generated from protobuf field .google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 8; + * @param int $var + * @return $this + */ + public function setHorizontalAlignment($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Card\V1\Widget\HorizontalAlignment::class); + $this->horizontal_alignment = $var; + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + diff --git a/AppsChat/src/Card/V1/Widget/HorizontalAlignment.php b/AppsChat/src/Card/V1/Widget/HorizontalAlignment.php new file mode 100644 index 000000000000..671c6ea5cf14 --- /dev/null +++ b/AppsChat/src/Card/V1/Widget/HorizontalAlignment.php @@ -0,0 +1,74 @@ +google.apps.card.v1.Widget.HorizontalAlignment + */ +class HorizontalAlignment +{ + /** + * Don't use. Unspecified. + * + * Generated from protobuf enum HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; + */ + const HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; + /** + * Default value. Aligns widgets to the start position of the column. For + * left-to-right layouts, aligns to the left. For right-to-left layouts, + * aligns to the right. + * + * Generated from protobuf enum START = 1; + */ + const START = 1; + /** + * Aligns widgets to the center of the column. + * + * Generated from protobuf enum CENTER = 2; + */ + const CENTER = 2; + /** + * Aligns widgets to the end position of the column. For left-to-right + * layouts, aligns widgets to the right. For right-to-left layouts, aligns + * widgets to the left. + * + * Generated from protobuf enum END = 3; + */ + const END = 3; + + private static $valueToName = [ + self::HORIZONTAL_ALIGNMENT_UNSPECIFIED => 'HORIZONTAL_ALIGNMENT_UNSPECIFIED', + self::START => 'START', + self::CENTER => 'CENTER', + self::END => 'END', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Card/V1/Widget/ImageType.php b/AppsChat/src/Card/V1/Widget/ImageType.php new file mode 100644 index 000000000000..6f928738546a --- /dev/null +++ b/AppsChat/src/Card/V1/Widget/ImageType.php @@ -0,0 +1,59 @@ +google.apps.card.v1.Widget.ImageType + */ +class ImageType +{ + /** + * Default value. Applies a square mask to the image. For example, a 4x3 + * image becomes 3x3. + * + * Generated from protobuf enum SQUARE = 0; + */ + const SQUARE = 0; + /** + * Applies a circular mask to the image. For example, a 4x3 image becomes a + * circle with a diameter of 3. + * + * Generated from protobuf enum CIRCLE = 1; + */ + const CIRCLE = 1; + + private static $valueToName = [ + self::SQUARE => 'SQUARE', + self::CIRCLE => 'CIRCLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/AccessoryWidget.php b/AppsChat/src/Chat/V1/AccessoryWidget.php new file mode 100644 index 000000000000..f752a3ac9111 --- /dev/null +++ b/AppsChat/src/Chat/V1/AccessoryWidget.php @@ -0,0 +1,77 @@ +google.chat.v1.AccessoryWidget + */ +class AccessoryWidget extends \Google\Protobuf\Internal\Message +{ + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\ButtonList $button_list + * A list of buttons. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * A list of buttons. + * + * Generated from protobuf field .google.apps.card.v1.ButtonList button_list = 1; + * @return \Google\Apps\Card\V1\ButtonList|null + */ + public function getButtonList() + { + return $this->readOneof(1); + } + + public function hasButtonList() + { + return $this->hasOneof(1); + } + + /** + * A list of buttons. + * + * Generated from protobuf field .google.apps.card.v1.ButtonList button_list = 1; + * @param \Google\Apps\Card\V1\ButtonList $var + * @return $this + */ + public function setButtonList($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\ButtonList::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/AppsChat/src/Chat/V1/ActionResponse.php b/AppsChat/src/Chat/V1/ActionResponse.php new file mode 100644 index 000000000000..ab29fb67f3d4 --- /dev/null +++ b/AppsChat/src/Chat/V1/ActionResponse.php @@ -0,0 +1,201 @@ +google.chat.v1.ActionResponse + */ +class ActionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Input only. The type of Chat app response. + * + * Generated from protobuf field .google.chat.v1.ActionResponse.ResponseType type = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $type = 0; + /** + * Input only. URL for users to authenticate or configure. (Only for + * `REQUEST_CONFIG` response types.) + * + * Generated from protobuf field string url = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $url = ''; + /** + * Input only. A response to an interaction event related to a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Must be + * accompanied by `ResponseType.Dialog`. + * + * Generated from protobuf field .google.chat.v1.DialogAction dialog_action = 3 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $dialog_action = null; + /** + * Input only. The response of the updated widget. + * + * Generated from protobuf field .google.chat.v1.ActionResponse.UpdatedWidget updated_widget = 4 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $updated_widget = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Input only. The type of Chat app response. + * @type string $url + * Input only. URL for users to authenticate or configure. (Only for + * `REQUEST_CONFIG` response types.) + * @type \Google\Apps\Chat\V1\DialogAction $dialog_action + * Input only. A response to an interaction event related to a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Must be + * accompanied by `ResponseType.Dialog`. + * @type \Google\Apps\Chat\V1\ActionResponse\UpdatedWidget $updated_widget + * Input only. The response of the updated widget. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Input only. The type of Chat app response. + * + * Generated from protobuf field .google.chat.v1.ActionResponse.ResponseType type = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Input only. The type of Chat app response. + * + * Generated from protobuf field .google.chat.v1.ActionResponse.ResponseType type = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\ActionResponse\ResponseType::class); + $this->type = $var; + + return $this; + } + + /** + * Input only. URL for users to authenticate or configure. (Only for + * `REQUEST_CONFIG` response types.) + * + * Generated from protobuf field string url = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Input only. URL for users to authenticate or configure. (Only for + * `REQUEST_CONFIG` response types.) + * + * Generated from protobuf field string url = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Input only. A response to an interaction event related to a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Must be + * accompanied by `ResponseType.Dialog`. + * + * Generated from protobuf field .google.chat.v1.DialogAction dialog_action = 3 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Apps\Chat\V1\DialogAction|null + */ + public function getDialogAction() + { + return $this->dialog_action; + } + + public function hasDialogAction() + { + return isset($this->dialog_action); + } + + public function clearDialogAction() + { + unset($this->dialog_action); + } + + /** + * Input only. A response to an interaction event related to a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Must be + * accompanied by `ResponseType.Dialog`. + * + * Generated from protobuf field .google.chat.v1.DialogAction dialog_action = 3 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Apps\Chat\V1\DialogAction $var + * @return $this + */ + public function setDialogAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\DialogAction::class); + $this->dialog_action = $var; + + return $this; + } + + /** + * Input only. The response of the updated widget. + * + * Generated from protobuf field .google.chat.v1.ActionResponse.UpdatedWidget updated_widget = 4 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Apps\Chat\V1\ActionResponse\UpdatedWidget|null + */ + public function getUpdatedWidget() + { + return $this->updated_widget; + } + + public function hasUpdatedWidget() + { + return isset($this->updated_widget); + } + + public function clearUpdatedWidget() + { + unset($this->updated_widget); + } + + /** + * Input only. The response of the updated widget. + * + * Generated from protobuf field .google.chat.v1.ActionResponse.UpdatedWidget updated_widget = 4 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Apps\Chat\V1\ActionResponse\UpdatedWidget $var + * @return $this + */ + public function setUpdatedWidget($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\ActionResponse\UpdatedWidget::class); + $this->updated_widget = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ActionResponse/ResponseType.php b/AppsChat/src/Chat/V1/ActionResponse/ResponseType.php new file mode 100644 index 000000000000..0388bcef37bb --- /dev/null +++ b/AppsChat/src/Chat/V1/ActionResponse/ResponseType.php @@ -0,0 +1,94 @@ +google.chat.v1.ActionResponse.ResponseType + */ +class ResponseType +{ + /** + * Default type that's handled as `NEW_MESSAGE`. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Post as a new message in the topic. + * + * Generated from protobuf enum NEW_MESSAGE = 1; + */ + const NEW_MESSAGE = 1; + /** + * Update the Chat app's message. This is only permitted on a `CARD_CLICKED` + * event where the message sender type is `BOT`. + * + * Generated from protobuf enum UPDATE_MESSAGE = 2; + */ + const UPDATE_MESSAGE = 2; + /** + * Update the cards on a user's message. This is only permitted as a + * response to a `MESSAGE` event with a matched url, or a `CARD_CLICKED` + * event where the message sender type is `HUMAN`. Text is ignored. + * + * Generated from protobuf enum UPDATE_USER_MESSAGE_CARDS = 6; + */ + const UPDATE_USER_MESSAGE_CARDS = 6; + /** + * Privately ask the user for additional authentication or configuration. + * + * Generated from protobuf enum REQUEST_CONFIG = 3; + */ + const REQUEST_CONFIG = 3; + /** + * Presents a + * [dialog](https://developers.google.com/workspace/chat/dialogs). + * + * Generated from protobuf enum DIALOG = 4; + */ + const DIALOG = 4; + /** + * Widget text autocomplete options query. + * + * Generated from protobuf enum UPDATE_WIDGET = 7; + */ + const UPDATE_WIDGET = 7; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::NEW_MESSAGE => 'NEW_MESSAGE', + self::UPDATE_MESSAGE => 'UPDATE_MESSAGE', + self::UPDATE_USER_MESSAGE_CARDS => 'UPDATE_USER_MESSAGE_CARDS', + self::REQUEST_CONFIG => 'REQUEST_CONFIG', + self::DIALOG => 'DIALOG', + self::UPDATE_WIDGET => 'UPDATE_WIDGET', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/ActionResponse/SelectionItems.php b/AppsChat/src/Chat/V1/ActionResponse/SelectionItems.php new file mode 100644 index 000000000000..990c69dce3d1 --- /dev/null +++ b/AppsChat/src/Chat/V1/ActionResponse/SelectionItems.php @@ -0,0 +1,68 @@ +google.chat.v1.ActionResponse.SelectionItems + */ +class SelectionItems extends \Google\Protobuf\Internal\Message +{ + /** + * An array of the SelectionItem objects. + * + * Generated from protobuf field repeated .google.apps.card.v1.SelectionInput.SelectionItem items = 1; + */ + private $items; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Card\V1\SelectionInput\SelectionItem>|\Google\Protobuf\Internal\RepeatedField $items + * An array of the SelectionItem objects. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * An array of the SelectionItem objects. + * + * Generated from protobuf field repeated .google.apps.card.v1.SelectionInput.SelectionItem items = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItems() + { + return $this->items; + } + + /** + * An array of the SelectionItem objects. + * + * Generated from protobuf field repeated .google.apps.card.v1.SelectionInput.SelectionItem items = 1; + * @param array<\Google\Apps\Card\V1\SelectionInput\SelectionItem>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItems($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\SelectionInput\SelectionItem::class); + $this->items = $arr; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/ActionResponse/UpdatedWidget.php b/AppsChat/src/Chat/V1/ActionResponse/UpdatedWidget.php new file mode 100644 index 000000000000..0d8dd3bb27ef --- /dev/null +++ b/AppsChat/src/Chat/V1/ActionResponse/UpdatedWidget.php @@ -0,0 +1,115 @@ +google.chat.v1.ActionResponse.UpdatedWidget + */ +class UpdatedWidget extends \Google\Protobuf\Internal\Message +{ + /** + * The ID of the updated widget. The ID must match the one for the + * widget that triggered the update request. + * + * Generated from protobuf field string widget = 2; + */ + protected $widget = ''; + protected $updated_widget; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\ActionResponse\SelectionItems $suggestions + * List of widget autocomplete results + * @type string $widget + * The ID of the updated widget. The ID must match the one for the + * widget that triggered the update request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * List of widget autocomplete results + * + * Generated from protobuf field .google.chat.v1.ActionResponse.SelectionItems suggestions = 1; + * @return \Google\Apps\Chat\V1\ActionResponse\SelectionItems|null + */ + public function getSuggestions() + { + return $this->readOneof(1); + } + + public function hasSuggestions() + { + return $this->hasOneof(1); + } + + /** + * List of widget autocomplete results + * + * Generated from protobuf field .google.chat.v1.ActionResponse.SelectionItems suggestions = 1; + * @param \Google\Apps\Chat\V1\ActionResponse\SelectionItems $var + * @return $this + */ + public function setSuggestions($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\ActionResponse\SelectionItems::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The ID of the updated widget. The ID must match the one for the + * widget that triggered the update request. + * + * Generated from protobuf field string widget = 2; + * @return string + */ + public function getWidget() + { + return $this->widget; + } + + /** + * The ID of the updated widget. The ID must match the one for the + * widget that triggered the update request. + * + * Generated from protobuf field string widget = 2; + * @param string $var + * @return $this + */ + public function setWidget($var) + { + GPBUtil::checkString($var, True); + $this->widget = $var; + + return $this; + } + + /** + * @return string + */ + public function getUpdatedWidget() + { + return $this->whichOneof("updated_widget"); + } + +} + + diff --git a/AppsChat/src/Chat/V1/ActionStatus.php b/AppsChat/src/Chat/V1/ActionStatus.php new file mode 100644 index 000000000000..687ef00ac63c --- /dev/null +++ b/AppsChat/src/Chat/V1/ActionStatus.php @@ -0,0 +1,106 @@ +google.chat.v1.ActionStatus + */ +class ActionStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The status code. + * + * Generated from protobuf field .google.rpc.Code status_code = 1; + */ + protected $status_code = 0; + /** + * The message to send users about the status of their request. + * If unset, a generic message based on the `status_code` is sent. + * + * Generated from protobuf field string user_facing_message = 2; + */ + protected $user_facing_message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $status_code + * The status code. + * @type string $user_facing_message + * The message to send users about the status of their request. + * If unset, a generic message based on the `status_code` is sent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\ActionStatus::initOnce(); + parent::__construct($data); + } + + /** + * The status code. + * + * Generated from protobuf field .google.rpc.Code status_code = 1; + * @return int + */ + public function getStatusCode() + { + return $this->status_code; + } + + /** + * The status code. + * + * Generated from protobuf field .google.rpc.Code status_code = 1; + * @param int $var + * @return $this + */ + public function setStatusCode($var) + { + GPBUtil::checkEnum($var, \Google\Rpc\Code::class); + $this->status_code = $var; + + return $this; + } + + /** + * The message to send users about the status of their request. + * If unset, a generic message based on the `status_code` is sent. + * + * Generated from protobuf field string user_facing_message = 2; + * @return string + */ + public function getUserFacingMessage() + { + return $this->user_facing_message; + } + + /** + * The message to send users about the status of their request. + * If unset, a generic message based on the `status_code` is sent. + * + * Generated from protobuf field string user_facing_message = 2; + * @param string $var + * @return $this + */ + public function setUserFacingMessage($var) + { + GPBUtil::checkString($var, True); + $this->user_facing_message = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Annotation.php b/AppsChat/src/Chat/V1/Annotation.php new file mode 100644 index 000000000000..7c9e10fdc422 --- /dev/null +++ b/AppsChat/src/Chat/V1/Annotation.php @@ -0,0 +1,285 @@ +google.chat.v1.Annotation + */ +class Annotation extends \Google\Protobuf\Internal\Message +{ + /** + * The type of this annotation. + * + * Generated from protobuf field .google.chat.v1.AnnotationType type = 1; + */ + protected $type = 0; + /** + * Start index (0-based, inclusive) in the plain-text message body this + * annotation corresponds to. + * + * Generated from protobuf field optional int32 start_index = 2; + */ + protected $start_index = null; + /** + * Length of the substring in the plain-text message body this annotation + * corresponds to. + * + * Generated from protobuf field int32 length = 3; + */ + protected $length = 0; + protected $metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The type of this annotation. + * @type int $start_index + * Start index (0-based, inclusive) in the plain-text message body this + * annotation corresponds to. + * @type int $length + * Length of the substring in the plain-text message body this annotation + * corresponds to. + * @type \Google\Apps\Chat\V1\UserMentionMetadata $user_mention + * The metadata of user mention. + * @type \Google\Apps\Chat\V1\SlashCommandMetadata $slash_command + * The metadata for a slash command. + * @type \Google\Apps\Chat\V1\RichLinkMetadata $rich_link_metadata + * The metadata for a rich link. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Annotation::initOnce(); + parent::__construct($data); + } + + /** + * The type of this annotation. + * + * Generated from protobuf field .google.chat.v1.AnnotationType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of this annotation. + * + * Generated from protobuf field .google.chat.v1.AnnotationType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\AnnotationType::class); + $this->type = $var; + + return $this; + } + + /** + * Start index (0-based, inclusive) in the plain-text message body this + * annotation corresponds to. + * + * Generated from protobuf field optional int32 start_index = 2; + * @return int + */ + public function getStartIndex() + { + return isset($this->start_index) ? $this->start_index : 0; + } + + public function hasStartIndex() + { + return isset($this->start_index); + } + + public function clearStartIndex() + { + unset($this->start_index); + } + + /** + * Start index (0-based, inclusive) in the plain-text message body this + * annotation corresponds to. + * + * Generated from protobuf field optional int32 start_index = 2; + * @param int $var + * @return $this + */ + public function setStartIndex($var) + { + GPBUtil::checkInt32($var); + $this->start_index = $var; + + return $this; + } + + /** + * Length of the substring in the plain-text message body this annotation + * corresponds to. + * + * Generated from protobuf field int32 length = 3; + * @return int + */ + public function getLength() + { + return $this->length; + } + + /** + * Length of the substring in the plain-text message body this annotation + * corresponds to. + * + * Generated from protobuf field int32 length = 3; + * @param int $var + * @return $this + */ + public function setLength($var) + { + GPBUtil::checkInt32($var); + $this->length = $var; + + return $this; + } + + /** + * The metadata of user mention. + * + * Generated from protobuf field .google.chat.v1.UserMentionMetadata user_mention = 4; + * @return \Google\Apps\Chat\V1\UserMentionMetadata|null + */ + public function getUserMention() + { + return $this->readOneof(4); + } + + public function hasUserMention() + { + return $this->hasOneof(4); + } + + /** + * The metadata of user mention. + * + * Generated from protobuf field .google.chat.v1.UserMentionMetadata user_mention = 4; + * @param \Google\Apps\Chat\V1\UserMentionMetadata $var + * @return $this + */ + public function setUserMention($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\UserMentionMetadata::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The metadata for a slash command. + * + * Generated from protobuf field .google.chat.v1.SlashCommandMetadata slash_command = 5; + * @return \Google\Apps\Chat\V1\SlashCommandMetadata|null + */ + public function getSlashCommand() + { + return $this->readOneof(5); + } + + public function hasSlashCommand() + { + return $this->hasOneof(5); + } + + /** + * The metadata for a slash command. + * + * Generated from protobuf field .google.chat.v1.SlashCommandMetadata slash_command = 5; + * @param \Google\Apps\Chat\V1\SlashCommandMetadata $var + * @return $this + */ + public function setSlashCommand($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\SlashCommandMetadata::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The metadata for a rich link. + * + * Generated from protobuf field .google.chat.v1.RichLinkMetadata rich_link_metadata = 6; + * @return \Google\Apps\Chat\V1\RichLinkMetadata|null + */ + public function getRichLinkMetadata() + { + return $this->readOneof(6); + } + + public function hasRichLinkMetadata() + { + return $this->hasOneof(6); + } + + /** + * The metadata for a rich link. + * + * Generated from protobuf field .google.chat.v1.RichLinkMetadata rich_link_metadata = 6; + * @param \Google\Apps\Chat\V1\RichLinkMetadata $var + * @return $this + */ + public function setRichLinkMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\RichLinkMetadata::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getMetadata() + { + return $this->whichOneof("metadata"); + } + +} + diff --git a/AppsChat/src/Chat/V1/AnnotationType.php b/AppsChat/src/Chat/V1/AnnotationType.php new file mode 100644 index 000000000000..c9b09b768c19 --- /dev/null +++ b/AppsChat/src/Chat/V1/AnnotationType.php @@ -0,0 +1,68 @@ +google.chat.v1.AnnotationType + */ +class AnnotationType +{ + /** + * Default value for the enum. Don't use. + * + * Generated from protobuf enum ANNOTATION_TYPE_UNSPECIFIED = 0; + */ + const ANNOTATION_TYPE_UNSPECIFIED = 0; + /** + * A user is mentioned. + * + * Generated from protobuf enum USER_MENTION = 1; + */ + const USER_MENTION = 1; + /** + * A slash command is invoked. + * + * Generated from protobuf enum SLASH_COMMAND = 2; + */ + const SLASH_COMMAND = 2; + /** + * A rich link annotation. + * + * Generated from protobuf enum RICH_LINK = 3; + */ + const RICH_LINK = 3; + + private static $valueToName = [ + self::ANNOTATION_TYPE_UNSPECIFIED => 'ANNOTATION_TYPE_UNSPECIFIED', + self::USER_MENTION => 'USER_MENTION', + self::SLASH_COMMAND => 'SLASH_COMMAND', + self::RICH_LINK => 'RICH_LINK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/AppsChat/src/Chat/V1/AttachedGif.php b/AppsChat/src/Chat/V1/AttachedGif.php new file mode 100644 index 000000000000..0856cd583a48 --- /dev/null +++ b/AppsChat/src/Chat/V1/AttachedGif.php @@ -0,0 +1,67 @@ +google.chat.v1.AttachedGif + */ +class AttachedGif extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The URL that hosts the GIF image. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Output only. The URL that hosts the GIF image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The URL that hosts the GIF image. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Output only. The URL that hosts the GIF image. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Attachment.php b/AppsChat/src/Chat/V1/Attachment.php new file mode 100644 index 000000000000..dd041ff28c9d --- /dev/null +++ b/AppsChat/src/Chat/V1/Attachment.php @@ -0,0 +1,338 @@ +google.chat.v1.Attachment + */ +class Attachment extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The original file name for the content, not the full path. + * + * Generated from protobuf field string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $content_name = ''; + /** + * Output only. The content type (MIME type) of the file. + * + * Generated from protobuf field string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $content_type = ''; + /** + * Output only. The thumbnail URL which should be used to preview the + * attachment to a human user. Chat apps shouldn't use this URL to download + * attachment content. + * + * Generated from protobuf field string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $thumbnail_uri = ''; + /** + * Output only. The download URL which should be used to allow a human user to + * download the attachment. Chat apps shouldn't use this URL to download + * attachment content. + * + * Generated from protobuf field string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $download_uri = ''; + /** + * Output only. The source of the attachment. + * + * Generated from protobuf field .google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source = 0; + protected $data_ref; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * @type string $content_name + * Output only. The original file name for the content, not the full path. + * @type string $content_type + * Output only. The content type (MIME type) of the file. + * @type \Google\Apps\Chat\V1\AttachmentDataRef $attachment_data_ref + * A reference to the attachment data. This field is used with the media API + * to download the attachment data. + * @type \Google\Apps\Chat\V1\DriveDataRef $drive_data_ref + * Output only. A reference to the Google Drive attachment. This field is + * used with the Google Drive API. + * @type string $thumbnail_uri + * Output only. The thumbnail URL which should be used to preview the + * attachment to a human user. Chat apps shouldn't use this URL to download + * attachment content. + * @type string $download_uri + * Output only. The download URL which should be used to allow a human user to + * download the attachment. Chat apps shouldn't use this URL to download + * attachment content. + * @type int $source + * Output only. The source of the attachment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Attachment::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The original file name for the content, not the full path. + * + * Generated from protobuf field string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getContentName() + { + return $this->content_name; + } + + /** + * Output only. The original file name for the content, not the full path. + * + * Generated from protobuf field string content_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setContentName($var) + { + GPBUtil::checkString($var, True); + $this->content_name = $var; + + return $this; + } + + /** + * Output only. The content type (MIME type) of the file. + * + * Generated from protobuf field string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getContentType() + { + return $this->content_type; + } + + /** + * Output only. The content type (MIME type) of the file. + * + * Generated from protobuf field string content_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setContentType($var) + { + GPBUtil::checkString($var, True); + $this->content_type = $var; + + return $this; + } + + /** + * A reference to the attachment data. This field is used with the media API + * to download the attachment data. + * + * Generated from protobuf field .google.chat.v1.AttachmentDataRef attachment_data_ref = 4; + * @return \Google\Apps\Chat\V1\AttachmentDataRef|null + */ + public function getAttachmentDataRef() + { + return $this->readOneof(4); + } + + public function hasAttachmentDataRef() + { + return $this->hasOneof(4); + } + + /** + * A reference to the attachment data. This field is used with the media API + * to download the attachment data. + * + * Generated from protobuf field .google.chat.v1.AttachmentDataRef attachment_data_ref = 4; + * @param \Google\Apps\Chat\V1\AttachmentDataRef $var + * @return $this + */ + public function setAttachmentDataRef($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\AttachmentDataRef::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Output only. A reference to the Google Drive attachment. This field is + * used with the Google Drive API. + * + * Generated from protobuf field .google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\DriveDataRef|null + */ + public function getDriveDataRef() + { + return $this->readOneof(7); + } + + public function hasDriveDataRef() + { + return $this->hasOneof(7); + } + + /** + * Output only. A reference to the Google Drive attachment. This field is + * used with the Google Drive API. + * + * Generated from protobuf field .google.chat.v1.DriveDataRef drive_data_ref = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\DriveDataRef $var + * @return $this + */ + public function setDriveDataRef($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\DriveDataRef::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Output only. The thumbnail URL which should be used to preview the + * attachment to a human user. Chat apps shouldn't use this URL to download + * attachment content. + * + * Generated from protobuf field string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getThumbnailUri() + { + return $this->thumbnail_uri; + } + + /** + * Output only. The thumbnail URL which should be used to preview the + * attachment to a human user. Chat apps shouldn't use this URL to download + * attachment content. + * + * Generated from protobuf field string thumbnail_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setThumbnailUri($var) + { + GPBUtil::checkString($var, True); + $this->thumbnail_uri = $var; + + return $this; + } + + /** + * Output only. The download URL which should be used to allow a human user to + * download the attachment. Chat apps shouldn't use this URL to download + * attachment content. + * + * Generated from protobuf field string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDownloadUri() + { + return $this->download_uri; + } + + /** + * Output only. The download URL which should be used to allow a human user to + * download the attachment. Chat apps shouldn't use this URL to download + * attachment content. + * + * Generated from protobuf field string download_uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDownloadUri($var) + { + GPBUtil::checkString($var, True); + $this->download_uri = $var; + + return $this; + } + + /** + * Output only. The source of the attachment. + * + * Generated from protobuf field .google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSource() + { + return $this->source; + } + + /** + * Output only. The source of the attachment. + * + * Generated from protobuf field .google.chat.v1.Attachment.Source source = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\Attachment\Source::class); + $this->source = $var; + + return $this; + } + + /** + * @return string + */ + public function getDataRef() + { + return $this->whichOneof("data_ref"); + } + +} + diff --git a/AppsChat/src/Chat/V1/Attachment/Source.php b/AppsChat/src/Chat/V1/Attachment/Source.php new file mode 100644 index 000000000000..3d86c29161cc --- /dev/null +++ b/AppsChat/src/Chat/V1/Attachment/Source.php @@ -0,0 +1,62 @@ +google.chat.v1.Attachment.Source + */ +class Source +{ + /** + * Reserved. + * + * Generated from protobuf enum SOURCE_UNSPECIFIED = 0; + */ + const SOURCE_UNSPECIFIED = 0; + /** + * The file is a Google Drive file. + * + * Generated from protobuf enum DRIVE_FILE = 1; + */ + const DRIVE_FILE = 1; + /** + * The file is uploaded to Chat. + * + * Generated from protobuf enum UPLOADED_CONTENT = 2; + */ + const UPLOADED_CONTENT = 2; + + private static $valueToName = [ + self::SOURCE_UNSPECIFIED => 'SOURCE_UNSPECIFIED', + self::DRIVE_FILE => 'DRIVE_FILE', + self::UPLOADED_CONTENT => 'UPLOADED_CONTENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/AttachmentDataRef.php b/AppsChat/src/Chat/V1/AttachmentDataRef.php new file mode 100644 index 000000000000..713e30068a9b --- /dev/null +++ b/AppsChat/src/Chat/V1/AttachmentDataRef.php @@ -0,0 +1,113 @@ +google.chat.v1.AttachmentDataRef + */ +class AttachmentDataRef extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the attachment data. This field is used with the media + * API to download the attachment data. + * + * Generated from protobuf field string resource_name = 1; + */ + protected $resource_name = ''; + /** + * Opaque token containing a reference to an uploaded attachment. Treated by + * clients as an opaque string and used to create or update Chat messages with + * attachments. + * + * Generated from protobuf field string attachment_upload_token = 2; + */ + protected $attachment_upload_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $resource_name + * The resource name of the attachment data. This field is used with the media + * API to download the attachment data. + * @type string $attachment_upload_token + * Opaque token containing a reference to an uploaded attachment. Treated by + * clients as an opaque string and used to create or update Chat messages with + * attachments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Attachment::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the attachment data. This field is used with the media + * API to download the attachment data. + * + * Generated from protobuf field string resource_name = 1; + * @return string + */ + public function getResourceName() + { + return $this->resource_name; + } + + /** + * The resource name of the attachment data. This field is used with the media + * API to download the attachment data. + * + * Generated from protobuf field string resource_name = 1; + * @param string $var + * @return $this + */ + public function setResourceName($var) + { + GPBUtil::checkString($var, True); + $this->resource_name = $var; + + return $this; + } + + /** + * Opaque token containing a reference to an uploaded attachment. Treated by + * clients as an opaque string and used to create or update Chat messages with + * attachments. + * + * Generated from protobuf field string attachment_upload_token = 2; + * @return string + */ + public function getAttachmentUploadToken() + { + return $this->attachment_upload_token; + } + + /** + * Opaque token containing a reference to an uploaded attachment. Treated by + * clients as an opaque string and used to create or update Chat messages with + * attachments. + * + * Generated from protobuf field string attachment_upload_token = 2; + * @param string $var + * @return $this + */ + public function setAttachmentUploadToken($var) + { + GPBUtil::checkString($var, True); + $this->attachment_upload_token = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/CardWithId.php b/AppsChat/src/Chat/V1/CardWithId.php new file mode 100644 index 000000000000..3d2235adb173 --- /dev/null +++ b/AppsChat/src/Chat/V1/CardWithId.php @@ -0,0 +1,121 @@ +google.chat.v1.CardWithId + */ +class CardWithId extends \Google\Protobuf\Internal\Message +{ + /** + * Required if the message contains multiple cards. A unique identifier for + * a card in a message. + * + * Generated from protobuf field string card_id = 1; + */ + protected $card_id = ''; + /** + * A card. Maximum size is 32 KB. + * + * Generated from protobuf field .google.apps.card.v1.Card card = 2; + */ + protected $card = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $card_id + * Required if the message contains multiple cards. A unique identifier for + * a card in a message. + * @type \Google\Apps\Card\V1\Card $card + * A card. Maximum size is 32 KB. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Required if the message contains multiple cards. A unique identifier for + * a card in a message. + * + * Generated from protobuf field string card_id = 1; + * @return string + */ + public function getCardId() + { + return $this->card_id; + } + + /** + * Required if the message contains multiple cards. A unique identifier for + * a card in a message. + * + * Generated from protobuf field string card_id = 1; + * @param string $var + * @return $this + */ + public function setCardId($var) + { + GPBUtil::checkString($var, True); + $this->card_id = $var; + + return $this; + } + + /** + * A card. Maximum size is 32 KB. + * + * Generated from protobuf field .google.apps.card.v1.Card card = 2; + * @return \Google\Apps\Card\V1\Card|null + */ + public function getCard() + { + return $this->card; + } + + public function hasCard() + { + return isset($this->card); + } + + public function clearCard() + { + unset($this->card); + } + + /** + * A card. Maximum size is 32 KB. + * + * Generated from protobuf field .google.apps.card.v1.Card card = 2; + * @param \Google\Apps\Card\V1\Card $var + * @return $this + */ + public function setCard($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Card::class); + $this->card = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Client/ChatServiceClient.php b/AppsChat/src/Chat/V1/Client/ChatServiceClient.php new file mode 100644 index 000000000000..cfbe6d679e84 --- /dev/null +++ b/AppsChat/src/Chat/V1/Client/ChatServiceClient.php @@ -0,0 +1,1210 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/chat_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/chat_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/chat_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/chat_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a attachment + * resource. + * + * @param string $space + * @param string $message + * @param string $attachment + * + * @return string The formatted attachment resource. + */ + public static function attachmentName(string $space, string $message, string $attachment): string + { + return self::getPathTemplate('attachment')->render([ + 'space' => $space, + 'message' => $message, + 'attachment' => $attachment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a membership + * resource. + * + * @param string $space + * @param string $member + * + * @return string The formatted membership resource. + */ + public static function membershipName(string $space, string $member): string + { + return self::getPathTemplate('membership')->render([ + 'space' => $space, + 'member' => $member, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a message + * resource. + * + * @param string $space + * @param string $message + * + * @return string The formatted message resource. + */ + public static function messageName(string $space, string $message): string + { + return self::getPathTemplate('message')->render([ + 'space' => $space, + 'message' => $message, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * quoted_message_metadata resource. + * + * @param string $space + * @param string $message + * @param string $quotedMessageMetadata + * + * @return string The formatted quoted_message_metadata resource. + */ + public static function quotedMessageMetadataName( + string $space, + string $message, + string $quotedMessageMetadata + ): string { + return self::getPathTemplate('quotedMessageMetadata')->render([ + 'space' => $space, + 'message' => $message, + 'quoted_message_metadata' => $quotedMessageMetadata, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a reaction + * resource. + * + * @param string $space + * @param string $message + * @param string $reaction + * + * @return string The formatted reaction resource. + */ + public static function reactionName(string $space, string $message, string $reaction): string + { + return self::getPathTemplate('reaction')->render([ + 'space' => $space, + 'message' => $message, + 'reaction' => $reaction, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a space + * resource. + * + * @param string $space + * + * @return string The formatted space resource. + */ + public static function spaceName(string $space): string + { + return self::getPathTemplate('space')->render([ + 'space' => $space, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a thread + * resource. + * + * @param string $space + * @param string $thread + * + * @return string The formatted thread resource. + */ + public static function threadName(string $space, string $thread): string + { + return self::getPathTemplate('thread')->render([ + 'space' => $space, + 'thread' => $thread, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - attachment: spaces/{space}/messages/{message}/attachments/{attachment} + * - membership: spaces/{space}/members/{member} + * - message: spaces/{space}/messages/{message} + * - quotedMessageMetadata: spaces/{space}/messages/{message}/quotedMessageMetadata/{quoted_message_metadata} + * - reaction: spaces/{space}/messages/{message}/reactions/{reaction} + * - space: spaces/{space} + * - thread: spaces/{space}/threads/{thread} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'chat.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Completes the + * [import process](https://developers.google.com/workspace/chat/import-data) + * for the specified space and makes it visible to users. + * Requires app authentication and domain-wide delegation. For more + * information, see [Authorize Google Chat apps to import + * data](https://developers.google.com/workspace/chat/authorize-import). + * + * The async variant is {@see ChatServiceClient::completeImportSpaceAsync()} . + * + * @example samples/V1/ChatServiceClient/complete_import_space.php + * + * @param CompleteImportSpaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CompleteImportSpaceResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function completeImportSpace( + CompleteImportSpaceRequest $request, + array $callOptions = [] + ): CompleteImportSpaceResponse { + return $this->startApiCall('CompleteImportSpace', $request, $callOptions)->wait(); + } + + /** + * Creates a human membership or app membership for the calling app. Creating + * memberships for other apps isn't supported. For an example, see + * [Invite or add a user or a Google Chat app to a + * space](https://developers.google.com/workspace/chat/create-members). + * When creating a membership, if the specified member has their auto-accept + * policy turned off, then they're invited, and must accept the space + * invitation before joining. Otherwise, creating a membership adds the member + * directly to the specified space. Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * To specify the member to add, set the `membership.member.name` in the + * `CreateMembershipRequest`: + * + * - To add the calling app to a space or a direct message between two human + * users, use `users/app`. Unable to add other + * apps to the space. + * + * - To add a human user, use `users/{user}`, where `{user}` can be the email + * address for the user. For users in the same Workspace organization `{user}` + * can also be the `id` for the person from the People API, or the `id` for + * the user in the Directory API. For example, if the People API Person + * profile ID for `user@example.com` is `123456789`, you can add the user to + * the space by setting the `membership.member.name` to + * `users/user@example.com` or `users/123456789`. + * + * The async variant is {@see ChatServiceClient::createMembershipAsync()} . + * + * @example samples/V1/ChatServiceClient/create_membership.php + * + * @param CreateMembershipRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Membership + * + * @throws ApiException Thrown if the API call fails. + */ + public function createMembership(CreateMembershipRequest $request, array $callOptions = []): Membership + { + return $this->startApiCall('CreateMembership', $request, $callOptions)->wait(); + } + + /** + * Creates a message in a Google Chat space. For an example, see [Send a + * message](https://developers.google.com/workspace/chat/create-messages). + * + * Calling this method requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) + * and supports the following authentication types: + * + * - For text messages, user authentication or app authentication are + * supported. + * - For card messages, only app authentication is supported. (Only Chat apps + * can create card messages.) + * + * The async variant is {@see ChatServiceClient::createMessageAsync()} . + * + * @example samples/V1/ChatServiceClient/create_message.php + * + * @param CreateMessageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Message + * + * @throws ApiException Thrown if the API call fails. + */ + public function createMessage(CreateMessageRequest $request, array $callOptions = []): Message + { + return $this->startApiCall('CreateMessage', $request, $callOptions)->wait(); + } + + /** + * Creates a reaction and adds it to a message. Only unicode emojis are + * supported. For an example, see + * [Add a reaction to a + * message](https://developers.google.com/workspace/chat/create-reactions). + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::createReactionAsync()} . + * + * @example samples/V1/ChatServiceClient/create_reaction.php + * + * @param CreateReactionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Reaction + * + * @throws ApiException Thrown if the API call fails. + */ + public function createReaction(CreateReactionRequest $request, array $callOptions = []): Reaction + { + return $this->startApiCall('CreateReaction', $request, $callOptions)->wait(); + } + + /** + * Creates a named space. Spaces grouped by topics aren't supported. For an + * example, see [Create a + * space](https://developers.google.com/workspace/chat/create-spaces). + * + * If you receive the error message `ALREADY_EXISTS` when creating + * a space, try a different `displayName`. An existing space within + * the Google Workspace organization might already use this display name. + * + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::createSpaceAsync()} . + * + * @example samples/V1/ChatServiceClient/create_space.php + * + * @param CreateSpaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Space + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSpace(CreateSpaceRequest $request, array $callOptions = []): Space + { + return $this->startApiCall('CreateSpace', $request, $callOptions)->wait(); + } + + /** + * Deletes a membership. For an example, see + * [Remove a user or a Google Chat app from a + * space](https://developers.google.com/workspace/chat/delete-members). + * + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::deleteMembershipAsync()} . + * + * @example samples/V1/ChatServiceClient/delete_membership.php + * + * @param DeleteMembershipRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Membership + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteMembership(DeleteMembershipRequest $request, array $callOptions = []): Membership + { + return $this->startApiCall('DeleteMembership', $request, $callOptions)->wait(); + } + + /** + * Deletes a message. + * For an example, see [Delete a + * message](https://developers.google.com/workspace/chat/delete-messages). + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * When using app authentication, requests can only delete messages + * created by the calling Chat app. + * + * The async variant is {@see ChatServiceClient::deleteMessageAsync()} . + * + * @example samples/V1/ChatServiceClient/delete_message.php + * + * @param DeleteMessageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteMessage(DeleteMessageRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteMessage', $request, $callOptions)->wait(); + } + + /** + * Deletes a reaction to a message. Only unicode emojis are supported. + * For an example, see + * [Delete a + * reaction](https://developers.google.com/workspace/chat/delete-reactions). + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::deleteReactionAsync()} . + * + * @example samples/V1/ChatServiceClient/delete_reaction.php + * + * @param DeleteReactionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteReaction(DeleteReactionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteReaction', $request, $callOptions)->wait(); + } + + /** + * Deletes a named space. Always performs a cascading delete, which means + * that the space's child resources—like messages posted in the space and + * memberships in the space—are also deleted. For an example, see + * [Delete a + * space](https://developers.google.com/workspace/chat/delete-spaces). + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * from a user who has permission to delete the space. + * + * The async variant is {@see ChatServiceClient::deleteSpaceAsync()} . + * + * @example samples/V1/ChatServiceClient/delete_space.php + * + * @param DeleteSpaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSpace(DeleteSpaceRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteSpace', $request, $callOptions)->wait(); + } + + /** + * Returns the existing direct message with the specified user. If no direct + * message space is found, returns a `404 NOT_FOUND` error. For an example, + * see + * [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). + * + * With [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * returns the direct message space between the specified user and the + * authenticated user. + * + * With [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), + * returns the direct message space between the specified user and the calling + * Chat app. + * + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * or [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * The async variant is {@see ChatServiceClient::findDirectMessageAsync()} . + * + * @example samples/V1/ChatServiceClient/find_direct_message.php + * + * @param FindDirectMessageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Space + * + * @throws ApiException Thrown if the API call fails. + */ + public function findDirectMessage(FindDirectMessageRequest $request, array $callOptions = []): Space + { + return $this->startApiCall('FindDirectMessage', $request, $callOptions)->wait(); + } + + /** + * Gets the metadata of a message attachment. The attachment data is fetched + * using the [media + * API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). + * For an example, see + * [Get metadata about a message + * attachment](https://developers.google.com/workspace/chat/get-media-attachments). + * Requires [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * The async variant is {@see ChatServiceClient::getAttachmentAsync()} . + * + * @example samples/V1/ChatServiceClient/get_attachment.php + * + * @param GetAttachmentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Attachment + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAttachment(GetAttachmentRequest $request, array $callOptions = []): Attachment + { + return $this->startApiCall('GetAttachment', $request, $callOptions)->wait(); + } + + /** + * Returns details about a membership. For an example, see + * [Get details about a user's or Google Chat app's + * membership](https://developers.google.com/workspace/chat/get-members). + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::getMembershipAsync()} . + * + * @example samples/V1/ChatServiceClient/get_membership.php + * + * @param GetMembershipRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Membership + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMembership(GetMembershipRequest $request, array $callOptions = []): Membership + { + return $this->startApiCall('GetMembership', $request, $callOptions)->wait(); + } + + /** + * Returns details about a message. + * For an example, see [Get details about a + * message](https://developers.google.com/workspace/chat/get-messages). + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * Note: Might return a message from a blocked member or space. + * + * The async variant is {@see ChatServiceClient::getMessageAsync()} . + * + * @example samples/V1/ChatServiceClient/get_message.php + * + * @param GetMessageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Message + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMessage(GetMessageRequest $request, array $callOptions = []): Message + { + return $this->startApiCall('GetMessage', $request, $callOptions)->wait(); + } + + /** + * Returns details about a space. For an example, see + * [Get details about a + * space](https://developers.google.com/workspace/chat/get-spaces). + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::getSpaceAsync()} . + * + * @example samples/V1/ChatServiceClient/get_space.php + * + * @param GetSpaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Space + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSpace(GetSpaceRequest $request, array $callOptions = []): Space + { + return $this->startApiCall('GetSpace', $request, $callOptions)->wait(); + } + + /** + * Lists memberships in a space. For an example, see [List users and Google + * Chat apps in a + * space](https://developers.google.com/workspace/chat/list-members). Listing + * memberships with [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * lists memberships in spaces that the Chat app has + * access to, but excludes Chat app memberships, + * including its own. Listing memberships with + * [User + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * lists memberships in spaces that the authenticated user has access to. + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::listMembershipsAsync()} . + * + * @example samples/V1/ChatServiceClient/list_memberships.php + * + * @param ListMembershipsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMemberships(ListMembershipsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMemberships', $request, $callOptions); + } + + /** + * Lists messages in a space that the caller is a member of, including + * messages from blocked members and spaces. For an example, see + * [List messages](/chat/api/guides/v1/messages/list). + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::listMessagesAsync()} . + * + * @example samples/V1/ChatServiceClient/list_messages.php + * + * @param ListMessagesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMessages(ListMessagesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMessages', $request, $callOptions); + } + + /** + * Lists reactions to a message. For an example, see + * [List reactions for a + * message](https://developers.google.com/workspace/chat/list-reactions). + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::listReactionsAsync()} . + * + * @example samples/V1/ChatServiceClient/list_reactions.php + * + * @param ListReactionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listReactions(ListReactionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListReactions', $request, $callOptions); + } + + /** + * Lists spaces the caller is a member of. Group chats and DMs aren't listed + * until the first message is sent. For an example, see + * [List + * spaces](https://developers.google.com/workspace/chat/list-spaces). + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * Lists spaces visible to the caller or authenticated user. Group chats + * and DMs aren't listed until the first message is sent. + * + * The async variant is {@see ChatServiceClient::listSpacesAsync()} . + * + * @example samples/V1/ChatServiceClient/list_spaces.php + * + * @param ListSpacesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSpaces(ListSpacesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSpaces', $request, $callOptions); + } + + /** + * Creates a space and adds specified users to it. The calling user is + * automatically added to the space, and shouldn't be specified as a + * membership in the request. For an example, see + * [Set up a space with initial + * members](https://developers.google.com/workspace/chat/set-up-spaces). + * + * To specify the human members to add, add memberships with the appropriate + * `member.name` in the `SetUpSpaceRequest`. To add a human user, use + * `users/{user}`, where `{user}` can be the email address for the user. For + * users in the same Workspace organization `{user}` can also be the `id` for + * the person from the People API, or the `id` for the user in the Directory + * API. For example, if the People API Person profile ID for + * `user@example.com` is `123456789`, you can add the user to the space by + * setting the `membership.member.name` to `users/user@example.com` or + * `users/123456789`. + * + * For a space or group chat, if the caller blocks or is blocked by some + * members, then those members aren't added to the created space. + * + * To create a direct message (DM) between the calling user and another human + * user, specify exactly one membership to represent the human user. If + * one user blocks the other, the request fails and the DM isn't created. + * + * To create a DM between the calling user and the calling app, set + * `Space.singleUserBotDm` to `true` and don't specify any memberships. You + * can only use this method to set up a DM with the calling app. To add the + * calling app as a member of a space or an existing DM between two human + * users, see + * [Invite or add a user or app to a + * space](https://developers.google.com/workspace/chat/create-members). + * + * If a DM already exists between two users, even when one user blocks the + * other at the time a request is made, then the existing DM is returned. + * + * Spaces with threaded replies aren't supported. If you receive the error + * message `ALREADY_EXISTS` when setting up a space, try a different + * `displayName`. An existing space within the Google Workspace organization + * might already use this display name. + * + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::setUpSpaceAsync()} . + * + * @example samples/V1/ChatServiceClient/set_up_space.php + * + * @param SetUpSpaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Space + * + * @throws ApiException Thrown if the API call fails. + */ + public function setUpSpace(SetUpSpaceRequest $request, array $callOptions = []): Space + { + return $this->startApiCall('SetUpSpace', $request, $callOptions)->wait(); + } + + /** + * Updates a message. There's a difference between the `patch` and `update` + * methods. The `patch` + * method uses a `patch` request while the `update` method uses a `put` + * request. We recommend using the `patch` method. For an example, see + * [Update a + * message](https://developers.google.com/workspace/chat/update-messages). + * + * Requires + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). + * Supports + * [app + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * and [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * When using app authentication, requests can only update messages + * created by the calling Chat app. + * + * The async variant is {@see ChatServiceClient::updateMessageAsync()} . + * + * @example samples/V1/ChatServiceClient/update_message.php + * + * @param UpdateMessageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Message + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateMessage(UpdateMessageRequest $request, array $callOptions = []): Message + { + return $this->startApiCall('UpdateMessage', $request, $callOptions)->wait(); + } + + /** + * Updates a space. For an example, see + * [Update a + * space](https://developers.google.com/workspace/chat/update-spaces). + * + * If you're updating the `displayName` field and receive the error message + * `ALREADY_EXISTS`, try a different display name.. An existing space within + * the Google Workspace organization might already use this display name. + * + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * The async variant is {@see ChatServiceClient::updateSpaceAsync()} . + * + * @example samples/V1/ChatServiceClient/update_space.php + * + * @param UpdateSpaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Space + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSpace(UpdateSpaceRequest $request, array $callOptions = []): Space + { + return $this->startApiCall('UpdateSpace', $request, $callOptions)->wait(); + } + + /** + * Uploads an attachment. For an example, see + * [Upload media as a file + * attachment](https://developers.google.com/workspace/chat/upload-media-attachments). + * Requires user + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * You can upload attachments up to 200 MB. Certain file types aren't + * supported. For details, see [File types blocked by Google + * Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat). + * + * The async variant is {@see ChatServiceClient::uploadAttachmentAsync()} . + * + * @example samples/V1/ChatServiceClient/upload_attachment.php + * + * @param UploadAttachmentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return UploadAttachmentResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function uploadAttachment( + UploadAttachmentRequest $request, + array $callOptions = [] + ): UploadAttachmentResponse { + return $this->startApiCall('UploadAttachment', $request, $callOptions)->wait(); + } +} diff --git a/AppsChat/src/Chat/V1/CompleteImportSpaceRequest.php b/AppsChat/src/Chat/V1/CompleteImportSpaceRequest.php new file mode 100644 index 000000000000..f6cddab25e0d --- /dev/null +++ b/AppsChat/src/Chat/V1/CompleteImportSpaceRequest.php @@ -0,0 +1,71 @@ +google.chat.v1.CompleteImportSpaceRequest + */ +class CompleteImportSpaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the import mode space. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the import mode space. + * Format: `spaces/{space}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the import mode space. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the import mode space. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/CompleteImportSpaceResponse.php b/AppsChat/src/Chat/V1/CompleteImportSpaceResponse.php new file mode 100644 index 000000000000..500dcf0d0fe4 --- /dev/null +++ b/AppsChat/src/Chat/V1/CompleteImportSpaceResponse.php @@ -0,0 +1,77 @@ +google.chat.v1.CompleteImportSpaceResponse + */ +class CompleteImportSpaceResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The import mode space. + * + * Generated from protobuf field .google.chat.v1.Space space = 1; + */ + protected $space = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Space $space + * The import mode space. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * The import mode space. + * + * Generated from protobuf field .google.chat.v1.Space space = 1; + * @return \Google\Apps\Chat\V1\Space|null + */ + public function getSpace() + { + return $this->space; + } + + public function hasSpace() + { + return isset($this->space); + } + + public function clearSpace() + { + unset($this->space); + } + + /** + * The import mode space. + * + * Generated from protobuf field .google.chat.v1.Space space = 1; + * @param \Google\Apps\Chat\V1\Space $var + * @return $this + */ + public function setSpace($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Space::class); + $this->space = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ContextualAddOnMarkup.php b/AppsChat/src/Chat/V1/ContextualAddOnMarkup.php new file mode 100644 index 000000000000..0eec00f28227 --- /dev/null +++ b/AppsChat/src/Chat/V1/ContextualAddOnMarkup.php @@ -0,0 +1,33 @@ +google.chat.v1.ContextualAddOnMarkup + */ +class ContextualAddOnMarkup extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\ContextualAddon::initOnce(); + parent::__construct($data); + } + +} + diff --git a/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card.php b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card.php new file mode 100644 index 000000000000..9368f85fc88a --- /dev/null +++ b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card.php @@ -0,0 +1,181 @@ +google.chat.v1.ContextualAddOnMarkup.Card + */ +class Card extends \Google\Protobuf\Internal\Message +{ + /** + * The header of the card. A header usually contains a title and an image. + * + * Generated from protobuf field .google.chat.v1.ContextualAddOnMarkup.Card.CardHeader header = 1; + */ + protected $header = null; + /** + * Sections are separated by a line divider. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card.Section sections = 2; + */ + private $sections; + /** + * The actions of this card. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card.CardAction card_actions = 3; + */ + private $card_actions; + /** + * Name of the card. + * + * Generated from protobuf field string name = 4; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardHeader $header + * The header of the card. A header usually contains a title and an image. + * @type array<\Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\Section>|\Google\Protobuf\Internal\RepeatedField $sections + * Sections are separated by a line divider. + * @type array<\Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardAction>|\Google\Protobuf\Internal\RepeatedField $card_actions + * The actions of this card. + * @type string $name + * Name of the card. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\ContextualAddon::initOnce(); + parent::__construct($data); + } + + /** + * The header of the card. A header usually contains a title and an image. + * + * Generated from protobuf field .google.chat.v1.ContextualAddOnMarkup.Card.CardHeader header = 1; + * @return \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardHeader|null + */ + public function getHeader() + { + return $this->header; + } + + public function hasHeader() + { + return isset($this->header); + } + + public function clearHeader() + { + unset($this->header); + } + + /** + * The header of the card. A header usually contains a title and an image. + * + * Generated from protobuf field .google.chat.v1.ContextualAddOnMarkup.Card.CardHeader header = 1; + * @param \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardHeader $var + * @return $this + */ + public function setHeader($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardHeader::class); + $this->header = $var; + + return $this; + } + + /** + * Sections are separated by a line divider. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card.Section sections = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSections() + { + return $this->sections; + } + + /** + * Sections are separated by a line divider. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card.Section sections = 2; + * @param array<\Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\Section>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\Section::class); + $this->sections = $arr; + + return $this; + } + + /** + * The actions of this card. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card.CardAction card_actions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCardActions() + { + return $this->card_actions; + } + + /** + * The actions of this card. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card.CardAction card_actions = 3; + * @param array<\Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardAction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCardActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardAction::class); + $this->card_actions = $arr; + + return $this; + } + + /** + * Name of the card. + * + * Generated from protobuf field string name = 4; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the card. + * + * Generated from protobuf field string name = 4; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardAction.php b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardAction.php new file mode 100644 index 000000000000..671e2eaa670c --- /dev/null +++ b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardAction.php @@ -0,0 +1,116 @@ +google.chat.v1.ContextualAddOnMarkup.Card.CardAction + */ +class CardAction extends \Google\Protobuf\Internal\Message +{ + /** + * The label used to be displayed in the action menu item. + * + * Generated from protobuf field string action_label = 1; + */ + protected $action_label = ''; + /** + * The onclick action for this action item. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + */ + protected $on_click = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action_label + * The label used to be displayed in the action menu item. + * @type \Google\Apps\Chat\V1\WidgetMarkup\OnClick $on_click + * The onclick action for this action item. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\ContextualAddon::initOnce(); + parent::__construct($data); + } + + /** + * The label used to be displayed in the action menu item. + * + * Generated from protobuf field string action_label = 1; + * @return string + */ + public function getActionLabel() + { + return $this->action_label; + } + + /** + * The label used to be displayed in the action menu item. + * + * Generated from protobuf field string action_label = 1; + * @param string $var + * @return $this + */ + public function setActionLabel($var) + { + GPBUtil::checkString($var, True); + $this->action_label = $var; + + return $this; + } + + /** + * The onclick action for this action item. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * The onclick action for this action item. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\OnClick::class); + $this->on_click = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardHeader.php b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardHeader.php new file mode 100644 index 000000000000..2ef7eed49c07 --- /dev/null +++ b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardHeader.php @@ -0,0 +1,176 @@ +google.chat.v1.ContextualAddOnMarkup.Card.CardHeader + */ +class CardHeader extends \Google\Protobuf\Internal\Message +{ + /** + * The title must be specified. The header has a fixed height: if both a + * title and subtitle is specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * + * Generated from protobuf field string title = 1; + */ + protected $title = ''; + /** + * The subtitle of the card header. + * + * Generated from protobuf field string subtitle = 2; + */ + protected $subtitle = ''; + /** + * The image's type (for example, square border or circular border). + * + * Generated from protobuf field .google.chat.v1.ContextualAddOnMarkup.Card.CardHeader.ImageStyle image_style = 3; + */ + protected $image_style = 0; + /** + * The URL of the image in the card header. + * + * Generated from protobuf field string image_url = 4; + */ + protected $image_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $title + * The title must be specified. The header has a fixed height: if both a + * title and subtitle is specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * @type string $subtitle + * The subtitle of the card header. + * @type int $image_style + * The image's type (for example, square border or circular border). + * @type string $image_url + * The URL of the image in the card header. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\ContextualAddon::initOnce(); + parent::__construct($data); + } + + /** + * The title must be specified. The header has a fixed height: if both a + * title and subtitle is specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * + * Generated from protobuf field string title = 1; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The title must be specified. The header has a fixed height: if both a + * title and subtitle is specified, each takes up one line. If only the + * title is specified, it takes up both lines. + * + * Generated from protobuf field string title = 1; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The subtitle of the card header. + * + * Generated from protobuf field string subtitle = 2; + * @return string + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * The subtitle of the card header. + * + * Generated from protobuf field string subtitle = 2; + * @param string $var + * @return $this + */ + public function setSubtitle($var) + { + GPBUtil::checkString($var, True); + $this->subtitle = $var; + + return $this; + } + + /** + * The image's type (for example, square border or circular border). + * + * Generated from protobuf field .google.chat.v1.ContextualAddOnMarkup.Card.CardHeader.ImageStyle image_style = 3; + * @return int + */ + public function getImageStyle() + { + return $this->image_style; + } + + /** + * The image's type (for example, square border or circular border). + * + * Generated from protobuf field .google.chat.v1.ContextualAddOnMarkup.Card.CardHeader.ImageStyle image_style = 3; + * @param int $var + * @return $this + */ + public function setImageStyle($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card\CardHeader\ImageStyle::class); + $this->image_style = $var; + + return $this; + } + + /** + * The URL of the image in the card header. + * + * Generated from protobuf field string image_url = 4; + * @return string + */ + public function getImageUrl() + { + return $this->image_url; + } + + /** + * The URL of the image in the card header. + * + * Generated from protobuf field string image_url = 4; + * @param string $var + * @return $this + */ + public function setImageUrl($var) + { + GPBUtil::checkString($var, True); + $this->image_url = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardHeader/ImageStyle.php b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardHeader/ImageStyle.php new file mode 100644 index 000000000000..9c0d30510390 --- /dev/null +++ b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/CardHeader/ImageStyle.php @@ -0,0 +1,58 @@ +google.chat.v1.ContextualAddOnMarkup.Card.CardHeader.ImageStyle + */ +class ImageStyle +{ + /** + * Generated from protobuf enum IMAGE_STYLE_UNSPECIFIED = 0; + */ + const IMAGE_STYLE_UNSPECIFIED = 0; + /** + * Square border. + * + * Generated from protobuf enum IMAGE = 1; + */ + const IMAGE = 1; + /** + * Circular border. + * + * Generated from protobuf enum AVATAR = 2; + */ + const AVATAR = 2; + + private static $valueToName = [ + self::IMAGE_STYLE_UNSPECIFIED => 'IMAGE_STYLE_UNSPECIFIED', + self::IMAGE => 'IMAGE', + self::AVATAR => 'AVATAR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/Section.php b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/Section.php new file mode 100644 index 000000000000..e6039ce3f556 --- /dev/null +++ b/AppsChat/src/Chat/V1/ContextualAddOnMarkup/Card/Section.php @@ -0,0 +1,137 @@ +google.chat.v1.ContextualAddOnMarkup.Card.Section + */ +class Section extends \Google\Protobuf\Internal\Message +{ + /** + * The header of the section. Formatted text is + * supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string header = 1; + */ + protected $header = ''; + /** + * A section must contain at least one widget. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup widgets = 2; + */ + private $widgets; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $header + * The header of the section. Formatted text is + * supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * @type array<\Google\Apps\Chat\V1\WidgetMarkup>|\Google\Protobuf\Internal\RepeatedField $widgets + * A section must contain at least one widget. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\ContextualAddon::initOnce(); + parent::__construct($data); + } + + /** + * The header of the section. Formatted text is + * supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string header = 1; + * @return string + */ + public function getHeader() + { + return $this->header; + } + + /** + * The header of the section. Formatted text is + * supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string header = 1; + * @param string $var + * @return $this + */ + public function setHeader($var) + { + GPBUtil::checkString($var, True); + $this->header = $var; + + return $this; + } + + /** + * A section must contain at least one widget. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup widgets = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWidgets() + { + return $this->widgets; + } + + /** + * A section must contain at least one widget. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup widgets = 2; + * @param array<\Google\Apps\Chat\V1\WidgetMarkup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWidgets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\WidgetMarkup::class); + $this->widgets = $arr; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/CreateMembershipRequest.php b/AppsChat/src/Chat/V1/CreateMembershipRequest.php new file mode 100644 index 000000000000..49c50f44ed88 --- /dev/null +++ b/AppsChat/src/Chat/V1/CreateMembershipRequest.php @@ -0,0 +1,213 @@ +google.chat.v1.CreateMembershipRequest + */ +class CreateMembershipRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the space for which to create the + * membership. + * Format: spaces/{space} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The membership relation to create. + * The `memberType` field must contain a user with the `user.name` and + * `user.type` fields populated. The server will assign a resource name + * and overwrite anything specified. + * When a Chat app creates a membership relation for a human user, it must use + * the `chat.memberships` scope, set `user.type` to `HUMAN`, and set + * `user.name` with format `users/{user}`, where `{user}` can be the email + * address for the user. For users in the same Workspace organization `{user}` + * can also be the `id` of the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the user in the Directory API. For example, if + * the People API Person profile ID for `user@example.com` is `123456789`, you + * can add the user to the space by setting the `membership.member.name` to + * `users/user@example.com` or `users/123456789`. When a Chat app creates a + * membership relation for itself, it must use the `chat.memberships.app` + * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. + * + * Generated from protobuf field .google.chat.v1.Membership membership = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $membership = null; + + /** + * @param string $parent Required. The resource name of the space for which to create the + * membership. + * + * Format: spaces/{space} + * Please see {@see ChatServiceClient::spaceName()} for help formatting this field. + * @param \Google\Apps\Chat\V1\Membership $membership Required. The membership relation to create. + * The `memberType` field must contain a user with the `user.name` and + * `user.type` fields populated. The server will assign a resource name + * and overwrite anything specified. + * When a Chat app creates a membership relation for a human user, it must use + * the `chat.memberships` scope, set `user.type` to `HUMAN`, and set + * `user.name` with format `users/{user}`, where `{user}` can be the email + * address for the user. For users in the same Workspace organization `{user}` + * can also be the `id` of the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the user in the Directory API. For example, if + * the People API Person profile ID for `user@example.com` is `123456789`, you + * can add the user to the space by setting the `membership.member.name` to + * `users/user@example.com` or `users/123456789`. When a Chat app creates a + * membership relation for itself, it must use the `chat.memberships.app` + * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. + * + * @return \Google\Apps\Chat\V1\CreateMembershipRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Apps\Chat\V1\Membership $membership): self + { + return (new self()) + ->setParent($parent) + ->setMembership($membership); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the space for which to create the + * membership. + * Format: spaces/{space} + * @type \Google\Apps\Chat\V1\Membership $membership + * Required. The membership relation to create. + * The `memberType` field must contain a user with the `user.name` and + * `user.type` fields populated. The server will assign a resource name + * and overwrite anything specified. + * When a Chat app creates a membership relation for a human user, it must use + * the `chat.memberships` scope, set `user.type` to `HUMAN`, and set + * `user.name` with format `users/{user}`, where `{user}` can be the email + * address for the user. For users in the same Workspace organization `{user}` + * can also be the `id` of the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the user in the Directory API. For example, if + * the People API Person profile ID for `user@example.com` is `123456789`, you + * can add the user to the space by setting the `membership.member.name` to + * `users/user@example.com` or `users/123456789`. When a Chat app creates a + * membership relation for itself, it must use the `chat.memberships.app` + * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Membership::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the space for which to create the + * membership. + * Format: spaces/{space} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the space for which to create the + * membership. + * Format: spaces/{space} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The membership relation to create. + * The `memberType` field must contain a user with the `user.name` and + * `user.type` fields populated. The server will assign a resource name + * and overwrite anything specified. + * When a Chat app creates a membership relation for a human user, it must use + * the `chat.memberships` scope, set `user.type` to `HUMAN`, and set + * `user.name` with format `users/{user}`, where `{user}` can be the email + * address for the user. For users in the same Workspace organization `{user}` + * can also be the `id` of the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the user in the Directory API. For example, if + * the People API Person profile ID for `user@example.com` is `123456789`, you + * can add the user to the space by setting the `membership.member.name` to + * `users/user@example.com` or `users/123456789`. When a Chat app creates a + * membership relation for itself, it must use the `chat.memberships.app` + * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. + * + * Generated from protobuf field .google.chat.v1.Membership membership = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Membership|null + */ + public function getMembership() + { + return $this->membership; + } + + public function hasMembership() + { + return isset($this->membership); + } + + public function clearMembership() + { + unset($this->membership); + } + + /** + * Required. The membership relation to create. + * The `memberType` field must contain a user with the `user.name` and + * `user.type` fields populated. The server will assign a resource name + * and overwrite anything specified. + * When a Chat app creates a membership relation for a human user, it must use + * the `chat.memberships` scope, set `user.type` to `HUMAN`, and set + * `user.name` with format `users/{user}`, where `{user}` can be the email + * address for the user. For users in the same Workspace organization `{user}` + * can also be the `id` of the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the user in the Directory API. For example, if + * the People API Person profile ID for `user@example.com` is `123456789`, you + * can add the user to the space by setting the `membership.member.name` to + * `users/user@example.com` or `users/123456789`. When a Chat app creates a + * membership relation for itself, it must use the `chat.memberships.app` + * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. + * + * Generated from protobuf field .google.chat.v1.Membership membership = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Membership $var + * @return $this + */ + public function setMembership($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Membership::class); + $this->membership = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/CreateMessageRequest.php b/AppsChat/src/Chat/V1/CreateMessageRequest.php new file mode 100644 index 000000000000..e90a569bc416 --- /dev/null +++ b/AppsChat/src/Chat/V1/CreateMessageRequest.php @@ -0,0 +1,370 @@ +google.chat.v1.CreateMessageRequest + */ +class CreateMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the space in which to create a message. + * Format: `spaces/{space}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Message body. + * + * Generated from protobuf field .google.chat.v1.Message message = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $message = null; + /** + * Optional. Deprecated: Use + * [thread.thread_key][google.chat.v1.Thread.thread_key] instead. ID for the + * thread. Supports up to 4000 characters. To start or add to a thread, create + * a message and specify a `threadKey` or the + * [thread.name][google.chat.v1.Thread.name]. For example usage, see [Start or + * reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * + * Generated from protobuf field string thread_key = 6 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated + */ + protected $thread_key = ''; + /** + * Optional. A unique request ID for this message. Specifying an existing + * request ID returns the message created with that ID instead of creating a + * new message. + * + * Generated from protobuf field string request_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. Specifies whether a message starts a thread or replies to one. + * Only supported in named spaces. + * + * Generated from protobuf field .google.chat.v1.CreateMessageRequest.MessageReplyOption message_reply_option = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message_reply_option = 0; + /** + * Optional. A custom ID for a message. Lets Chat apps get, update, or delete + * a message without needing to store the system-assigned ID in the message's + * resource name (represented in the message `name` field). + * The value for this field must meet the following requirements: + * * Begins with `client-`. For example, `client-custom-name` is a valid + * custom ID, but `custom-name` is not. + * * Contains up to 63 characters and only lowercase letters, numbers, and + * hyphens. + * * Is unique within a space. A Chat app can't use the same custom ID for + * different messages. + * For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string message_id = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message_id = ''; + + /** + * @param string $parent Required. The resource name of the space in which to create a message. + * + * Format: `spaces/{space}` + * Please see {@see ChatServiceClient::spaceName()} for help formatting this field. + * @param \Google\Apps\Chat\V1\Message $message Required. Message body. + * @param string $messageId Optional. A custom ID for a message. Lets Chat apps get, update, or delete + * a message without needing to store the system-assigned ID in the message's + * resource name (represented in the message `name` field). + * + * The value for this field must meet the following requirements: + * + * * Begins with `client-`. For example, `client-custom-name` is a valid + * custom ID, but `custom-name` is not. + * * Contains up to 63 characters and only lowercase letters, numbers, and + * hyphens. + * * Is unique within a space. A Chat app can't use the same custom ID for + * different messages. + * + * For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * @return \Google\Apps\Chat\V1\CreateMessageRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Apps\Chat\V1\Message $message, string $messageId): self + { + return (new self()) + ->setParent($parent) + ->setMessage($message) + ->setMessageId($messageId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the space in which to create a message. + * Format: `spaces/{space}` + * @type \Google\Apps\Chat\V1\Message $message + * Required. Message body. + * @type string $thread_key + * Optional. Deprecated: Use + * [thread.thread_key][google.chat.v1.Thread.thread_key] instead. ID for the + * thread. Supports up to 4000 characters. To start or add to a thread, create + * a message and specify a `threadKey` or the + * [thread.name][google.chat.v1.Thread.name]. For example usage, see [Start or + * reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * @type string $request_id + * Optional. A unique request ID for this message. Specifying an existing + * request ID returns the message created with that ID instead of creating a + * new message. + * @type int $message_reply_option + * Optional. Specifies whether a message starts a thread or replies to one. + * Only supported in named spaces. + * @type string $message_id + * Optional. A custom ID for a message. Lets Chat apps get, update, or delete + * a message without needing to store the system-assigned ID in the message's + * resource name (represented in the message `name` field). + * The value for this field must meet the following requirements: + * * Begins with `client-`. For example, `client-custom-name` is a valid + * custom ID, but `custom-name` is not. + * * Contains up to 63 characters and only lowercase letters, numbers, and + * hyphens. + * * Is unique within a space. A Chat app can't use the same custom ID for + * different messages. + * For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the space in which to create a message. + * Format: `spaces/{space}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the space in which to create a message. + * Format: `spaces/{space}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Message body. + * + * Generated from protobuf field .google.chat.v1.Message message = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Message|null + */ + public function getMessage() + { + return $this->message; + } + + public function hasMessage() + { + return isset($this->message); + } + + public function clearMessage() + { + unset($this->message); + } + + /** + * Required. Message body. + * + * Generated from protobuf field .google.chat.v1.Message message = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Message $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Message::class); + $this->message = $var; + + return $this; + } + + /** + * Optional. Deprecated: Use + * [thread.thread_key][google.chat.v1.Thread.thread_key] instead. ID for the + * thread. Supports up to 4000 characters. To start or add to a thread, create + * a message and specify a `threadKey` or the + * [thread.name][google.chat.v1.Thread.name]. For example usage, see [Start or + * reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * + * Generated from protobuf field string thread_key = 6 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @return string + * @deprecated + */ + public function getThreadKey() + { + @trigger_error('thread_key is deprecated.', E_USER_DEPRECATED); + return $this->thread_key; + } + + /** + * Optional. Deprecated: Use + * [thread.thread_key][google.chat.v1.Thread.thread_key] instead. ID for the + * thread. Supports up to 4000 characters. To start or add to a thread, create + * a message and specify a `threadKey` or the + * [thread.name][google.chat.v1.Thread.name]. For example usage, see [Start or + * reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * + * Generated from protobuf field string thread_key = 6 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + * @deprecated + */ + public function setThreadKey($var) + { + @trigger_error('thread_key is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->thread_key = $var; + + return $this; + } + + /** + * Optional. A unique request ID for this message. Specifying an existing + * request ID returns the message created with that ID instead of creating a + * new message. + * + * Generated from protobuf field string request_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique request ID for this message. Specifying an existing + * request ID returns the message created with that ID instead of creating a + * new message. + * + * Generated from protobuf field string request_id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. Specifies whether a message starts a thread or replies to one. + * Only supported in named spaces. + * + * Generated from protobuf field .google.chat.v1.CreateMessageRequest.MessageReplyOption message_reply_option = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMessageReplyOption() + { + return $this->message_reply_option; + } + + /** + * Optional. Specifies whether a message starts a thread or replies to one. + * Only supported in named spaces. + * + * Generated from protobuf field .google.chat.v1.CreateMessageRequest.MessageReplyOption message_reply_option = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMessageReplyOption($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\CreateMessageRequest\MessageReplyOption::class); + $this->message_reply_option = $var; + + return $this; + } + + /** + * Optional. A custom ID for a message. Lets Chat apps get, update, or delete + * a message without needing to store the system-assigned ID in the message's + * resource name (represented in the message `name` field). + * The value for this field must meet the following requirements: + * * Begins with `client-`. For example, `client-custom-name` is a valid + * custom ID, but `custom-name` is not. + * * Contains up to 63 characters and only lowercase letters, numbers, and + * hyphens. + * * Is unique within a space. A Chat app can't use the same custom ID for + * different messages. + * For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string message_id = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMessageId() + { + return $this->message_id; + } + + /** + * Optional. A custom ID for a message. Lets Chat apps get, update, or delete + * a message without needing to store the system-assigned ID in the message's + * resource name (represented in the message `name` field). + * The value for this field must meet the following requirements: + * * Begins with `client-`. For example, `client-custom-name` is a valid + * custom ID, but `custom-name` is not. + * * Contains up to 63 characters and only lowercase letters, numbers, and + * hyphens. + * * Is unique within a space. A Chat app can't use the same custom ID for + * different messages. + * For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string message_id = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMessageId($var) + { + GPBUtil::checkString($var, True); + $this->message_id = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/CreateMessageRequest/MessageReplyOption.php b/AppsChat/src/Chat/V1/CreateMessageRequest/MessageReplyOption.php new file mode 100644 index 000000000000..64d70a2fad81 --- /dev/null +++ b/AppsChat/src/Chat/V1/CreateMessageRequest/MessageReplyOption.php @@ -0,0 +1,72 @@ +google.chat.v1.CreateMessageRequest.MessageReplyOption + */ +class MessageReplyOption +{ + /** + * Default. Starts a new thread. Using this option ignores any [thread + * ID][google.chat.v1.Thread.name] or + * [`thread_key`][google.chat.v1.Thread.thread_key] that's included. + * + * Generated from protobuf enum MESSAGE_REPLY_OPTION_UNSPECIFIED = 0; + */ + const MESSAGE_REPLY_OPTION_UNSPECIFIED = 0; + /** + * Creates the message as a reply to the thread specified by [thread + * ID][google.chat.v1.Thread.name] or + * [`thread_key`][google.chat.v1.Thread.thread_key]. If it fails, the + * message starts a new thread instead. + * + * Generated from protobuf enum REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD = 1; + */ + const REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD = 1; + /** + * Creates the message as a reply to the thread specified by [thread + * ID][google.chat.v1.Thread.name] or + * [`thread_key`][google.chat.v1.Thread.thread_key]. If a new `thread_key` + * is used, a new thread is created. If the message creation fails, a + * `NOT_FOUND` error is returned instead. + * + * Generated from protobuf enum REPLY_MESSAGE_OR_FAIL = 2; + */ + const REPLY_MESSAGE_OR_FAIL = 2; + + private static $valueToName = [ + self::MESSAGE_REPLY_OPTION_UNSPECIFIED => 'MESSAGE_REPLY_OPTION_UNSPECIFIED', + self::REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD => 'REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD', + self::REPLY_MESSAGE_OR_FAIL => 'REPLY_MESSAGE_OR_FAIL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/CreateReactionRequest.php b/AppsChat/src/Chat/V1/CreateReactionRequest.php new file mode 100644 index 000000000000..97555cae7e06 --- /dev/null +++ b/AppsChat/src/Chat/V1/CreateReactionRequest.php @@ -0,0 +1,133 @@ +google.chat.v1.CreateReactionRequest + */ +class CreateReactionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The message where the reaction is created. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The reaction to create. + * + * Generated from protobuf field .google.chat.v1.Reaction reaction = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $reaction = null; + + /** + * @param string $parent Required. The message where the reaction is created. + * + * Format: `spaces/{space}/messages/{message}` + * Please see {@see ChatServiceClient::messageName()} for help formatting this field. + * @param \Google\Apps\Chat\V1\Reaction $reaction Required. The reaction to create. + * + * @return \Google\Apps\Chat\V1\CreateReactionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Apps\Chat\V1\Reaction $reaction): self + { + return (new self()) + ->setParent($parent) + ->setReaction($reaction); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The message where the reaction is created. + * Format: `spaces/{space}/messages/{message}` + * @type \Google\Apps\Chat\V1\Reaction $reaction + * Required. The reaction to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * Required. The message where the reaction is created. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The message where the reaction is created. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The reaction to create. + * + * Generated from protobuf field .google.chat.v1.Reaction reaction = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Reaction|null + */ + public function getReaction() + { + return $this->reaction; + } + + public function hasReaction() + { + return isset($this->reaction); + } + + public function clearReaction() + { + unset($this->reaction); + } + + /** + * Required. The reaction to create. + * + * Generated from protobuf field .google.chat.v1.Reaction reaction = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Reaction $var + * @return $this + */ + public function setReaction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Reaction::class); + $this->reaction = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/CreateSpaceRequest.php b/AppsChat/src/Chat/V1/CreateSpaceRequest.php new file mode 100644 index 000000000000..6de66b3cff27 --- /dev/null +++ b/AppsChat/src/Chat/V1/CreateSpaceRequest.php @@ -0,0 +1,176 @@ +google.chat.v1.CreateSpaceRequest + */ +class CreateSpaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `displayName` and `spaceType` fields must be populated. Only + * `SpaceType.SPACE` is supported. + * If you receive the error message `ALREADY_EXISTS` when creating a space, + * try a different `displayName`. An existing space within the Google + * Workspace organization might already use this display name. + * The space `name` is assigned on the server so anything specified in this + * field will be ignored. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $space = null; + /** + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Apps\Chat\V1\Space $space Required. The `displayName` and `spaceType` fields must be populated. Only + * `SpaceType.SPACE` is supported. + * + * If you receive the error message `ALREADY_EXISTS` when creating a space, + * try a different `displayName`. An existing space within the Google + * Workspace organization might already use this display name. + * + * The space `name` is assigned on the server so anything specified in this + * field will be ignored. + * + * @return \Google\Apps\Chat\V1\CreateSpaceRequest + * + * @experimental + */ + public static function build(\Google\Apps\Chat\V1\Space $space): self + { + return (new self()) + ->setSpace($space); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Space $space + * Required. The `displayName` and `spaceType` fields must be populated. Only + * `SpaceType.SPACE` is supported. + * If you receive the error message `ALREADY_EXISTS` when creating a space, + * try a different `displayName`. An existing space within the Google + * Workspace organization might already use this display name. + * The space `name` is assigned on the server so anything specified in this + * field will be ignored. + * @type string $request_id + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `displayName` and `spaceType` fields must be populated. Only + * `SpaceType.SPACE` is supported. + * If you receive the error message `ALREADY_EXISTS` when creating a space, + * try a different `displayName`. An existing space within the Google + * Workspace organization might already use this display name. + * The space `name` is assigned on the server so anything specified in this + * field will be ignored. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Space|null + */ + public function getSpace() + { + return $this->space; + } + + public function hasSpace() + { + return isset($this->space); + } + + public function clearSpace() + { + unset($this->space); + } + + /** + * Required. The `displayName` and `spaceType` fields must be populated. Only + * `SpaceType.SPACE` is supported. + * If you receive the error message `ALREADY_EXISTS` when creating a space, + * try a different `displayName`. An existing space within the Google + * Workspace organization might already use this display name. + * The space `name` is assigned on the server so anything specified in this + * field will be ignored. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Space $var + * @return $this + */ + public function setSpace($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Space::class); + $this->space = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/CustomEmoji.php b/AppsChat/src/Chat/V1/CustomEmoji.php new file mode 100644 index 000000000000..3b3f7b630a5e --- /dev/null +++ b/AppsChat/src/Chat/V1/CustomEmoji.php @@ -0,0 +1,67 @@ +google.chat.v1.CustomEmoji + */ +class CustomEmoji extends \Google\Protobuf\Internal\Message +{ + /** + * Unique key for the custom emoji resource. + * + * Generated from protobuf field string uid = 1; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uid + * Unique key for the custom emoji resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * Unique key for the custom emoji resource. + * + * Generated from protobuf field string uid = 1; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Unique key for the custom emoji resource. + * + * Generated from protobuf field string uid = 1; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DeleteMembershipRequest.php b/AppsChat/src/Chat/V1/DeleteMembershipRequest.php new file mode 100644 index 000000000000..9861837902c8 --- /dev/null +++ b/AppsChat/src/Chat/V1/DeleteMembershipRequest.php @@ -0,0 +1,134 @@ +google.chat.v1.DeleteMembershipRequest + */ +class DeleteMembershipRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the membership to delete. Chat apps can delete + * human users' or their own memberships. Chat apps can't delete other apps' + * memberships. + * When deleting a human membership, requires the `chat.memberships` scope and + * `spaces/{space}/members/{member}` format. You can use the email as an + * alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * When deleting an app membership, requires the `chat.memberships.app` scope + * and `spaces/{space}/members/app` format. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the membership to delete. Chat apps can delete + * human users' or their own memberships. Chat apps can't delete other apps' + * memberships. + * + * When deleting a human membership, requires the `chat.memberships` scope and + * `spaces/{space}/members/{member}` format. You can use the email as an + * alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * + * When deleting an app membership, requires the `chat.memberships.app` scope + * and `spaces/{space}/members/app` format. + * + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. Please see + * {@see ChatServiceClient::membershipName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\DeleteMembershipRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the membership to delete. Chat apps can delete + * human users' or their own memberships. Chat apps can't delete other apps' + * memberships. + * When deleting a human membership, requires the `chat.memberships` scope and + * `spaces/{space}/members/{member}` format. You can use the email as an + * alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * When deleting an app membership, requires the `chat.memberships.app` scope + * and `spaces/{space}/members/app` format. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Membership::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the membership to delete. Chat apps can delete + * human users' or their own memberships. Chat apps can't delete other apps' + * memberships. + * When deleting a human membership, requires the `chat.memberships` scope and + * `spaces/{space}/members/{member}` format. You can use the email as an + * alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * When deleting an app membership, requires the `chat.memberships.app` scope + * and `spaces/{space}/members/app` format. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the membership to delete. Chat apps can delete + * human users' or their own memberships. Chat apps can't delete other apps' + * memberships. + * When deleting a human membership, requires the `chat.memberships` scope and + * `spaces/{space}/members/{member}` format. You can use the email as an + * alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * When deleting an app membership, requires the `chat.memberships.app` scope + * and `spaces/{space}/members/app` format. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DeleteMessageRequest.php b/AppsChat/src/Chat/V1/DeleteMessageRequest.php new file mode 100644 index 000000000000..37cb2a3434f7 --- /dev/null +++ b/AppsChat/src/Chat/V1/DeleteMessageRequest.php @@ -0,0 +1,162 @@ +google.chat.v1.DeleteMessageRequest + */ +class DeleteMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * When `true`, deleting a message also deletes its threaded replies. When + * `false`, if a message has threaded replies, deletion fails. + * Only applies when [authenticating as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * Has no effect when [authenticating as a Chat app] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * @param string $name Required. Resource name of the message. + * + * Format: `spaces/{space}/messages/{message}` + * + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). Please see + * {@see ChatServiceClient::messageName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\DeleteMessageRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * @type bool $force + * When `true`, deleting a message also deletes its threaded replies. When + * `false`, if a message has threaded replies, deletion fails. + * Only applies when [authenticating as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * Has no effect when [authenticating as a Chat app] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * When `true`, deleting a message also deletes its threaded replies. When + * `false`, if a message has threaded replies, deletion fails. + * Only applies when [authenticating as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * Has no effect when [authenticating as a Chat app] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * When `true`, deleting a message also deletes its threaded replies. When + * `false`, if a message has threaded replies, deletion fails. + * Only applies when [authenticating as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * Has no effect when [authenticating as a Chat app] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DeleteReactionRequest.php b/AppsChat/src/Chat/V1/DeleteReactionRequest.php new file mode 100644 index 000000000000..c7557ad1c0e4 --- /dev/null +++ b/AppsChat/src/Chat/V1/DeleteReactionRequest.php @@ -0,0 +1,87 @@ +google.chat.v1.DeleteReactionRequest + */ +class DeleteReactionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the reaction to delete. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the reaction to delete. + * + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * Please see {@see ChatServiceClient::reactionName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\DeleteReactionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the reaction to delete. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the reaction to delete. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the reaction to delete. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DeleteSpaceRequest.php b/AppsChat/src/Chat/V1/DeleteSpaceRequest.php new file mode 100644 index 000000000000..62c7dedb9781 --- /dev/null +++ b/AppsChat/src/Chat/V1/DeleteSpaceRequest.php @@ -0,0 +1,87 @@ +google.chat.v1.DeleteSpaceRequest + */ +class DeleteSpaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the space to delete. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the space to delete. + * + * Format: `spaces/{space}` + * Please see {@see ChatServiceClient::spaceName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\DeleteSpaceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the space to delete. + * Format: `spaces/{space}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the space to delete. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the space to delete. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DeletionMetadata.php b/AppsChat/src/Chat/V1/DeletionMetadata.php new file mode 100644 index 000000000000..cd50e1dc6aa7 --- /dev/null +++ b/AppsChat/src/Chat/V1/DeletionMetadata.php @@ -0,0 +1,68 @@ +google.chat.v1.DeletionMetadata + */ +class DeletionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates who deleted the message. + * + * Generated from protobuf field .google.chat.v1.DeletionMetadata.DeletionType deletion_type = 1; + */ + protected $deletion_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $deletion_type + * Indicates who deleted the message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\DeletionMetadata::initOnce(); + parent::__construct($data); + } + + /** + * Indicates who deleted the message. + * + * Generated from protobuf field .google.chat.v1.DeletionMetadata.DeletionType deletion_type = 1; + * @return int + */ + public function getDeletionType() + { + return $this->deletion_type; + } + + /** + * Indicates who deleted the message. + * + * Generated from protobuf field .google.chat.v1.DeletionMetadata.DeletionType deletion_type = 1; + * @param int $var + * @return $this + */ + public function setDeletionType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\DeletionMetadata\DeletionType::class); + $this->deletion_type = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DeletionMetadata/DeletionType.php b/AppsChat/src/Chat/V1/DeletionMetadata/DeletionType.php new file mode 100644 index 000000000000..ac33dde93590 --- /dev/null +++ b/AppsChat/src/Chat/V1/DeletionMetadata/DeletionType.php @@ -0,0 +1,90 @@ +google.chat.v1.DeletionMetadata.DeletionType + */ +class DeletionType +{ + /** + * This value is unused. + * + * Generated from protobuf enum DELETION_TYPE_UNSPECIFIED = 0; + */ + const DELETION_TYPE_UNSPECIFIED = 0; + /** + * User deleted their own message. + * + * Generated from protobuf enum CREATOR = 1; + */ + const CREATOR = 1; + /** + * The space owner deleted the message. + * + * Generated from protobuf enum SPACE_OWNER = 2; + */ + const SPACE_OWNER = 2; + /** + * A Google Workspace admin deleted the message. + * + * Generated from protobuf enum ADMIN = 3; + */ + const ADMIN = 3; + /** + * A Chat app deleted its own message when it expired. + * + * Generated from protobuf enum APP_MESSAGE_EXPIRY = 4; + */ + const APP_MESSAGE_EXPIRY = 4; + /** + * A Chat app deleted the message on behalf of the user. + * + * Generated from protobuf enum CREATOR_VIA_APP = 5; + */ + const CREATOR_VIA_APP = 5; + /** + * A Chat app deleted the message on behalf of the space owner. + * + * Generated from protobuf enum SPACE_OWNER_VIA_APP = 6; + */ + const SPACE_OWNER_VIA_APP = 6; + + private static $valueToName = [ + self::DELETION_TYPE_UNSPECIFIED => 'DELETION_TYPE_UNSPECIFIED', + self::CREATOR => 'CREATOR', + self::SPACE_OWNER => 'SPACE_OWNER', + self::ADMIN => 'ADMIN', + self::APP_MESSAGE_EXPIRY => 'APP_MESSAGE_EXPIRY', + self::CREATOR_VIA_APP => 'CREATOR_VIA_APP', + self::SPACE_OWNER_VIA_APP => 'SPACE_OWNER_VIA_APP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Dialog.php b/AppsChat/src/Chat/V1/Dialog.php new file mode 100644 index 000000000000..86434601a751 --- /dev/null +++ b/AppsChat/src/Chat/V1/Dialog.php @@ -0,0 +1,85 @@ +google.chat.v1.Dialog + */ +class Dialog extends \Google\Protobuf\Internal\Message +{ + /** + * Input only. Body of the dialog, which is rendered in a modal. + * Google Chat apps don't support the following card entities: + * `DateTimePicker`, `OnChangeAction`. + * + * Generated from protobuf field .google.apps.card.v1.Card body = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $body = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Card\V1\Card $body + * Input only. Body of the dialog, which is rendered in a modal. + * Google Chat apps don't support the following card entities: + * `DateTimePicker`, `OnChangeAction`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Input only. Body of the dialog, which is rendered in a modal. + * Google Chat apps don't support the following card entities: + * `DateTimePicker`, `OnChangeAction`. + * + * Generated from protobuf field .google.apps.card.v1.Card body = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Apps\Card\V1\Card|null + */ + public function getBody() + { + return $this->body; + } + + public function hasBody() + { + return isset($this->body); + } + + public function clearBody() + { + unset($this->body); + } + + /** + * Input only. Body of the dialog, which is rendered in a modal. + * Google Chat apps don't support the following card entities: + * `DateTimePicker`, `OnChangeAction`. + * + * Generated from protobuf field .google.apps.card.v1.Card body = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Apps\Card\V1\Card $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Card\V1\Card::class); + $this->body = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DialogAction.php b/AppsChat/src/Chat/V1/DialogAction.php new file mode 100644 index 000000000000..381110a1278f --- /dev/null +++ b/AppsChat/src/Chat/V1/DialogAction.php @@ -0,0 +1,139 @@ +google.chat.v1.DialogAction + */ +class DialogAction extends \Google\Protobuf\Internal\Message +{ + /** + * Input only. Status for a request to either invoke or submit a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Displays + * a status and message to users, if necessary. + * For example, in case of an error or success. + * + * Generated from protobuf field .google.chat.v1.ActionStatus action_status = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $action_status = null; + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Dialog $dialog + * Input only. + * [Dialog](https://developers.google.com/workspace/chat/dialogs) for the + * request. + * @type \Google\Apps\Chat\V1\ActionStatus $action_status + * Input only. Status for a request to either invoke or submit a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Displays + * a status and message to users, if necessary. + * For example, in case of an error or success. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Input only. + * [Dialog](https://developers.google.com/workspace/chat/dialogs) for the + * request. + * + * Generated from protobuf field .google.chat.v1.Dialog dialog = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Apps\Chat\V1\Dialog|null + */ + public function getDialog() + { + return $this->readOneof(1); + } + + public function hasDialog() + { + return $this->hasOneof(1); + } + + /** + * Input only. + * [Dialog](https://developers.google.com/workspace/chat/dialogs) for the + * request. + * + * Generated from protobuf field .google.chat.v1.Dialog dialog = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Apps\Chat\V1\Dialog $var + * @return $this + */ + public function setDialog($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Dialog::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Input only. Status for a request to either invoke or submit a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Displays + * a status and message to users, if necessary. + * For example, in case of an error or success. + * + * Generated from protobuf field .google.chat.v1.ActionStatus action_status = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Apps\Chat\V1\ActionStatus|null + */ + public function getActionStatus() + { + return $this->action_status; + } + + public function hasActionStatus() + { + return isset($this->action_status); + } + + public function clearActionStatus() + { + unset($this->action_status); + } + + /** + * Input only. Status for a request to either invoke or submit a + * [dialog](https://developers.google.com/workspace/chat/dialogs). Displays + * a status and message to users, if necessary. + * For example, in case of an error or success. + * + * Generated from protobuf field .google.chat.v1.ActionStatus action_status = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Apps\Chat\V1\ActionStatus $var + * @return $this + */ + public function setActionStatus($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\ActionStatus::class); + $this->action_status = $var; + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/AppsChat/src/Chat/V1/DriveDataRef.php b/AppsChat/src/Chat/V1/DriveDataRef.php new file mode 100644 index 000000000000..9c6bf3e9e6b9 --- /dev/null +++ b/AppsChat/src/Chat/V1/DriveDataRef.php @@ -0,0 +1,67 @@ +google.chat.v1.DriveDataRef + */ +class DriveDataRef extends \Google\Protobuf\Internal\Message +{ + /** + * The ID for the drive file. Use with the Drive API. + * + * Generated from protobuf field string drive_file_id = 2; + */ + protected $drive_file_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $drive_file_id + * The ID for the drive file. Use with the Drive API. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Attachment::initOnce(); + parent::__construct($data); + } + + /** + * The ID for the drive file. Use with the Drive API. + * + * Generated from protobuf field string drive_file_id = 2; + * @return string + */ + public function getDriveFileId() + { + return $this->drive_file_id; + } + + /** + * The ID for the drive file. Use with the Drive API. + * + * Generated from protobuf field string drive_file_id = 2; + * @param string $var + * @return $this + */ + public function setDriveFileId($var) + { + GPBUtil::checkString($var, True); + $this->drive_file_id = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/DriveLinkData.php b/AppsChat/src/Chat/V1/DriveLinkData.php new file mode 100644 index 000000000000..f27cfb2631df --- /dev/null +++ b/AppsChat/src/Chat/V1/DriveLinkData.php @@ -0,0 +1,119 @@ +google.chat.v1.DriveLinkData + */ +class DriveLinkData extends \Google\Protobuf\Internal\Message +{ + /** + * A + * [DriveDataRef](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#drivedataref) + * which references a Google Drive file. + * + * Generated from protobuf field .google.chat.v1.DriveDataRef drive_data_ref = 1; + */ + protected $drive_data_ref = null; + /** + * The mime type of the linked Google Drive resource. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\DriveDataRef $drive_data_ref + * A + * [DriveDataRef](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#drivedataref) + * which references a Google Drive file. + * @type string $mime_type + * The mime type of the linked Google Drive resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Annotation::initOnce(); + parent::__construct($data); + } + + /** + * A + * [DriveDataRef](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#drivedataref) + * which references a Google Drive file. + * + * Generated from protobuf field .google.chat.v1.DriveDataRef drive_data_ref = 1; + * @return \Google\Apps\Chat\V1\DriveDataRef|null + */ + public function getDriveDataRef() + { + return $this->drive_data_ref; + } + + public function hasDriveDataRef() + { + return isset($this->drive_data_ref); + } + + public function clearDriveDataRef() + { + unset($this->drive_data_ref); + } + + /** + * A + * [DriveDataRef](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#drivedataref) + * which references a Google Drive file. + * + * Generated from protobuf field .google.chat.v1.DriveDataRef drive_data_ref = 1; + * @param \Google\Apps\Chat\V1\DriveDataRef $var + * @return $this + */ + public function setDriveDataRef($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\DriveDataRef::class); + $this->drive_data_ref = $var; + + return $this; + } + + /** + * The mime type of the linked Google Drive resource. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * The mime type of the linked Google Drive resource. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Emoji.php b/AppsChat/src/Chat/V1/Emoji.php new file mode 100644 index 000000000000..c4efb005ee19 --- /dev/null +++ b/AppsChat/src/Chat/V1/Emoji.php @@ -0,0 +1,108 @@ +google.chat.v1.Emoji + */ +class Emoji extends \Google\Protobuf\Internal\Message +{ + protected $content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $unicode + * A basic emoji represented by a unicode string. + * @type \Google\Apps\Chat\V1\CustomEmoji $custom_emoji + * Output only. A custom emoji. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * A basic emoji represented by a unicode string. + * + * Generated from protobuf field string unicode = 1; + * @return string + */ + public function getUnicode() + { + return $this->readOneof(1); + } + + public function hasUnicode() + { + return $this->hasOneof(1); + } + + /** + * A basic emoji represented by a unicode string. + * + * Generated from protobuf field string unicode = 1; + * @param string $var + * @return $this + */ + public function setUnicode($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Output only. A custom emoji. + * + * Generated from protobuf field .google.chat.v1.CustomEmoji custom_emoji = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\CustomEmoji|null + */ + public function getCustomEmoji() + { + return $this->readOneof(2); + } + + public function hasCustomEmoji() + { + return $this->hasOneof(2); + } + + /** + * Output only. A custom emoji. + * + * Generated from protobuf field .google.chat.v1.CustomEmoji custom_emoji = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\CustomEmoji $var + * @return $this + */ + public function setCustomEmoji($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\CustomEmoji::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + return $this->whichOneof("content"); + } + +} + diff --git a/AppsChat/src/Chat/V1/EmojiReactionSummary.php b/AppsChat/src/Chat/V1/EmojiReactionSummary.php new file mode 100644 index 000000000000..c607da712f81 --- /dev/null +++ b/AppsChat/src/Chat/V1/EmojiReactionSummary.php @@ -0,0 +1,121 @@ +google.chat.v1.EmojiReactionSummary + */ +class EmojiReactionSummary extends \Google\Protobuf\Internal\Message +{ + /** + * Emoji associated with the reactions. + * + * Generated from protobuf field .google.chat.v1.Emoji emoji = 1; + */ + protected $emoji = null; + /** + * The total number of reactions using the associated emoji. + * + * Generated from protobuf field optional int32 reaction_count = 2; + */ + protected $reaction_count = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Emoji $emoji + * Emoji associated with the reactions. + * @type int $reaction_count + * The total number of reactions using the associated emoji. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * Emoji associated with the reactions. + * + * Generated from protobuf field .google.chat.v1.Emoji emoji = 1; + * @return \Google\Apps\Chat\V1\Emoji|null + */ + public function getEmoji() + { + return $this->emoji; + } + + public function hasEmoji() + { + return isset($this->emoji); + } + + public function clearEmoji() + { + unset($this->emoji); + } + + /** + * Emoji associated with the reactions. + * + * Generated from protobuf field .google.chat.v1.Emoji emoji = 1; + * @param \Google\Apps\Chat\V1\Emoji $var + * @return $this + */ + public function setEmoji($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Emoji::class); + $this->emoji = $var; + + return $this; + } + + /** + * The total number of reactions using the associated emoji. + * + * Generated from protobuf field optional int32 reaction_count = 2; + * @return int + */ + public function getReactionCount() + { + return isset($this->reaction_count) ? $this->reaction_count : 0; + } + + public function hasReactionCount() + { + return isset($this->reaction_count); + } + + public function clearReactionCount() + { + unset($this->reaction_count); + } + + /** + * The total number of reactions using the associated emoji. + * + * Generated from protobuf field optional int32 reaction_count = 2; + * @param int $var + * @return $this + */ + public function setReactionCount($var) + { + GPBUtil::checkInt32($var); + $this->reaction_count = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/FindDirectMessageRequest.php b/AppsChat/src/Chat/V1/FindDirectMessageRequest.php new file mode 100644 index 000000000000..d8347a58af0b --- /dev/null +++ b/AppsChat/src/Chat/V1/FindDirectMessageRequest.php @@ -0,0 +1,111 @@ +google.chat.v1.FindDirectMessageRequest + */ +class FindDirectMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the user to find direct message with. + * Format: `users/{user}`, where `{user}` is either the `id` for the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Directory API. For example, if the People API profile ID is + * `123456789`, you can find a direct message with that person by using + * `users/123456789` as the `name`. When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the email as an alias for `{user}`. For example, + * `users/example@gmail.com` where `example@gmail.com` is the email of the + * Google Chat user. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the user to find direct message with. + * Format: `users/{user}`, where `{user}` is either the `id` for the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Directory API. For example, if the People API profile ID is + * `123456789`, you can find a direct message with that person by using + * `users/123456789` as the `name`. When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the email as an alias for `{user}`. For example, + * `users/example@gmail.com` where `example@gmail.com` is the email of the + * Google Chat user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the user to find direct message with. + * Format: `users/{user}`, where `{user}` is either the `id` for the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Directory API. For example, if the People API profile ID is + * `123456789`, you can find a direct message with that person by using + * `users/123456789` as the `name`. When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the email as an alias for `{user}`. For example, + * `users/example@gmail.com` where `example@gmail.com` is the email of the + * Google Chat user. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the user to find direct message with. + * Format: `users/{user}`, where `{user}` is either the `id` for the + * [person](https://developers.google.com/people/api/rest/v1/people) from the + * People API, or the `id` for the + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Directory API. For example, if the People API profile ID is + * `123456789`, you can find a direct message with that person by using + * `users/123456789` as the `name`. When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the email as an alias for `{user}`. For example, + * `users/example@gmail.com` where `example@gmail.com` is the email of the + * Google Chat user. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/GetAttachmentRequest.php b/AppsChat/src/Chat/V1/GetAttachmentRequest.php new file mode 100644 index 000000000000..85bd441331c2 --- /dev/null +++ b/AppsChat/src/Chat/V1/GetAttachmentRequest.php @@ -0,0 +1,86 @@ +google.chat.v1.GetAttachmentRequest + */ +class GetAttachmentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. Please see + * {@see ChatServiceClient::attachmentName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\GetAttachmentRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Attachment::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the attachment, in the form + * `spaces/*/messages/*/attachments/*`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/GetMembershipRequest.php b/AppsChat/src/Chat/V1/GetMembershipRequest.php new file mode 100644 index 000000000000..bd46f59d7711 --- /dev/null +++ b/AppsChat/src/Chat/V1/GetMembershipRequest.php @@ -0,0 +1,124 @@ +google.chat.v1.GetMembershipRequest + */ +class GetMembershipRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the membership to retrieve. + * To get the app's own membership, you can optionally use + * `spaces/{space}/members/app`. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` + * When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the user's email as an alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the membership to retrieve. + * + * To get the app's own membership, you can optionally use + * `spaces/{space}/members/app`. + * + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` + * + * When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the user's email as an alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. Please see + * {@see ChatServiceClient::membershipName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\GetMembershipRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the membership to retrieve. + * To get the app's own membership, you can optionally use + * `spaces/{space}/members/app`. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` + * When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the user's email as an alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Membership::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the membership to retrieve. + * To get the app's own membership, you can optionally use + * `spaces/{space}/members/app`. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` + * When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the user's email as an alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the membership to retrieve. + * To get the app's own membership, you can optionally use + * `spaces/{space}/members/app`. + * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app` + * When [authenticated as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * you can use the user's email as an alias for `{member}`. For example, + * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the + * email of the Google Chat user. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/GetMessageRequest.php b/AppsChat/src/Chat/V1/GetMessageRequest.php new file mode 100644 index 000000000000..99403d2bead6 --- /dev/null +++ b/AppsChat/src/Chat/V1/GetMessageRequest.php @@ -0,0 +1,108 @@ +google.chat.v1.GetMessageRequest + */ +class GetMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the message. + * + * Format: `spaces/{space}/messages/{message}` + * + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). Please see + * {@see ChatServiceClient::messageName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\GetMessageRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * If you've set a custom ID for your message, you can use the value from the + * `clientAssignedMessageId` field for `{message}`. For details, see [Name a + * message] + * (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/GetSpaceRequest.php b/AppsChat/src/Chat/V1/GetSpaceRequest.php new file mode 100644 index 000000000000..834cb7758444 --- /dev/null +++ b/AppsChat/src/Chat/V1/GetSpaceRequest.php @@ -0,0 +1,87 @@ +google.chat.v1.GetSpaceRequest + */ +class GetSpaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the space, in the form "spaces/*". + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the space, in the form "spaces/*". + * + * Format: `spaces/{space}` + * Please see {@see ChatServiceClient::spaceName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\GetSpaceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the space, in the form "spaces/*". + * Format: `spaces/{space}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the space, in the form "spaces/*". + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the space, in the form "spaces/*". + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Group.php b/AppsChat/src/Chat/V1/Group.php new file mode 100644 index 000000000000..abd3dff79c75 --- /dev/null +++ b/AppsChat/src/Chat/V1/Group.php @@ -0,0 +1,83 @@ +google.chat.v1.Group + */ +class Group extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name for a Google Group. + * Represents a + * [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in + * Cloud Identity Groups API. + * Format: groups/{group} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name for a Google Group. + * Represents a + * [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in + * Cloud Identity Groups API. + * Format: groups/{group} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Group::initOnce(); + parent::__construct($data); + } + + /** + * Resource name for a Google Group. + * Represents a + * [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in + * Cloud Identity Groups API. + * Format: groups/{group} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name for a Google Group. + * Represents a + * [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in + * Cloud Identity Groups API. + * Format: groups/{group} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/HistoryState.php b/AppsChat/src/Chat/V1/HistoryState.php new file mode 100644 index 000000000000..2dadcbc53b5f --- /dev/null +++ b/AppsChat/src/Chat/V1/HistoryState.php @@ -0,0 +1,65 @@ +google.chat.v1.HistoryState + */ +class HistoryState +{ + /** + * Default value. Do not use. + * + * Generated from protobuf enum HISTORY_STATE_UNSPECIFIED = 0; + */ + const HISTORY_STATE_UNSPECIFIED = 0; + /** + * History off. [Messages and threads are kept for 24 + * hours](https://support.google.com/chat/answer/7664687). + * + * Generated from protobuf enum HISTORY_OFF = 1; + */ + const HISTORY_OFF = 1; + /** + * History on. The organization's [Vault retention + * rules](https://support.google.com/vault/answer/7657597) specify for + * how long messages and threads are kept. + * + * Generated from protobuf enum HISTORY_ON = 2; + */ + const HISTORY_ON = 2; + + private static $valueToName = [ + self::HISTORY_STATE_UNSPECIFIED => 'HISTORY_STATE_UNSPECIFIED', + self::HISTORY_OFF => 'HISTORY_OFF', + self::HISTORY_ON => 'HISTORY_ON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/AppsChat/src/Chat/V1/ListMembershipsRequest.php b/AppsChat/src/Chat/V1/ListMembershipsRequest.php new file mode 100644 index 000000000000..aa13f8f92d44 --- /dev/null +++ b/AppsChat/src/Chat/V1/ListMembershipsRequest.php @@ -0,0 +1,426 @@ +google.chat.v1.ListMembershipsRequest + */ +class ListMembershipsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the space for which to fetch a membership + * list. + * Format: spaces/{space} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. + * If unspecified, at most 100 memberships are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous call to list memberships. + * Provide this parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. A query filter. + * You can filter memberships by a member's role + * ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole)) + * and type + * ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)). + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. + * To filter by type, set `member.type` to `HUMAN` or `BOT`. + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * For example, the following queries are valid: + * ``` + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * ``` + * The following queries are invalid: + * ``` + * member.type = "HUMAN" AND member.type = "BOT" + * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. When `true`, also returns memberships associated with a + * [Google Group][google.chat.v1.Membership.group_member], in + * addition to other types of memberships. If a + * [filter][google.chat.v1.ListMembershipsRequest.filter] is set, + * [Google Group][google.chat.v1.Membership.group_member] + * memberships that don't match the filter criteria aren't returned. + * + * Generated from protobuf field bool show_groups = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $show_groups = false; + /** + * Optional. When `true`, also returns memberships associated with + * [invited][google.chat.v1.Membership.MembershipState.INVITED] members, in + * addition to other types of memberships. If a + * filter is set, + * [invited][google.chat.v1.Membership.MembershipState.INVITED] memberships + * that don't match the filter criteria aren't returned. + * Currently requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * Generated from protobuf field bool show_invited = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $show_invited = false; + + /** + * @param string $parent Required. The resource name of the space for which to fetch a membership + * list. + * + * Format: spaces/{space} + * Please see {@see ChatServiceClient::spaceName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\ListMembershipsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the space for which to fetch a membership + * list. + * Format: spaces/{space} + * @type int $page_size + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. + * If unspecified, at most 100 memberships are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * @type string $page_token + * Optional. A page token, received from a previous call to list memberships. + * Provide this parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * @type string $filter + * Optional. A query filter. + * You can filter memberships by a member's role + * ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole)) + * and type + * ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)). + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. + * To filter by type, set `member.type` to `HUMAN` or `BOT`. + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * For example, the following queries are valid: + * ``` + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * ``` + * The following queries are invalid: + * ``` + * member.type = "HUMAN" AND member.type = "BOT" + * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * @type bool $show_groups + * Optional. When `true`, also returns memberships associated with a + * [Google Group][google.chat.v1.Membership.group_member], in + * addition to other types of memberships. If a + * [filter][google.chat.v1.ListMembershipsRequest.filter] is set, + * [Google Group][google.chat.v1.Membership.group_member] + * memberships that don't match the filter criteria aren't returned. + * @type bool $show_invited + * Optional. When `true`, also returns memberships associated with + * [invited][google.chat.v1.Membership.MembershipState.INVITED] members, in + * addition to other types of memberships. If a + * filter is set, + * [invited][google.chat.v1.Membership.MembershipState.INVITED] memberships + * that don't match the filter criteria aren't returned. + * Currently requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Membership::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the space for which to fetch a membership + * list. + * Format: spaces/{space} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the space for which to fetch a membership + * list. + * Format: spaces/{space} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. + * If unspecified, at most 100 memberships are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. + * If unspecified, at most 100 memberships are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous call to list memberships. + * Provide this parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous call to list memberships. + * Provide this parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A query filter. + * You can filter memberships by a member's role + * ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole)) + * and type + * ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)). + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. + * To filter by type, set `member.type` to `HUMAN` or `BOT`. + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * For example, the following queries are valid: + * ``` + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * ``` + * The following queries are invalid: + * ``` + * member.type = "HUMAN" AND member.type = "BOT" + * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. A query filter. + * You can filter memberships by a member's role + * ([`role`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole)) + * and type + * ([`member.type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)). + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. + * To filter by type, set `member.type` to `HUMAN` or `BOT`. + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * For example, the following queries are valid: + * ``` + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * ``` + * The following queries are invalid: + * ``` + * member.type = "HUMAN" AND member.type = "BOT" + * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. When `true`, also returns memberships associated with a + * [Google Group][google.chat.v1.Membership.group_member], in + * addition to other types of memberships. If a + * [filter][google.chat.v1.ListMembershipsRequest.filter] is set, + * [Google Group][google.chat.v1.Membership.group_member] + * memberships that don't match the filter criteria aren't returned. + * + * Generated from protobuf field bool show_groups = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getShowGroups() + { + return $this->show_groups; + } + + /** + * Optional. When `true`, also returns memberships associated with a + * [Google Group][google.chat.v1.Membership.group_member], in + * addition to other types of memberships. If a + * [filter][google.chat.v1.ListMembershipsRequest.filter] is set, + * [Google Group][google.chat.v1.Membership.group_member] + * memberships that don't match the filter criteria aren't returned. + * + * Generated from protobuf field bool show_groups = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setShowGroups($var) + { + GPBUtil::checkBool($var); + $this->show_groups = $var; + + return $this; + } + + /** + * Optional. When `true`, also returns memberships associated with + * [invited][google.chat.v1.Membership.MembershipState.INVITED] members, in + * addition to other types of memberships. If a + * filter is set, + * [invited][google.chat.v1.Membership.MembershipState.INVITED] memberships + * that don't match the filter criteria aren't returned. + * Currently requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * Generated from protobuf field bool show_invited = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getShowInvited() + { + return $this->show_invited; + } + + /** + * Optional. When `true`, also returns memberships associated with + * [invited][google.chat.v1.Membership.MembershipState.INVITED] members, in + * addition to other types of memberships. If a + * filter is set, + * [invited][google.chat.v1.Membership.MembershipState.INVITED] memberships + * that don't match the filter criteria aren't returned. + * Currently requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * + * Generated from protobuf field bool show_invited = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setShowInvited($var) + { + GPBUtil::checkBool($var); + $this->show_invited = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListMembershipsResponse.php b/AppsChat/src/Chat/V1/ListMembershipsResponse.php new file mode 100644 index 000000000000..683786ade983 --- /dev/null +++ b/AppsChat/src/Chat/V1/ListMembershipsResponse.php @@ -0,0 +1,105 @@ +google.chat.v1.ListMembershipsResponse + */ +class ListMembershipsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Unordered list. List of memberships in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Membership memberships = 1 [(.google.api.field_behavior) = UNORDERED_LIST]; + */ + private $memberships; + /** + * A token that you can send as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Chat\V1\Membership>|\Google\Protobuf\Internal\RepeatedField $memberships + * Unordered list. List of memberships in the requested (or first) page. + * @type string $next_page_token + * A token that you can send as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Membership::initOnce(); + parent::__construct($data); + } + + /** + * Unordered list. List of memberships in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Membership memberships = 1 [(.google.api.field_behavior) = UNORDERED_LIST]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMemberships() + { + return $this->memberships; + } + + /** + * Unordered list. List of memberships in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Membership memberships = 1 [(.google.api.field_behavior) = UNORDERED_LIST]; + * @param array<\Google\Apps\Chat\V1\Membership>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMemberships($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Membership::class); + $this->memberships = $arr; + + return $this; + } + + /** + * A token that you can send as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token that you can send as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListMessagesRequest.php b/AppsChat/src/Chat/V1/ListMessagesRequest.php new file mode 100644 index 000000000000..ab83af2f4080 --- /dev/null +++ b/AppsChat/src/Chat/V1/ListMessagesRequest.php @@ -0,0 +1,421 @@ +google.chat.v1.ListMessagesRequest + */ +class ListMessagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the space to list messages from. + * Format: `spaces/{space}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of messages returned. The service might return fewer + * messages than this value. + * If unspecified, at most 25 are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * Optional, if resuming from a previous query. + * A page token received from a previous list messages call. Provide this + * parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A query filter. + * You can filter messages by date (`create_time`) and thread (`thread.name`). + * To filter messages by the date they were created, specify the `create_time` + * with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) + * format and double quotation marks. For example, + * `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to + * list messages that were created after a timestamp, or the less than + * operator `<` to list messages that were created before a timestamp. To + * filter messages within a time interval, use the `AND` operator between two + * timestamps. + * To filter by thread, specify the `thread.name`, formatted as + * `spaces/{space}/threads/{thread}`. You can only specify one + * `thread.name` per query. + * To filter by both thread and date, use the `AND` operator in your query. + * For example, the following queries are valid: + * ``` + * create_time > "2012-04-21T11:30:00-04:00" + * create_time > "2012-04-21T11:30:00-04:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * create_time > "2012-04-21T11:30:00+00:00" AND + * create_time < "2013-01-01T00:00:00+00:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Optional, if resuming from a previous query. + * How the list of messages is ordered. Specify a value to order by an + * ordering operation. Valid ordering operation values are as follows: + * - `ASC` for ascending. + * - `DESC` for descending. + * The default ordering is `create_time ASC`. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + /** + * Whether to include deleted messages. Deleted messages include deleted time + * and metadata about their deletion, but message content is unavailable. + * + * Generated from protobuf field bool show_deleted = 6; + */ + protected $show_deleted = false; + + /** + * @param string $parent Required. The resource name of the space to list messages from. + * + * Format: `spaces/{space}` + * Please see {@see ChatServiceClient::spaceName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\ListMessagesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the space to list messages from. + * Format: `spaces/{space}` + * @type int $page_size + * The maximum number of messages returned. The service might return fewer + * messages than this value. + * If unspecified, at most 25 are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * @type string $page_token + * Optional, if resuming from a previous query. + * A page token received from a previous list messages call. Provide this + * parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * @type string $filter + * A query filter. + * You can filter messages by date (`create_time`) and thread (`thread.name`). + * To filter messages by the date they were created, specify the `create_time` + * with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) + * format and double quotation marks. For example, + * `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to + * list messages that were created after a timestamp, or the less than + * operator `<` to list messages that were created before a timestamp. To + * filter messages within a time interval, use the `AND` operator between two + * timestamps. + * To filter by thread, specify the `thread.name`, formatted as + * `spaces/{space}/threads/{thread}`. You can only specify one + * `thread.name` per query. + * To filter by both thread and date, use the `AND` operator in your query. + * For example, the following queries are valid: + * ``` + * create_time > "2012-04-21T11:30:00-04:00" + * create_time > "2012-04-21T11:30:00-04:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * create_time > "2012-04-21T11:30:00+00:00" AND + * create_time < "2013-01-01T00:00:00+00:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * @type string $order_by + * Optional, if resuming from a previous query. + * How the list of messages is ordered. Specify a value to order by an + * ordering operation. Valid ordering operation values are as follows: + * - `ASC` for ascending. + * - `DESC` for descending. + * The default ordering is `create_time ASC`. + * @type bool $show_deleted + * Whether to include deleted messages. Deleted messages include deleted time + * and metadata about their deletion, but message content is unavailable. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the space to list messages from. + * Format: `spaces/{space}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the space to list messages from. + * Format: `spaces/{space}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of messages returned. The service might return fewer + * messages than this value. + * If unspecified, at most 25 are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of messages returned. The service might return fewer + * messages than this value. + * If unspecified, at most 25 are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional, if resuming from a previous query. + * A page token received from a previous list messages call. Provide this + * parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional, if resuming from a previous query. + * A page token received from a previous list messages call. Provide this + * parameter to retrieve the subsequent page. + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A query filter. + * You can filter messages by date (`create_time`) and thread (`thread.name`). + * To filter messages by the date they were created, specify the `create_time` + * with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) + * format and double quotation marks. For example, + * `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to + * list messages that were created after a timestamp, or the less than + * operator `<` to list messages that were created before a timestamp. To + * filter messages within a time interval, use the `AND` operator between two + * timestamps. + * To filter by thread, specify the `thread.name`, formatted as + * `spaces/{space}/threads/{thread}`. You can only specify one + * `thread.name` per query. + * To filter by both thread and date, use the `AND` operator in your query. + * For example, the following queries are valid: + * ``` + * create_time > "2012-04-21T11:30:00-04:00" + * create_time > "2012-04-21T11:30:00-04:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * create_time > "2012-04-21T11:30:00+00:00" AND + * create_time < "2013-01-01T00:00:00+00:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A query filter. + * You can filter messages by date (`create_time`) and thread (`thread.name`). + * To filter messages by the date they were created, specify the `create_time` + * with a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) + * format and double quotation marks. For example, + * `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to + * list messages that were created after a timestamp, or the less than + * operator `<` to list messages that were created before a timestamp. To + * filter messages within a time interval, use the `AND` operator between two + * timestamps. + * To filter by thread, specify the `thread.name`, formatted as + * `spaces/{space}/threads/{thread}`. You can only specify one + * `thread.name` per query. + * To filter by both thread and date, use the `AND` operator in your query. + * For example, the following queries are valid: + * ``` + * create_time > "2012-04-21T11:30:00-04:00" + * create_time > "2012-04-21T11:30:00-04:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * create_time > "2012-04-21T11:30:00+00:00" AND + * create_time < "2013-01-01T00:00:00+00:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * thread.name = spaces/AAAAAAAAAAA/threads/123 + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional, if resuming from a previous query. + * How the list of messages is ordered. Specify a value to order by an + * ordering operation. Valid ordering operation values are as follows: + * - `ASC` for ascending. + * - `DESC` for descending. + * The default ordering is `create_time ASC`. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional, if resuming from a previous query. + * How the list of messages is ordered. Specify a value to order by an + * ordering operation. Valid ordering operation values are as follows: + * - `ASC` for ascending. + * - `DESC` for descending. + * The default ordering is `create_time ASC`. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Whether to include deleted messages. Deleted messages include deleted time + * and metadata about their deletion, but message content is unavailable. + * + * Generated from protobuf field bool show_deleted = 6; + * @return bool + */ + public function getShowDeleted() + { + return $this->show_deleted; + } + + /** + * Whether to include deleted messages. Deleted messages include deleted time + * and metadata about their deletion, but message content is unavailable. + * + * Generated from protobuf field bool show_deleted = 6; + * @param bool $var + * @return $this + */ + public function setShowDeleted($var) + { + GPBUtil::checkBool($var); + $this->show_deleted = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListMessagesResponse.php b/AppsChat/src/Chat/V1/ListMessagesResponse.php new file mode 100644 index 000000000000..2b34fab21efd --- /dev/null +++ b/AppsChat/src/Chat/V1/ListMessagesResponse.php @@ -0,0 +1,105 @@ +google.chat.v1.ListMessagesResponse + */ +class ListMessagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of messages. + * + * Generated from protobuf field repeated .google.chat.v1.Message messages = 1; + */ + private $messages; + /** + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Chat\V1\Message>|\Google\Protobuf\Internal\RepeatedField $messages + * List of messages. + * @type string $next_page_token + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * List of messages. + * + * Generated from protobuf field repeated .google.chat.v1.Message messages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMessages() + { + return $this->messages; + } + + /** + * List of messages. + * + * Generated from protobuf field repeated .google.chat.v1.Message messages = 1; + * @param array<\Google\Apps\Chat\V1\Message>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Message::class); + $this->messages = $arr; + + return $this; + } + + /** + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListReactionsRequest.php b/AppsChat/src/Chat/V1/ListReactionsRequest.php new file mode 100644 index 000000000000..57ee4da7a254 --- /dev/null +++ b/AppsChat/src/Chat/V1/ListReactionsRequest.php @@ -0,0 +1,349 @@ +google.chat.v1.ListReactionsRequest + */ +class ListReactionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The message users reacted to. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of reactions returned. The service can return + * fewer reactions than this value. If unspecified, the default value is 25. + * The maximum value is 200; values above 200 are changed to 200. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. (If resuming from a previous query.) + * A page token received from a previous list reactions call. Provide this + * to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. A query filter. + * You can filter reactions by + * [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji) + * (either `emoji.unicode` or `emoji.custom_emoji.uid`) and + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * (`user.name`). + * To filter reactions for multiple emojis or users, join similar fields + * with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode = + * "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. + * To filter reactions by emoji and user, use the `AND` operator, such as + * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * If your query uses both `AND` and `OR`, group them with parentheses. + * For example, the following queries are valid: + * ``` + * user.name = "users/{user}" + * emoji.unicode = "🙂" + * emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR emoji.unicode = "👍" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" AND user.name = "users/{user}" + * (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}") + * AND user.name = "users/{user}" + * ``` + * The following queries are invalid: + * ``` + * emoji.unicode = "🙂" AND emoji.unicode = "👍" + * emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR + * user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * AND user.name = "users/{user}" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The message users reacted to. + * + * Format: `spaces/{space}/messages/{message}` + * Please see {@see ChatServiceClient::messageName()} for help formatting this field. + * + * @return \Google\Apps\Chat\V1\ListReactionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The message users reacted to. + * Format: `spaces/{space}/messages/{message}` + * @type int $page_size + * Optional. The maximum number of reactions returned. The service can return + * fewer reactions than this value. If unspecified, the default value is 25. + * The maximum value is 200; values above 200 are changed to 200. + * @type string $page_token + * Optional. (If resuming from a previous query.) + * A page token received from a previous list reactions call. Provide this + * to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value might lead to unexpected results. + * @type string $filter + * Optional. A query filter. + * You can filter reactions by + * [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji) + * (either `emoji.unicode` or `emoji.custom_emoji.uid`) and + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * (`user.name`). + * To filter reactions for multiple emojis or users, join similar fields + * with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode = + * "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. + * To filter reactions by emoji and user, use the `AND` operator, such as + * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * If your query uses both `AND` and `OR`, group them with parentheses. + * For example, the following queries are valid: + * ``` + * user.name = "users/{user}" + * emoji.unicode = "🙂" + * emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR emoji.unicode = "👍" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" AND user.name = "users/{user}" + * (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}") + * AND user.name = "users/{user}" + * ``` + * The following queries are invalid: + * ``` + * emoji.unicode = "🙂" AND emoji.unicode = "👍" + * emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR + * user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * AND user.name = "users/{user}" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * Required. The message users reacted to. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The message users reacted to. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of reactions returned. The service can return + * fewer reactions than this value. If unspecified, the default value is 25. + * The maximum value is 200; values above 200 are changed to 200. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of reactions returned. The service can return + * fewer reactions than this value. If unspecified, the default value is 25. + * The maximum value is 200; values above 200 are changed to 200. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. (If resuming from a previous query.) + * A page token received from a previous list reactions call. Provide this + * to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. (If resuming from a previous query.) + * A page token received from a previous list reactions call. Provide this + * to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value might lead to unexpected results. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A query filter. + * You can filter reactions by + * [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji) + * (either `emoji.unicode` or `emoji.custom_emoji.uid`) and + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * (`user.name`). + * To filter reactions for multiple emojis or users, join similar fields + * with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode = + * "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. + * To filter reactions by emoji and user, use the `AND` operator, such as + * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * If your query uses both `AND` and `OR`, group them with parentheses. + * For example, the following queries are valid: + * ``` + * user.name = "users/{user}" + * emoji.unicode = "🙂" + * emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR emoji.unicode = "👍" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" AND user.name = "users/{user}" + * (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}") + * AND user.name = "users/{user}" + * ``` + * The following queries are invalid: + * ``` + * emoji.unicode = "🙂" AND emoji.unicode = "👍" + * emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR + * user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * AND user.name = "users/{user}" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. A query filter. + * You can filter reactions by + * [emoji](https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji) + * (either `emoji.unicode` or `emoji.custom_emoji.uid`) and + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * (`user.name`). + * To filter reactions for multiple emojis or users, join similar fields + * with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode = + * "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. + * To filter reactions by emoji and user, use the `AND` operator, such as + * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * If your query uses both `AND` and `OR`, group them with parentheses. + * For example, the following queries are valid: + * ``` + * user.name = "users/{user}" + * emoji.unicode = "🙂" + * emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR emoji.unicode = "👍" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" AND user.name = "users/{user}" + * (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}") + * AND user.name = "users/{user}" + * ``` + * The following queries are invalid: + * ``` + * emoji.unicode = "🙂" AND emoji.unicode = "👍" + * emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}" + * emoji.unicode = "🙂" OR user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR + * user.name = "users/{user}" + * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" + * AND user.name = "users/{user}" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListReactionsResponse.php b/AppsChat/src/Chat/V1/ListReactionsResponse.php new file mode 100644 index 000000000000..429f5e5b5565 --- /dev/null +++ b/AppsChat/src/Chat/V1/ListReactionsResponse.php @@ -0,0 +1,105 @@ +google.chat.v1.ListReactionsResponse + */ +class ListReactionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of reactions in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Reaction reactions = 1; + */ + private $reactions; + /** + * Continuation token to retrieve the next page of results. It's empty + * for the last page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Chat\V1\Reaction>|\Google\Protobuf\Internal\RepeatedField $reactions + * List of reactions in the requested (or first) page. + * @type string $next_page_token + * Continuation token to retrieve the next page of results. It's empty + * for the last page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * List of reactions in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Reaction reactions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReactions() + { + return $this->reactions; + } + + /** + * List of reactions in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Reaction reactions = 1; + * @param array<\Google\Apps\Chat\V1\Reaction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReactions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Reaction::class); + $this->reactions = $arr; + + return $this; + } + + /** + * Continuation token to retrieve the next page of results. It's empty + * for the last page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Continuation token to retrieve the next page of results. It's empty + * for the last page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListSpacesRequest.php b/AppsChat/src/Chat/V1/ListSpacesRequest.php new file mode 100644 index 000000000000..b1764b3e4d93 --- /dev/null +++ b/AppsChat/src/Chat/V1/ListSpacesRequest.php @@ -0,0 +1,219 @@ +google.chat.v1.ListSpacesRequest + */ +class ListSpacesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The maximum number of spaces to return. The service might return + * fewer than this value. + * If unspecified, at most 100 spaces are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous list spaces call. + * Provide this parameter to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value may lead to unexpected results. + * + * Generated from protobuf field string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. A query filter. + * You can filter spaces by the space type + * ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). + * To filter by space type, you must specify valid enum value, such as + * `SPACE` or `GROUP_CHAT` (the `space_type` can't be + * `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` + * operator. + * For example, the following queries are valid: + * ``` + * space_type = "SPACE" + * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $page_size + * Optional. The maximum number of spaces to return. The service might return + * fewer than this value. + * If unspecified, at most 100 spaces are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * @type string $page_token + * Optional. A page token, received from a previous list spaces call. + * Provide this parameter to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value may lead to unexpected results. + * @type string $filter + * Optional. A query filter. + * You can filter spaces by the space type + * ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). + * To filter by space type, you must specify valid enum value, such as + * `SPACE` or `GROUP_CHAT` (the `space_type` can't be + * `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` + * operator. + * For example, the following queries are valid: + * ``` + * space_type = "SPACE" + * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The maximum number of spaces to return. The service might return + * fewer than this value. + * If unspecified, at most 100 spaces are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of spaces to return. The service might return + * fewer than this value. + * If unspecified, at most 100 spaces are returned. + * The maximum value is 1000. If you use a value more than 1000, it's + * automatically changed to 1000. + * Negative values return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous list spaces call. + * Provide this parameter to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value may lead to unexpected results. + * + * Generated from protobuf field string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous list spaces call. + * Provide this parameter to retrieve the subsequent page. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value may lead to unexpected results. + * + * Generated from protobuf field string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A query filter. + * You can filter spaces by the space type + * ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). + * To filter by space type, you must specify valid enum value, such as + * `SPACE` or `GROUP_CHAT` (the `space_type` can't be + * `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` + * operator. + * For example, the following queries are valid: + * ``` + * space_type = "SPACE" + * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. A query filter. + * You can filter spaces by the space type + * ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). + * To filter by space type, you must specify valid enum value, such as + * `SPACE` or `GROUP_CHAT` (the `space_type` can't be + * `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` + * operator. + * For example, the following queries are valid: + * ``` + * space_type = "SPACE" + * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * ``` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/ListSpacesResponse.php b/AppsChat/src/Chat/V1/ListSpacesResponse.php new file mode 100644 index 000000000000..64406b36ad8f --- /dev/null +++ b/AppsChat/src/Chat/V1/ListSpacesResponse.php @@ -0,0 +1,105 @@ +google.chat.v1.ListSpacesResponse + */ +class ListSpacesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of spaces in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Space spaces = 1; + */ + private $spaces; + /** + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Apps\Chat\V1\Space>|\Google\Protobuf\Internal\RepeatedField $spaces + * List of spaces in the requested (or first) page. + * @type string $next_page_token + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * List of spaces in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Space spaces = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpaces() + { + return $this->spaces; + } + + /** + * List of spaces in the requested (or first) page. + * + * Generated from protobuf field repeated .google.chat.v1.Space spaces = 1; + * @param array<\Google\Apps\Chat\V1\Space>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpaces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Space::class); + $this->spaces = $arr; + + return $this; + } + + /** + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * You can send a token as `pageToken` to retrieve the next page of + * results. If empty, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/MatchedUrl.php b/AppsChat/src/Chat/V1/MatchedUrl.php new file mode 100644 index 000000000000..2500f22c05fc --- /dev/null +++ b/AppsChat/src/Chat/V1/MatchedUrl.php @@ -0,0 +1,69 @@ +google.chat.v1.MatchedUrl + */ +class MatchedUrl extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The URL that was matched. + * + * Generated from protobuf field string url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * Output only. The URL that was matched. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\MatchedUrl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The URL that was matched. + * + * Generated from protobuf field string url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Output only. The URL that was matched. + * + * Generated from protobuf field string url = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Membership.php b/AppsChat/src/Chat/V1/Membership.php new file mode 100644 index 000000000000..4361e9ab1970 --- /dev/null +++ b/AppsChat/src/Chat/V1/Membership.php @@ -0,0 +1,352 @@ +google.chat.v1.Membership + */ +class Membership extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the membership, assigned by the server. + * Format: `spaces/{space}/members/{member}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Output only. State of the membership. + * + * Generated from protobuf field .google.chat.v1.Membership.MembershipState state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Optional. User's role within a Chat space, which determines their permitted + * actions in the space. + * [Developer Preview](https://developers.google.com/workspace/preview): + * This field can only be used as input in `UpdateMembership`. + * + * Generated from protobuf field .google.chat.v1.Membership.MembershipRole role = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $role = 0; + /** + * Optional. Immutable. The creation time of the membership, such as when a + * member joined or was invited to join a space. This field is output only, + * except when used to import historical memberships in import mode spaces. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $create_time = null; + /** + * Optional. Immutable. The deletion time of the membership, such as when a + * member left or was removed from a space. This field is output only, except + * when used to import historical memberships in import mode spaces. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $delete_time = null; + protected $memberType; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the membership, assigned by the server. + * Format: `spaces/{space}/members/{member}` + * @type int $state + * Output only. State of the membership. + * @type int $role + * Optional. User's role within a Chat space, which determines their permitted + * actions in the space. + * [Developer Preview](https://developers.google.com/workspace/preview): + * This field can only be used as input in `UpdateMembership`. + * @type \Google\Apps\Chat\V1\User $member + * The Google Chat user or app the membership corresponds to. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * @type \Google\Apps\Chat\V1\Group $group_member + * The Google Group the membership corresponds to. + * Only supports read operations. Other operations, like creating or + * updating a membership, aren't currently supported. + * @type \Google\Protobuf\Timestamp $create_time + * Optional. Immutable. The creation time of the membership, such as when a + * member joined or was invited to join a space. This field is output only, + * except when used to import historical memberships in import mode spaces. + * @type \Google\Protobuf\Timestamp $delete_time + * Optional. Immutable. The deletion time of the membership, such as when a + * member left or was removed from a space. This field is output only, except + * when used to import historical memberships in import mode spaces. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Membership::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the membership, assigned by the server. + * Format: `spaces/{space}/members/{member}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the membership, assigned by the server. + * Format: `spaces/{space}/members/{member}` + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. State of the membership. + * + * Generated from protobuf field .google.chat.v1.Membership.MembershipState state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the membership. + * + * Generated from protobuf field .google.chat.v1.Membership.MembershipState state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\Membership\MembershipState::class); + $this->state = $var; + + return $this; + } + + /** + * Optional. User's role within a Chat space, which determines their permitted + * actions in the space. + * [Developer Preview](https://developers.google.com/workspace/preview): + * This field can only be used as input in `UpdateMembership`. + * + * Generated from protobuf field .google.chat.v1.Membership.MembershipRole role = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRole() + { + return $this->role; + } + + /** + * Optional. User's role within a Chat space, which determines their permitted + * actions in the space. + * [Developer Preview](https://developers.google.com/workspace/preview): + * This field can only be used as input in `UpdateMembership`. + * + * Generated from protobuf field .google.chat.v1.Membership.MembershipRole role = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRole($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\Membership\MembershipRole::class); + $this->role = $var; + + return $this; + } + + /** + * The Google Chat user or app the membership corresponds to. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * + * Generated from protobuf field .google.chat.v1.User member = 3; + * @return \Google\Apps\Chat\V1\User|null + */ + public function getMember() + { + return $this->readOneof(3); + } + + public function hasMember() + { + return $this->hasOneof(3); + } + + /** + * The Google Chat user or app the membership corresponds to. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * + * Generated from protobuf field .google.chat.v1.User member = 3; + * @param \Google\Apps\Chat\V1\User $var + * @return $this + */ + public function setMember($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\User::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The Google Group the membership corresponds to. + * Only supports read operations. Other operations, like creating or + * updating a membership, aren't currently supported. + * + * Generated from protobuf field .google.chat.v1.Group group_member = 5; + * @return \Google\Apps\Chat\V1\Group|null + */ + public function getGroupMember() + { + return $this->readOneof(5); + } + + public function hasGroupMember() + { + return $this->hasOneof(5); + } + + /** + * The Google Group the membership corresponds to. + * Only supports read operations. Other operations, like creating or + * updating a membership, aren't currently supported. + * + * Generated from protobuf field .google.chat.v1.Group group_member = 5; + * @param \Google\Apps\Chat\V1\Group $var + * @return $this + */ + public function setGroupMember($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Group::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Optional. Immutable. The creation time of the membership, such as when a + * member joined or was invited to join a space. This field is output only, + * except when used to import historical memberships in import mode spaces. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Optional. Immutable. The creation time of the membership, such as when a + * member joined or was invited to join a space. This field is output only, + * except when used to import historical memberships in import mode spaces. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Optional. Immutable. The deletion time of the membership, such as when a + * member left or was removed from a space. This field is output only, except + * when used to import historical memberships in import mode spaces. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Optional. Immutable. The deletion time of the membership, such as when a + * member left or was removed from a space. This field is output only, except + * when used to import historical memberships in import mode spaces. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * @return string + */ + public function getMemberType() + { + return $this->whichOneof("memberType"); + } + +} + diff --git a/AppsChat/src/Chat/V1/Membership/MembershipRole.php b/AppsChat/src/Chat/V1/Membership/MembershipRole.php new file mode 100644 index 000000000000..e29f81a860bc --- /dev/null +++ b/AppsChat/src/Chat/V1/Membership/MembershipRole.php @@ -0,0 +1,71 @@ +google.chat.v1.Membership.MembershipRole + */ +class MembershipRole +{ + /** + * Default value. For [users][google.chat.v1.Membership.member]: they + * aren't a member of the space, but can be invited. For + * [Google Groups][google.chat.v1.Membership.group_member]: they're always + * assigned this role (other enum values might be used in the future). + * + * Generated from protobuf enum MEMBERSHIP_ROLE_UNSPECIFIED = 0; + */ + const MEMBERSHIP_ROLE_UNSPECIFIED = 0; + /** + * A member of the space. The user has basic permissions, like sending + * messages to the space. In 1:1 and unnamed group conversations, everyone + * has this role. + * + * Generated from protobuf enum ROLE_MEMBER = 1; + */ + const ROLE_MEMBER = 1; + /** + * A space manager. The user has all basic permissions plus administrative + * permissions that let them manage the space, like adding or removing + * members. Only supported in + * [SpaceType.SPACE][google.chat.v1.Space.SpaceType]. + * + * Generated from protobuf enum ROLE_MANAGER = 2; + */ + const ROLE_MANAGER = 2; + + private static $valueToName = [ + self::MEMBERSHIP_ROLE_UNSPECIFIED => 'MEMBERSHIP_ROLE_UNSPECIFIED', + self::ROLE_MEMBER => 'ROLE_MEMBER', + self::ROLE_MANAGER => 'ROLE_MANAGER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Membership/MembershipState.php b/AppsChat/src/Chat/V1/Membership/MembershipState.php new file mode 100644 index 000000000000..e830b4d27258 --- /dev/null +++ b/AppsChat/src/Chat/V1/Membership/MembershipState.php @@ -0,0 +1,71 @@ +google.chat.v1.Membership.MembershipState + */ +class MembershipState +{ + /** + * Default value. Don't use. + * + * Generated from protobuf enum MEMBERSHIP_STATE_UNSPECIFIED = 0; + */ + const MEMBERSHIP_STATE_UNSPECIFIED = 0; + /** + * The user is added to the space, and can participate in the space. + * + * Generated from protobuf enum JOINED = 1; + */ + const JOINED = 1; + /** + * The user is invited to join the space, but hasn't joined it. + * + * Generated from protobuf enum INVITED = 2; + */ + const INVITED = 2; + /** + * The user doesn't belong to the space and doesn't have a pending + * invitation to join the space. + * + * Generated from protobuf enum NOT_A_MEMBER = 3; + */ + const NOT_A_MEMBER = 3; + + private static $valueToName = [ + self::MEMBERSHIP_STATE_UNSPECIFIED => 'MEMBERSHIP_STATE_UNSPECIFIED', + self::JOINED => 'JOINED', + self::INVITED => 'INVITED', + self::NOT_A_MEMBER => 'NOT_A_MEMBER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Message.php b/AppsChat/src/Chat/V1/Message.php new file mode 100644 index 000000000000..881bdf2e84a0 --- /dev/null +++ b/AppsChat/src/Chat/V1/Message.php @@ -0,0 +1,1422 @@ +google.chat.v1.Message + */ +class Message extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * Where `{space}` is the ID of the space where the message is posted and + * `{message}` is a system-assigned ID for the message. For example, + * `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`. + * If you set a custom ID when you create a message, you can use this ID to + * specify the message in a request by replacing `{message}` with the value + * from the `clientAssignedMessageId` field. For example, + * `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name + * a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The user who created the message. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * + * Generated from protobuf field .google.chat.v1.User sender = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $sender = null; + /** + * Optional. Immutable. For spaces created in Chat, the time at which the + * message was created. This field is output only, except when used in import + * mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the message was created in the source in order to preserve the original + * creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $create_time = null; + /** + * Output only. The time at which the message was last edited by a user. If + * the message has never been edited, this field is empty. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $last_update_time = null; + /** + * Output only. The time at which the message was deleted in + * Google Chat. If the message is never deleted, this field is empty. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Plain-text body of the message. The first link to an image, video, or web + * page generates a + * [preview chip](https://developers.google.com/workspace/chat/preview-links). + * You can also [@mention a Google Chat + * user](https://developers.google.com/workspace/chat/format-messages#messages-@mention), + * or everyone in the space. + * To learn about creating text messages, see [Send a text + * message](https://developers.google.com/workspace/chat/create-messages#create-text-messages). + * + * Generated from protobuf field string text = 4; + */ + protected $text = ''; + /** + * Output only. Contains the message `text` with markups added to communicate + * formatting. This field might not capture all formatting visible in the UI, + * but includes the following: + * * [Markup + * syntax](https://developers.google.com/workspace/chat/format-messages) + * for bold, italic, strikethrough, monospace, monospace block, and bulleted + * list. + * * [User + * mentions](https://developers.google.com/workspace/chat/format-messages#messages-@mention) + * using the format ``. + * * Custom hyperlinks using the format `<{url}|{rendered_text}>` where the + * first string is the URL and the second is the rendered text—for example, + * ``. + * * Custom emoji using the format `:{emoji_name}:`—for example, `:smile:`. + * This doesn't apply to Unicode emoji, such as `U+1F600` for a grinning + * face emoji. + * For more information, see [View text formatting sent in a + * message](https://developers.google.com/workspace/chat/format-messages#view_text_formatting_sent_in_a_message) + * + * Generated from protobuf field string formatted_text = 43 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $formatted_text = ''; + /** + * Deprecated: Use `cards_v2` instead. + * Rich, formatted, and interactive cards that you can use to display UI + * elements such as: formatted texts, buttons, and clickable images. Cards are + * normally displayed below the plain-text body of the message. `cards` and + * `cards_v2` can have a maximum size of 32 KB. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card cards = 5 [deprecated = true]; + * @deprecated + */ + private $cards; + /** + * An array of + * [cards](https://developers.google.com/workspace/chat/api/reference/rest/v1/cards). + * Only Chat apps can create cards. If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the messages can't contain cards. + * To learn about cards and how to create them, see [Send card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Card builder](https://addons.gsuite.google.com/uikit/builder) + * + * Generated from protobuf field repeated .google.chat.v1.CardWithId cards_v2 = 22; + */ + private $cards_v2; + /** + * Output only. Annotations associated with the `text` in this message. + * + * Generated from protobuf field repeated .google.chat.v1.Annotation annotations = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $annotations; + /** + * The thread the message belongs to. For example usage, see + * [Start or reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * + * Generated from protobuf field .google.chat.v1.Thread thread = 11; + */ + protected $thread = null; + /** + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * `name`. + * + * Generated from protobuf field .google.chat.v1.Space space = 12; + */ + protected $space = null; + /** + * A plain-text description of the message's cards, used when the actual cards + * can't be displayed—for example, mobile notifications. + * + * Generated from protobuf field string fallback_text = 13; + */ + protected $fallback_text = ''; + /** + * Input only. Parameters that a Chat app can use to configure how its + * response is posted. + * + * Generated from protobuf field .google.chat.v1.ActionResponse action_response = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $action_response = null; + /** + * Output only. Plain-text body of the message with all Chat app mentions + * stripped out. + * + * Generated from protobuf field string argument_text = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $argument_text = ''; + /** + * Output only. Slash command information, if applicable. + * + * Generated from protobuf field .google.chat.v1.SlashCommand slash_command = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $slash_command = null; + /** + * User-uploaded attachment. + * + * Generated from protobuf field repeated .google.chat.v1.Attachment attachment = 18; + */ + private $attachment; + /** + * Output only. A URL in `spaces.messages.text` that matches a link preview + * pattern. For more information, see [Preview + * links](https://developers.google.com/workspace/chat/preview-links). + * + * Generated from protobuf field .google.chat.v1.MatchedUrl matched_url = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $matched_url = null; + /** + * Output only. When `true`, the message is a response in a reply thread. When + * `false`, the message is visible in the space's top-level conversation as + * either the first message of a thread or a message with no threaded replies. + * If the space doesn't support reply in threads, this field is always + * `false`. + * + * Generated from protobuf field bool thread_reply = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $thread_reply = false; + /** + * Optional. A custom ID for the message. You can use field to identify a + * message, or to get, delete, or update a message. To set a custom ID, + * specify the + * [`messageId`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#body.QUERY_PARAMETERS.message_id) + * field when you create the message. For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string client_assigned_message_id = 32; + */ + protected $client_assigned_message_id = ''; + /** + * Output only. The list of emoji reaction summaries on the message. + * + * Generated from protobuf field repeated .google.chat.v1.EmojiReactionSummary emoji_reaction_summaries = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $emoji_reaction_summaries; + /** + * Immutable. Input for creating a message, otherwise output only. The user + * that can view the message. When set, the message is private and only + * visible to the specified user and the Chat app. Link previews and + * attachments aren't supported for private messages. + * Only Chat apps can send private messages. If your Chat app [authenticates + * as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * to send a message, the message can't be private and must omit this field. + * For details, see [Send private messages to Google Chat + * users](https://developers.google.com/workspace/chat/private-messages). + * + * Generated from protobuf field .google.chat.v1.User private_message_viewer = 36 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $private_message_viewer = null; + /** + * Output only. Information about a deleted message. A message is deleted when + * `delete_time` is set. + * + * Generated from protobuf field .google.chat.v1.DeletionMetadata deletion_metadata = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $deletion_metadata = null; + /** + * Output only. Information about a message that's quoted by a Google Chat + * user in a space. Google Chat users can quote a message to reply to it. + * + * Generated from protobuf field .google.chat.v1.QuotedMessageMetadata quoted_message_metadata = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $quoted_message_metadata = null; + /** + * Output only. GIF images that are attached to the message. + * + * Generated from protobuf field repeated .google.chat.v1.AttachedGif attached_gifs = 42 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $attached_gifs; + /** + * One or more interactive widgets that appear at the bottom of a message. + * You can add accessory widgets to messages that contain text, cards, or both + * text and cards. Not supported for messages that contain dialogs. For + * details, see [Add interactive widgets at the bottom of a + * message](https://developers.google.com/workspace/chat/create-messages#add-accessory-widgets). + * Creating a message with accessory widgets requires [app + * authentication] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * Generated from protobuf field repeated .google.chat.v1.AccessoryWidget accessory_widgets = 44; + */ + private $accessory_widgets; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * Where `{space}` is the ID of the space where the message is posted and + * `{message}` is a system-assigned ID for the message. For example, + * `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`. + * If you set a custom ID when you create a message, you can use this ID to + * specify the message in a request by replacing `{message}` with the value + * from the `clientAssignedMessageId` field. For example, + * `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name + * a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * @type \Google\Apps\Chat\V1\User $sender + * Output only. The user who created the message. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * @type \Google\Protobuf\Timestamp $create_time + * Optional. Immutable. For spaces created in Chat, the time at which the + * message was created. This field is output only, except when used in import + * mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the message was created in the source in order to preserve the original + * creation time. + * @type \Google\Protobuf\Timestamp $last_update_time + * Output only. The time at which the message was last edited by a user. If + * the message has never been edited, this field is empty. + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. The time at which the message was deleted in + * Google Chat. If the message is never deleted, this field is empty. + * @type string $text + * Plain-text body of the message. The first link to an image, video, or web + * page generates a + * [preview chip](https://developers.google.com/workspace/chat/preview-links). + * You can also [@mention a Google Chat + * user](https://developers.google.com/workspace/chat/format-messages#messages-@mention), + * or everyone in the space. + * To learn about creating text messages, see [Send a text + * message](https://developers.google.com/workspace/chat/create-messages#create-text-messages). + * @type string $formatted_text + * Output only. Contains the message `text` with markups added to communicate + * formatting. This field might not capture all formatting visible in the UI, + * but includes the following: + * * [Markup + * syntax](https://developers.google.com/workspace/chat/format-messages) + * for bold, italic, strikethrough, monospace, monospace block, and bulleted + * list. + * * [User + * mentions](https://developers.google.com/workspace/chat/format-messages#messages-@mention) + * using the format ``. + * * Custom hyperlinks using the format `<{url}|{rendered_text}>` where the + * first string is the URL and the second is the rendered text—for example, + * ``. + * * Custom emoji using the format `:{emoji_name}:`—for example, `:smile:`. + * This doesn't apply to Unicode emoji, such as `U+1F600` for a grinning + * face emoji. + * For more information, see [View text formatting sent in a + * message](https://developers.google.com/workspace/chat/format-messages#view_text_formatting_sent_in_a_message) + * @type array<\Google\Apps\Chat\V1\ContextualAddOnMarkup\Card>|\Google\Protobuf\Internal\RepeatedField $cards + * Deprecated: Use `cards_v2` instead. + * Rich, formatted, and interactive cards that you can use to display UI + * elements such as: formatted texts, buttons, and clickable images. Cards are + * normally displayed below the plain-text body of the message. `cards` and + * `cards_v2` can have a maximum size of 32 KB. + * @type array<\Google\Apps\Chat\V1\CardWithId>|\Google\Protobuf\Internal\RepeatedField $cards_v2 + * An array of + * [cards](https://developers.google.com/workspace/chat/api/reference/rest/v1/cards). + * Only Chat apps can create cards. If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the messages can't contain cards. + * To learn about cards and how to create them, see [Send card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Card builder](https://addons.gsuite.google.com/uikit/builder) + * @type array<\Google\Apps\Chat\V1\Annotation>|\Google\Protobuf\Internal\RepeatedField $annotations + * Output only. Annotations associated with the `text` in this message. + * @type \Google\Apps\Chat\V1\Thread $thread + * The thread the message belongs to. For example usage, see + * [Start or reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * @type \Google\Apps\Chat\V1\Space $space + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * `name`. + * @type string $fallback_text + * A plain-text description of the message's cards, used when the actual cards + * can't be displayed—for example, mobile notifications. + * @type \Google\Apps\Chat\V1\ActionResponse $action_response + * Input only. Parameters that a Chat app can use to configure how its + * response is posted. + * @type string $argument_text + * Output only. Plain-text body of the message with all Chat app mentions + * stripped out. + * @type \Google\Apps\Chat\V1\SlashCommand $slash_command + * Output only. Slash command information, if applicable. + * @type array<\Google\Apps\Chat\V1\Attachment>|\Google\Protobuf\Internal\RepeatedField $attachment + * User-uploaded attachment. + * @type \Google\Apps\Chat\V1\MatchedUrl $matched_url + * Output only. A URL in `spaces.messages.text` that matches a link preview + * pattern. For more information, see [Preview + * links](https://developers.google.com/workspace/chat/preview-links). + * @type bool $thread_reply + * Output only. When `true`, the message is a response in a reply thread. When + * `false`, the message is visible in the space's top-level conversation as + * either the first message of a thread or a message with no threaded replies. + * If the space doesn't support reply in threads, this field is always + * `false`. + * @type string $client_assigned_message_id + * Optional. A custom ID for the message. You can use field to identify a + * message, or to get, delete, or update a message. To set a custom ID, + * specify the + * [`messageId`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#body.QUERY_PARAMETERS.message_id) + * field when you create the message. For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * @type array<\Google\Apps\Chat\V1\EmojiReactionSummary>|\Google\Protobuf\Internal\RepeatedField $emoji_reaction_summaries + * Output only. The list of emoji reaction summaries on the message. + * @type \Google\Apps\Chat\V1\User $private_message_viewer + * Immutable. Input for creating a message, otherwise output only. The user + * that can view the message. When set, the message is private and only + * visible to the specified user and the Chat app. Link previews and + * attachments aren't supported for private messages. + * Only Chat apps can send private messages. If your Chat app [authenticates + * as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * to send a message, the message can't be private and must omit this field. + * For details, see [Send private messages to Google Chat + * users](https://developers.google.com/workspace/chat/private-messages). + * @type \Google\Apps\Chat\V1\DeletionMetadata $deletion_metadata + * Output only. Information about a deleted message. A message is deleted when + * `delete_time` is set. + * @type \Google\Apps\Chat\V1\QuotedMessageMetadata $quoted_message_metadata + * Output only. Information about a message that's quoted by a Google Chat + * user in a space. Google Chat users can quote a message to reply to it. + * @type array<\Google\Apps\Chat\V1\AttachedGif>|\Google\Protobuf\Internal\RepeatedField $attached_gifs + * Output only. GIF images that are attached to the message. + * @type array<\Google\Apps\Chat\V1\AccessoryWidget>|\Google\Protobuf\Internal\RepeatedField $accessory_widgets + * One or more interactive widgets that appear at the bottom of a message. + * You can add accessory widgets to messages that contain text, cards, or both + * text and cards. Not supported for messages that contain dialogs. For + * details, see [Add interactive widgets at the bottom of a + * message](https://developers.google.com/workspace/chat/create-messages#add-accessory-widgets). + * Creating a message with accessory widgets requires [app + * authentication] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * Where `{space}` is the ID of the space where the message is posted and + * `{message}` is a system-assigned ID for the message. For example, + * `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`. + * If you set a custom ID when you create a message, you can use this ID to + * specify the message in a request by replacing `{message}` with the value + * from the `clientAssignedMessageId` field. For example, + * `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name + * a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the message. + * Format: `spaces/{space}/messages/{message}` + * Where `{space}` is the ID of the space where the message is posted and + * `{message}` is a system-assigned ID for the message. For example, + * `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`. + * If you set a custom ID when you create a message, you can use this ID to + * specify the message in a request by replacing `{message}` with the value + * from the `clientAssignedMessageId` field. For example, + * `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name + * a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The user who created the message. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * + * Generated from protobuf field .google.chat.v1.User sender = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\User|null + */ + public function getSender() + { + return $this->sender; + } + + public function hasSender() + { + return isset($this->sender); + } + + public function clearSender() + { + unset($this->sender); + } + + /** + * Output only. The user who created the message. + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) + * `name` and `type`. + * + * Generated from protobuf field .google.chat.v1.User sender = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\User $var + * @return $this + */ + public function setSender($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\User::class); + $this->sender = $var; + + return $this; + } + + /** + * Optional. Immutable. For spaces created in Chat, the time at which the + * message was created. This field is output only, except when used in import + * mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the message was created in the source in order to preserve the original + * creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Optional. Immutable. For spaces created in Chat, the time at which the + * message was created. This field is output only, except when used in import + * mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the message was created in the source in order to preserve the original + * creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time at which the message was last edited by a user. If + * the message has never been edited, this field is empty. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateTime() + { + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + unset($this->last_update_time); + } + + /** + * Output only. The time at which the message was last edited by a user. If + * the message has never been edited, this field is empty. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + + /** + * Output only. The time at which the message was deleted in + * Google Chat. If the message is never deleted, this field is empty. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. The time at which the message was deleted in + * Google Chat. If the message is never deleted, this field is empty. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Plain-text body of the message. The first link to an image, video, or web + * page generates a + * [preview chip](https://developers.google.com/workspace/chat/preview-links). + * You can also [@mention a Google Chat + * user](https://developers.google.com/workspace/chat/format-messages#messages-@mention), + * or everyone in the space. + * To learn about creating text messages, see [Send a text + * message](https://developers.google.com/workspace/chat/create-messages#create-text-messages). + * + * Generated from protobuf field string text = 4; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Plain-text body of the message. The first link to an image, video, or web + * page generates a + * [preview chip](https://developers.google.com/workspace/chat/preview-links). + * You can also [@mention a Google Chat + * user](https://developers.google.com/workspace/chat/format-messages#messages-@mention), + * or everyone in the space. + * To learn about creating text messages, see [Send a text + * message](https://developers.google.com/workspace/chat/create-messages#create-text-messages). + * + * Generated from protobuf field string text = 4; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Output only. Contains the message `text` with markups added to communicate + * formatting. This field might not capture all formatting visible in the UI, + * but includes the following: + * * [Markup + * syntax](https://developers.google.com/workspace/chat/format-messages) + * for bold, italic, strikethrough, monospace, monospace block, and bulleted + * list. + * * [User + * mentions](https://developers.google.com/workspace/chat/format-messages#messages-@mention) + * using the format ``. + * * Custom hyperlinks using the format `<{url}|{rendered_text}>` where the + * first string is the URL and the second is the rendered text—for example, + * ``. + * * Custom emoji using the format `:{emoji_name}:`—for example, `:smile:`. + * This doesn't apply to Unicode emoji, such as `U+1F600` for a grinning + * face emoji. + * For more information, see [View text formatting sent in a + * message](https://developers.google.com/workspace/chat/format-messages#view_text_formatting_sent_in_a_message) + * + * Generated from protobuf field string formatted_text = 43 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFormattedText() + { + return $this->formatted_text; + } + + /** + * Output only. Contains the message `text` with markups added to communicate + * formatting. This field might not capture all formatting visible in the UI, + * but includes the following: + * * [Markup + * syntax](https://developers.google.com/workspace/chat/format-messages) + * for bold, italic, strikethrough, monospace, monospace block, and bulleted + * list. + * * [User + * mentions](https://developers.google.com/workspace/chat/format-messages#messages-@mention) + * using the format ``. + * * Custom hyperlinks using the format `<{url}|{rendered_text}>` where the + * first string is the URL and the second is the rendered text—for example, + * ``. + * * Custom emoji using the format `:{emoji_name}:`—for example, `:smile:`. + * This doesn't apply to Unicode emoji, such as `U+1F600` for a grinning + * face emoji. + * For more information, see [View text formatting sent in a + * message](https://developers.google.com/workspace/chat/format-messages#view_text_formatting_sent_in_a_message) + * + * Generated from protobuf field string formatted_text = 43 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFormattedText($var) + { + GPBUtil::checkString($var, True); + $this->formatted_text = $var; + + return $this; + } + + /** + * Deprecated: Use `cards_v2` instead. + * Rich, formatted, and interactive cards that you can use to display UI + * elements such as: formatted texts, buttons, and clickable images. Cards are + * normally displayed below the plain-text body of the message. `cards` and + * `cards_v2` can have a maximum size of 32 KB. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card cards = 5 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getCards() + { + @trigger_error('cards is deprecated.', E_USER_DEPRECATED); + return $this->cards; + } + + /** + * Deprecated: Use `cards_v2` instead. + * Rich, formatted, and interactive cards that you can use to display UI + * elements such as: formatted texts, buttons, and clickable images. Cards are + * normally displayed below the plain-text body of the message. `cards` and + * `cards_v2` can have a maximum size of 32 KB. + * + * Generated from protobuf field repeated .google.chat.v1.ContextualAddOnMarkup.Card cards = 5 [deprecated = true]; + * @param array<\Google\Apps\Chat\V1\ContextualAddOnMarkup\Card>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setCards($var) + { + @trigger_error('cards is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\ContextualAddOnMarkup\Card::class); + $this->cards = $arr; + + return $this; + } + + /** + * An array of + * [cards](https://developers.google.com/workspace/chat/api/reference/rest/v1/cards). + * Only Chat apps can create cards. If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the messages can't contain cards. + * To learn about cards and how to create them, see [Send card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Card builder](https://addons.gsuite.google.com/uikit/builder) + * + * Generated from protobuf field repeated .google.chat.v1.CardWithId cards_v2 = 22; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCardsV2() + { + return $this->cards_v2; + } + + /** + * An array of + * [cards](https://developers.google.com/workspace/chat/api/reference/rest/v1/cards). + * Only Chat apps can create cards. If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the messages can't contain cards. + * To learn about cards and how to create them, see [Send card + * messages](https://developers.google.com/workspace/chat/create-messages#create). + * [Card builder](https://addons.gsuite.google.com/uikit/builder) + * + * Generated from protobuf field repeated .google.chat.v1.CardWithId cards_v2 = 22; + * @param array<\Google\Apps\Chat\V1\CardWithId>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCardsV2($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\CardWithId::class); + $this->cards_v2 = $arr; + + return $this; + } + + /** + * Output only. Annotations associated with the `text` in this message. + * + * Generated from protobuf field repeated .google.chat.v1.Annotation annotations = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Output only. Annotations associated with the `text` in this message. + * + * Generated from protobuf field repeated .google.chat.v1.Annotation annotations = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Apps\Chat\V1\Annotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Annotation::class); + $this->annotations = $arr; + + return $this; + } + + /** + * The thread the message belongs to. For example usage, see + * [Start or reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * + * Generated from protobuf field .google.chat.v1.Thread thread = 11; + * @return \Google\Apps\Chat\V1\Thread|null + */ + public function getThread() + { + return $this->thread; + } + + public function hasThread() + { + return isset($this->thread); + } + + public function clearThread() + { + unset($this->thread); + } + + /** + * The thread the message belongs to. For example usage, see + * [Start or reply to a message + * thread](https://developers.google.com/workspace/chat/create-messages#create-message-thread). + * + * Generated from protobuf field .google.chat.v1.Thread thread = 11; + * @param \Google\Apps\Chat\V1\Thread $var + * @return $this + */ + public function setThread($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Thread::class); + $this->thread = $var; + + return $this; + } + + /** + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * `name`. + * + * Generated from protobuf field .google.chat.v1.Space space = 12; + * @return \Google\Apps\Chat\V1\Space|null + */ + public function getSpace() + { + return $this->space; + } + + public function hasSpace() + { + return isset($this->space); + } + + public function clearSpace() + { + unset($this->space); + } + + /** + * If your Chat app [authenticates as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), + * the output populates the + * [space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * `name`. + * + * Generated from protobuf field .google.chat.v1.Space space = 12; + * @param \Google\Apps\Chat\V1\Space $var + * @return $this + */ + public function setSpace($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Space::class); + $this->space = $var; + + return $this; + } + + /** + * A plain-text description of the message's cards, used when the actual cards + * can't be displayed—for example, mobile notifications. + * + * Generated from protobuf field string fallback_text = 13; + * @return string + */ + public function getFallbackText() + { + return $this->fallback_text; + } + + /** + * A plain-text description of the message's cards, used when the actual cards + * can't be displayed—for example, mobile notifications. + * + * Generated from protobuf field string fallback_text = 13; + * @param string $var + * @return $this + */ + public function setFallbackText($var) + { + GPBUtil::checkString($var, True); + $this->fallback_text = $var; + + return $this; + } + + /** + * Input only. Parameters that a Chat app can use to configure how its + * response is posted. + * + * Generated from protobuf field .google.chat.v1.ActionResponse action_response = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Apps\Chat\V1\ActionResponse|null + */ + public function getActionResponse() + { + return $this->action_response; + } + + public function hasActionResponse() + { + return isset($this->action_response); + } + + public function clearActionResponse() + { + unset($this->action_response); + } + + /** + * Input only. Parameters that a Chat app can use to configure how its + * response is posted. + * + * Generated from protobuf field .google.chat.v1.ActionResponse action_response = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Apps\Chat\V1\ActionResponse $var + * @return $this + */ + public function setActionResponse($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\ActionResponse::class); + $this->action_response = $var; + + return $this; + } + + /** + * Output only. Plain-text body of the message with all Chat app mentions + * stripped out. + * + * Generated from protobuf field string argument_text = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getArgumentText() + { + return $this->argument_text; + } + + /** + * Output only. Plain-text body of the message with all Chat app mentions + * stripped out. + * + * Generated from protobuf field string argument_text = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setArgumentText($var) + { + GPBUtil::checkString($var, True); + $this->argument_text = $var; + + return $this; + } + + /** + * Output only. Slash command information, if applicable. + * + * Generated from protobuf field .google.chat.v1.SlashCommand slash_command = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\SlashCommand|null + */ + public function getSlashCommand() + { + return $this->slash_command; + } + + public function hasSlashCommand() + { + return isset($this->slash_command); + } + + public function clearSlashCommand() + { + unset($this->slash_command); + } + + /** + * Output only. Slash command information, if applicable. + * + * Generated from protobuf field .google.chat.v1.SlashCommand slash_command = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\SlashCommand $var + * @return $this + */ + public function setSlashCommand($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\SlashCommand::class); + $this->slash_command = $var; + + return $this; + } + + /** + * User-uploaded attachment. + * + * Generated from protobuf field repeated .google.chat.v1.Attachment attachment = 18; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttachment() + { + return $this->attachment; + } + + /** + * User-uploaded attachment. + * + * Generated from protobuf field repeated .google.chat.v1.Attachment attachment = 18; + * @param array<\Google\Apps\Chat\V1\Attachment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttachment($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Attachment::class); + $this->attachment = $arr; + + return $this; + } + + /** + * Output only. A URL in `spaces.messages.text` that matches a link preview + * pattern. For more information, see [Preview + * links](https://developers.google.com/workspace/chat/preview-links). + * + * Generated from protobuf field .google.chat.v1.MatchedUrl matched_url = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\MatchedUrl|null + */ + public function getMatchedUrl() + { + return $this->matched_url; + } + + public function hasMatchedUrl() + { + return isset($this->matched_url); + } + + public function clearMatchedUrl() + { + unset($this->matched_url); + } + + /** + * Output only. A URL in `spaces.messages.text` that matches a link preview + * pattern. For more information, see [Preview + * links](https://developers.google.com/workspace/chat/preview-links). + * + * Generated from protobuf field .google.chat.v1.MatchedUrl matched_url = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\MatchedUrl $var + * @return $this + */ + public function setMatchedUrl($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\MatchedUrl::class); + $this->matched_url = $var; + + return $this; + } + + /** + * Output only. When `true`, the message is a response in a reply thread. When + * `false`, the message is visible in the space's top-level conversation as + * either the first message of a thread or a message with no threaded replies. + * If the space doesn't support reply in threads, this field is always + * `false`. + * + * Generated from protobuf field bool thread_reply = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getThreadReply() + { + return $this->thread_reply; + } + + /** + * Output only. When `true`, the message is a response in a reply thread. When + * `false`, the message is visible in the space's top-level conversation as + * either the first message of a thread or a message with no threaded replies. + * If the space doesn't support reply in threads, this field is always + * `false`. + * + * Generated from protobuf field bool thread_reply = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setThreadReply($var) + { + GPBUtil::checkBool($var); + $this->thread_reply = $var; + + return $this; + } + + /** + * Optional. A custom ID for the message. You can use field to identify a + * message, or to get, delete, or update a message. To set a custom ID, + * specify the + * [`messageId`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#body.QUERY_PARAMETERS.message_id) + * field when you create the message. For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string client_assigned_message_id = 32; + * @return string + */ + public function getClientAssignedMessageId() + { + return $this->client_assigned_message_id; + } + + /** + * Optional. A custom ID for the message. You can use field to identify a + * message, or to get, delete, or update a message. To set a custom ID, + * specify the + * [`messageId`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages/create#body.QUERY_PARAMETERS.message_id) + * field when you create the message. For details, see [Name a + * message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). + * + * Generated from protobuf field string client_assigned_message_id = 32; + * @param string $var + * @return $this + */ + public function setClientAssignedMessageId($var) + { + GPBUtil::checkString($var, True); + $this->client_assigned_message_id = $var; + + return $this; + } + + /** + * Output only. The list of emoji reaction summaries on the message. + * + * Generated from protobuf field repeated .google.chat.v1.EmojiReactionSummary emoji_reaction_summaries = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEmojiReactionSummaries() + { + return $this->emoji_reaction_summaries; + } + + /** + * Output only. The list of emoji reaction summaries on the message. + * + * Generated from protobuf field repeated .google.chat.v1.EmojiReactionSummary emoji_reaction_summaries = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Apps\Chat\V1\EmojiReactionSummary>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEmojiReactionSummaries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\EmojiReactionSummary::class); + $this->emoji_reaction_summaries = $arr; + + return $this; + } + + /** + * Immutable. Input for creating a message, otherwise output only. The user + * that can view the message. When set, the message is private and only + * visible to the specified user and the Chat app. Link previews and + * attachments aren't supported for private messages. + * Only Chat apps can send private messages. If your Chat app [authenticates + * as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * to send a message, the message can't be private and must omit this field. + * For details, see [Send private messages to Google Chat + * users](https://developers.google.com/workspace/chat/private-messages). + * + * Generated from protobuf field .google.chat.v1.User private_message_viewer = 36 [(.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Apps\Chat\V1\User|null + */ + public function getPrivateMessageViewer() + { + return $this->private_message_viewer; + } + + public function hasPrivateMessageViewer() + { + return isset($this->private_message_viewer); + } + + public function clearPrivateMessageViewer() + { + unset($this->private_message_viewer); + } + + /** + * Immutable. Input for creating a message, otherwise output only. The user + * that can view the message. When set, the message is private and only + * visible to the specified user and the Chat app. Link previews and + * attachments aren't supported for private messages. + * Only Chat apps can send private messages. If your Chat app [authenticates + * as a + * user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * to send a message, the message can't be private and must omit this field. + * For details, see [Send private messages to Google Chat + * users](https://developers.google.com/workspace/chat/private-messages). + * + * Generated from protobuf field .google.chat.v1.User private_message_viewer = 36 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Apps\Chat\V1\User $var + * @return $this + */ + public function setPrivateMessageViewer($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\User::class); + $this->private_message_viewer = $var; + + return $this; + } + + /** + * Output only. Information about a deleted message. A message is deleted when + * `delete_time` is set. + * + * Generated from protobuf field .google.chat.v1.DeletionMetadata deletion_metadata = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\DeletionMetadata|null + */ + public function getDeletionMetadata() + { + return $this->deletion_metadata; + } + + public function hasDeletionMetadata() + { + return isset($this->deletion_metadata); + } + + public function clearDeletionMetadata() + { + unset($this->deletion_metadata); + } + + /** + * Output only. Information about a deleted message. A message is deleted when + * `delete_time` is set. + * + * Generated from protobuf field .google.chat.v1.DeletionMetadata deletion_metadata = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\DeletionMetadata $var + * @return $this + */ + public function setDeletionMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\DeletionMetadata::class); + $this->deletion_metadata = $var; + + return $this; + } + + /** + * Output only. Information about a message that's quoted by a Google Chat + * user in a space. Google Chat users can quote a message to reply to it. + * + * Generated from protobuf field .google.chat.v1.QuotedMessageMetadata quoted_message_metadata = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\QuotedMessageMetadata|null + */ + public function getQuotedMessageMetadata() + { + return $this->quoted_message_metadata; + } + + public function hasQuotedMessageMetadata() + { + return isset($this->quoted_message_metadata); + } + + public function clearQuotedMessageMetadata() + { + unset($this->quoted_message_metadata); + } + + /** + * Output only. Information about a message that's quoted by a Google Chat + * user in a space. Google Chat users can quote a message to reply to it. + * + * Generated from protobuf field .google.chat.v1.QuotedMessageMetadata quoted_message_metadata = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\QuotedMessageMetadata $var + * @return $this + */ + public function setQuotedMessageMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\QuotedMessageMetadata::class); + $this->quoted_message_metadata = $var; + + return $this; + } + + /** + * Output only. GIF images that are attached to the message. + * + * Generated from protobuf field repeated .google.chat.v1.AttachedGif attached_gifs = 42 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttachedGifs() + { + return $this->attached_gifs; + } + + /** + * Output only. GIF images that are attached to the message. + * + * Generated from protobuf field repeated .google.chat.v1.AttachedGif attached_gifs = 42 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Apps\Chat\V1\AttachedGif>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttachedGifs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\AttachedGif::class); + $this->attached_gifs = $arr; + + return $this; + } + + /** + * One or more interactive widgets that appear at the bottom of a message. + * You can add accessory widgets to messages that contain text, cards, or both + * text and cards. Not supported for messages that contain dialogs. For + * details, see [Add interactive widgets at the bottom of a + * message](https://developers.google.com/workspace/chat/create-messages#add-accessory-widgets). + * Creating a message with accessory widgets requires [app + * authentication] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * Generated from protobuf field repeated .google.chat.v1.AccessoryWidget accessory_widgets = 44; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAccessoryWidgets() + { + return $this->accessory_widgets; + } + + /** + * One or more interactive widgets that appear at the bottom of a message. + * You can add accessory widgets to messages that contain text, cards, or both + * text and cards. Not supported for messages that contain dialogs. For + * details, see [Add interactive widgets at the bottom of a + * message](https://developers.google.com/workspace/chat/create-messages#add-accessory-widgets). + * Creating a message with accessory widgets requires [app + * authentication] + * (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). + * + * Generated from protobuf field repeated .google.chat.v1.AccessoryWidget accessory_widgets = 44; + * @param array<\Google\Apps\Chat\V1\AccessoryWidget>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAccessoryWidgets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\AccessoryWidget::class); + $this->accessory_widgets = $arr; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/QuotedMessageMetadata.php b/AppsChat/src/Chat/V1/QuotedMessageMetadata.php new file mode 100644 index 000000000000..776a4ab987d7 --- /dev/null +++ b/AppsChat/src/Chat/V1/QuotedMessageMetadata.php @@ -0,0 +1,119 @@ +google.chat.v1.QuotedMessageMetadata + */ +class QuotedMessageMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Resource name of the quoted message. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Output only. The timestamp when the quoted message was created or when the + * quoted message was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $last_update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Resource name of the quoted message. + * Format: `spaces/{space}/messages/{message}` + * @type \Google\Protobuf\Timestamp $last_update_time + * Output only. The timestamp when the quoted message was created or when the + * quoted message was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Resource name of the quoted message. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Resource name of the quoted message. + * Format: `spaces/{space}/messages/{message}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The timestamp when the quoted message was created or when the + * quoted message was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateTime() + { + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + unset($this->last_update_time); + } + + /** + * Output only. The timestamp when the quoted message was created or when the + * quoted message was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Reaction.php b/AppsChat/src/Chat/V1/Reaction.php new file mode 100644 index 000000000000..373aec899eaf --- /dev/null +++ b/AppsChat/src/Chat/V1/Reaction.php @@ -0,0 +1,159 @@ +google.chat.v1.Reaction + */ +class Reaction extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the reaction. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The user who created the reaction. + * + * Generated from protobuf field .google.chat.v1.User user = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $user = null; + /** + * The emoji used in the reaction. + * + * Generated from protobuf field .google.chat.v1.Emoji emoji = 3; + */ + protected $emoji = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the reaction. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * @type \Google\Apps\Chat\V1\User $user + * Output only. The user who created the reaction. + * @type \Google\Apps\Chat\V1\Emoji $emoji + * The emoji used in the reaction. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Reaction::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the reaction. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the reaction. + * Format: `spaces/{space}/messages/{message}/reactions/{reaction}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The user who created the reaction. + * + * Generated from protobuf field .google.chat.v1.User user = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Apps\Chat\V1\User|null + */ + public function getUser() + { + return $this->user; + } + + public function hasUser() + { + return isset($this->user); + } + + public function clearUser() + { + unset($this->user); + } + + /** + * Output only. The user who created the reaction. + * + * Generated from protobuf field .google.chat.v1.User user = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Apps\Chat\V1\User $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\User::class); + $this->user = $var; + + return $this; + } + + /** + * The emoji used in the reaction. + * + * Generated from protobuf field .google.chat.v1.Emoji emoji = 3; + * @return \Google\Apps\Chat\V1\Emoji|null + */ + public function getEmoji() + { + return $this->emoji; + } + + public function hasEmoji() + { + return isset($this->emoji); + } + + public function clearEmoji() + { + unset($this->emoji); + } + + /** + * The emoji used in the reaction. + * + * Generated from protobuf field .google.chat.v1.Emoji emoji = 3; + * @param \Google\Apps\Chat\V1\Emoji $var + * @return $this + */ + public function setEmoji($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Emoji::class); + $this->emoji = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/RichLinkMetadata.php b/AppsChat/src/Chat/V1/RichLinkMetadata.php new file mode 100644 index 000000000000..bd348864d3a0 --- /dev/null +++ b/AppsChat/src/Chat/V1/RichLinkMetadata.php @@ -0,0 +1,143 @@ +google.chat.v1.RichLinkMetadata + */ +class RichLinkMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The URI of this link. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * The rich link type. + * + * Generated from protobuf field .google.chat.v1.RichLinkMetadata.RichLinkType rich_link_type = 2; + */ + protected $rich_link_type = 0; + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * The URI of this link. + * @type int $rich_link_type + * The rich link type. + * @type \Google\Apps\Chat\V1\DriveLinkData $drive_link_data + * Data for a drive link. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Annotation::initOnce(); + parent::__construct($data); + } + + /** + * The URI of this link. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The URI of this link. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * The rich link type. + * + * Generated from protobuf field .google.chat.v1.RichLinkMetadata.RichLinkType rich_link_type = 2; + * @return int + */ + public function getRichLinkType() + { + return $this->rich_link_type; + } + + /** + * The rich link type. + * + * Generated from protobuf field .google.chat.v1.RichLinkMetadata.RichLinkType rich_link_type = 2; + * @param int $var + * @return $this + */ + public function setRichLinkType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\RichLinkMetadata\RichLinkType::class); + $this->rich_link_type = $var; + + return $this; + } + + /** + * Data for a drive link. + * + * Generated from protobuf field .google.chat.v1.DriveLinkData drive_link_data = 3; + * @return \Google\Apps\Chat\V1\DriveLinkData|null + */ + public function getDriveLinkData() + { + return $this->readOneof(3); + } + + public function hasDriveLinkData() + { + return $this->hasOneof(3); + } + + /** + * Data for a drive link. + * + * Generated from protobuf field .google.chat.v1.DriveLinkData drive_link_data = 3; + * @param \Google\Apps\Chat\V1\DriveLinkData $var + * @return $this + */ + public function setDriveLinkData($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\DriveLinkData::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + diff --git a/AppsChat/src/Chat/V1/RichLinkMetadata/RichLinkType.php b/AppsChat/src/Chat/V1/RichLinkMetadata/RichLinkType.php new file mode 100644 index 000000000000..f77ded10b072 --- /dev/null +++ b/AppsChat/src/Chat/V1/RichLinkMetadata/RichLinkType.php @@ -0,0 +1,55 @@ +google.chat.v1.RichLinkMetadata.RichLinkType + */ +class RichLinkType +{ + /** + * Default value for the enum. Don't use. + * + * Generated from protobuf enum RICH_LINK_TYPE_UNSPECIFIED = 0; + */ + const RICH_LINK_TYPE_UNSPECIFIED = 0; + /** + * A Google Drive rich link type. + * + * Generated from protobuf enum DRIVE_FILE = 1; + */ + const DRIVE_FILE = 1; + + private static $valueToName = [ + self::RICH_LINK_TYPE_UNSPECIFIED => 'RICH_LINK_TYPE_UNSPECIFIED', + self::DRIVE_FILE => 'DRIVE_FILE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/SetUpSpaceRequest.php b/AppsChat/src/Chat/V1/SetUpSpaceRequest.php new file mode 100644 index 000000000000..5051e3a70944 --- /dev/null +++ b/AppsChat/src/Chat/V1/SetUpSpaceRequest.php @@ -0,0 +1,305 @@ +google.chat.v1.SetUpSpaceRequest + */ +class SetUpSpaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `Space.spaceType` field is required. + * To create a space, set `Space.spaceType` to `SPACE` and set + * `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when + * setting up a space, try a different `displayName`. An existing space + * within the Google Workspace organization might already use this display + * name. + * To create a group chat, set `Space.spaceType` to + * `GROUP_CHAT`. Don't set `Space.displayName`. + * To create a 1:1 conversation between humans, + * set `Space.spaceType` to `DIRECT_MESSAGE` and set + * `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * To create an 1:1 conversation between a human and the calling Chat app, set + * `Space.spaceType` to `DIRECT_MESSAGE` and + * `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * If a `DIRECT_MESSAGE` space already exists, that space is returned instead + * of creating a new space. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $space = null; + /** + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The Google Chat users to invite to join the space. Omit the + * calling user, as they are added automatically. + * The set currently allows up to 20 memberships (in addition to the caller). + * The `Membership.member` field must contain a `user` with `name` populated + * (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only + * add human users when setting up a space (adding Chat apps is only supported + * for direct message setup with the calling app). You can also add members + * using the user's email as an alias for {user}. For example, the `user.name` + * can be `users/example@gmail.com`." To invite Gmail users or users from + * external Google Workspace domains, user's email must be used for + * `{user}`. + * Optional when setting `Space.spaceType` to `SPACE`. + * Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at + * least two memberships. + * Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human + * user, along with exactly one membership. + * Must be empty when creating a 1:1 conversation between a human and the + * calling Chat app (when setting `Space.spaceType` to + * `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`). + * + * Generated from protobuf field repeated .google.chat.v1.Membership memberships = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $memberships; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Space $space + * Required. The `Space.spaceType` field is required. + * To create a space, set `Space.spaceType` to `SPACE` and set + * `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when + * setting up a space, try a different `displayName`. An existing space + * within the Google Workspace organization might already use this display + * name. + * To create a group chat, set `Space.spaceType` to + * `GROUP_CHAT`. Don't set `Space.displayName`. + * To create a 1:1 conversation between humans, + * set `Space.spaceType` to `DIRECT_MESSAGE` and set + * `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * To create an 1:1 conversation between a human and the calling Chat app, set + * `Space.spaceType` to `DIRECT_MESSAGE` and + * `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * If a `DIRECT_MESSAGE` space already exists, that space is returned instead + * of creating a new space. + * @type string $request_id + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * @type array<\Google\Apps\Chat\V1\Membership>|\Google\Protobuf\Internal\RepeatedField $memberships + * Optional. The Google Chat users to invite to join the space. Omit the + * calling user, as they are added automatically. + * The set currently allows up to 20 memberships (in addition to the caller). + * The `Membership.member` field must contain a `user` with `name` populated + * (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only + * add human users when setting up a space (adding Chat apps is only supported + * for direct message setup with the calling app). You can also add members + * using the user's email as an alias for {user}. For example, the `user.name` + * can be `users/example@gmail.com`." To invite Gmail users or users from + * external Google Workspace domains, user's email must be used for + * `{user}`. + * Optional when setting `Space.spaceType` to `SPACE`. + * Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at + * least two memberships. + * Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human + * user, along with exactly one membership. + * Must be empty when creating a 1:1 conversation between a human and the + * calling Chat app (when setting `Space.spaceType` to + * `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\SpaceSetup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `Space.spaceType` field is required. + * To create a space, set `Space.spaceType` to `SPACE` and set + * `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when + * setting up a space, try a different `displayName`. An existing space + * within the Google Workspace organization might already use this display + * name. + * To create a group chat, set `Space.spaceType` to + * `GROUP_CHAT`. Don't set `Space.displayName`. + * To create a 1:1 conversation between humans, + * set `Space.spaceType` to `DIRECT_MESSAGE` and set + * `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * To create an 1:1 conversation between a human and the calling Chat app, set + * `Space.spaceType` to `DIRECT_MESSAGE` and + * `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * If a `DIRECT_MESSAGE` space already exists, that space is returned instead + * of creating a new space. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Space|null + */ + public function getSpace() + { + return $this->space; + } + + public function hasSpace() + { + return isset($this->space); + } + + public function clearSpace() + { + unset($this->space); + } + + /** + * Required. The `Space.spaceType` field is required. + * To create a space, set `Space.spaceType` to `SPACE` and set + * `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when + * setting up a space, try a different `displayName`. An existing space + * within the Google Workspace organization might already use this display + * name. + * To create a group chat, set `Space.spaceType` to + * `GROUP_CHAT`. Don't set `Space.displayName`. + * To create a 1:1 conversation between humans, + * set `Space.spaceType` to `DIRECT_MESSAGE` and set + * `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * To create an 1:1 conversation between a human and the calling Chat app, set + * `Space.spaceType` to `DIRECT_MESSAGE` and + * `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or + * `Space.spaceDetails`. + * If a `DIRECT_MESSAGE` space already exists, that space is returned instead + * of creating a new space. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Space $var + * @return $this + */ + public function setSpace($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Space::class); + $this->space = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. + * A random UUID is recommended. + * Specifying an existing request ID returns the space created with that ID + * instead of creating a new space. + * Specifying an existing request ID from the same Chat app with a different + * authenticated user returns an error. + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The Google Chat users to invite to join the space. Omit the + * calling user, as they are added automatically. + * The set currently allows up to 20 memberships (in addition to the caller). + * The `Membership.member` field must contain a `user` with `name` populated + * (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only + * add human users when setting up a space (adding Chat apps is only supported + * for direct message setup with the calling app). You can also add members + * using the user's email as an alias for {user}. For example, the `user.name` + * can be `users/example@gmail.com`." To invite Gmail users or users from + * external Google Workspace domains, user's email must be used for + * `{user}`. + * Optional when setting `Space.spaceType` to `SPACE`. + * Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at + * least two memberships. + * Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human + * user, along with exactly one membership. + * Must be empty when creating a 1:1 conversation between a human and the + * calling Chat app (when setting `Space.spaceType` to + * `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`). + * + * Generated from protobuf field repeated .google.chat.v1.Membership memberships = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMemberships() + { + return $this->memberships; + } + + /** + * Optional. The Google Chat users to invite to join the space. Omit the + * calling user, as they are added automatically. + * The set currently allows up to 20 memberships (in addition to the caller). + * The `Membership.member` field must contain a `user` with `name` populated + * (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only + * add human users when setting up a space (adding Chat apps is only supported + * for direct message setup with the calling app). You can also add members + * using the user's email as an alias for {user}. For example, the `user.name` + * can be `users/example@gmail.com`." To invite Gmail users or users from + * external Google Workspace domains, user's email must be used for + * `{user}`. + * Optional when setting `Space.spaceType` to `SPACE`. + * Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at + * least two memberships. + * Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human + * user, along with exactly one membership. + * Must be empty when creating a 1:1 conversation between a human and the + * calling Chat app (when setting `Space.spaceType` to + * `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`). + * + * Generated from protobuf field repeated .google.chat.v1.Membership memberships = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Apps\Chat\V1\Membership>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMemberships($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\Membership::class); + $this->memberships = $arr; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/SlashCommand.php b/AppsChat/src/Chat/V1/SlashCommand.php new file mode 100644 index 000000000000..07f44423d3b2 --- /dev/null +++ b/AppsChat/src/Chat/V1/SlashCommand.php @@ -0,0 +1,69 @@ +google.chat.v1.SlashCommand + */ +class SlashCommand extends \Google\Protobuf\Internal\Message +{ + /** + * The ID of the slash command invoked. + * + * Generated from protobuf field int64 command_id = 1; + */ + protected $command_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $command_id + * The ID of the slash command invoked. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\SlashCommand::initOnce(); + parent::__construct($data); + } + + /** + * The ID of the slash command invoked. + * + * Generated from protobuf field int64 command_id = 1; + * @return int|string + */ + public function getCommandId() + { + return $this->command_id; + } + + /** + * The ID of the slash command invoked. + * + * Generated from protobuf field int64 command_id = 1; + * @param int|string $var + * @return $this + */ + public function setCommandId($var) + { + GPBUtil::checkInt64($var); + $this->command_id = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/SlashCommandMetadata.php b/AppsChat/src/Chat/V1/SlashCommandMetadata.php new file mode 100644 index 000000000000..316532e5b3ee --- /dev/null +++ b/AppsChat/src/Chat/V1/SlashCommandMetadata.php @@ -0,0 +1,213 @@ +google.chat.v1.SlashCommandMetadata + */ +class SlashCommandMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The Chat app whose command was invoked. + * + * Generated from protobuf field .google.chat.v1.User bot = 1; + */ + protected $bot = null; + /** + * The type of slash command. + * + * Generated from protobuf field .google.chat.v1.SlashCommandMetadata.Type type = 2; + */ + protected $type = 0; + /** + * The name of the invoked slash command. + * + * Generated from protobuf field string command_name = 3; + */ + protected $command_name = ''; + /** + * The command ID of the invoked slash command. + * + * Generated from protobuf field int64 command_id = 4; + */ + protected $command_id = 0; + /** + * Indicates whether the slash command is for a dialog. + * + * Generated from protobuf field bool triggers_dialog = 5; + */ + protected $triggers_dialog = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\User $bot + * The Chat app whose command was invoked. + * @type int $type + * The type of slash command. + * @type string $command_name + * The name of the invoked slash command. + * @type int|string $command_id + * The command ID of the invoked slash command. + * @type bool $triggers_dialog + * Indicates whether the slash command is for a dialog. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Annotation::initOnce(); + parent::__construct($data); + } + + /** + * The Chat app whose command was invoked. + * + * Generated from protobuf field .google.chat.v1.User bot = 1; + * @return \Google\Apps\Chat\V1\User|null + */ + public function getBot() + { + return $this->bot; + } + + public function hasBot() + { + return isset($this->bot); + } + + public function clearBot() + { + unset($this->bot); + } + + /** + * The Chat app whose command was invoked. + * + * Generated from protobuf field .google.chat.v1.User bot = 1; + * @param \Google\Apps\Chat\V1\User $var + * @return $this + */ + public function setBot($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\User::class); + $this->bot = $var; + + return $this; + } + + /** + * The type of slash command. + * + * Generated from protobuf field .google.chat.v1.SlashCommandMetadata.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of slash command. + * + * Generated from protobuf field .google.chat.v1.SlashCommandMetadata.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\SlashCommandMetadata\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The name of the invoked slash command. + * + * Generated from protobuf field string command_name = 3; + * @return string + */ + public function getCommandName() + { + return $this->command_name; + } + + /** + * The name of the invoked slash command. + * + * Generated from protobuf field string command_name = 3; + * @param string $var + * @return $this + */ + public function setCommandName($var) + { + GPBUtil::checkString($var, True); + $this->command_name = $var; + + return $this; + } + + /** + * The command ID of the invoked slash command. + * + * Generated from protobuf field int64 command_id = 4; + * @return int|string + */ + public function getCommandId() + { + return $this->command_id; + } + + /** + * The command ID of the invoked slash command. + * + * Generated from protobuf field int64 command_id = 4; + * @param int|string $var + * @return $this + */ + public function setCommandId($var) + { + GPBUtil::checkInt64($var); + $this->command_id = $var; + + return $this; + } + + /** + * Indicates whether the slash command is for a dialog. + * + * Generated from protobuf field bool triggers_dialog = 5; + * @return bool + */ + public function getTriggersDialog() + { + return $this->triggers_dialog; + } + + /** + * Indicates whether the slash command is for a dialog. + * + * Generated from protobuf field bool triggers_dialog = 5; + * @param bool $var + * @return $this + */ + public function setTriggersDialog($var) + { + GPBUtil::checkBool($var); + $this->triggers_dialog = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/SlashCommandMetadata/Type.php b/AppsChat/src/Chat/V1/SlashCommandMetadata/Type.php new file mode 100644 index 000000000000..b96b8e408023 --- /dev/null +++ b/AppsChat/src/Chat/V1/SlashCommandMetadata/Type.php @@ -0,0 +1,60 @@ +google.chat.v1.SlashCommandMetadata.Type + */ +class Type +{ + /** + * Default value for the enum. Don't use. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Add Chat app to space. + * + * Generated from protobuf enum ADD = 1; + */ + const ADD = 1; + /** + * Invoke slash command in space. + * + * Generated from protobuf enum INVOKE = 2; + */ + const INVOKE = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ADD => 'ADD', + self::INVOKE => 'INVOKE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Space.php b/AppsChat/src/Chat/V1/Space.php new file mode 100644 index 000000000000..9164e82839b9 --- /dev/null +++ b/AppsChat/src/Chat/V1/Space.php @@ -0,0 +1,658 @@ +google.chat.v1.Space + */ +class Space extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the space. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. Deprecated: Use `space_type` instead. + * The type of a space. + * + * Generated from protobuf field .google.chat.v1.Space.Type type = 2 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @deprecated + */ + protected $type = 0; + /** + * The type of space. Required when creating a space or updating the space + * type of a space. Output only for other usage. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceType space_type = 10; + */ + protected $space_type = 0; + /** + * Optional. Whether the space is a DM between a Chat app and a single + * human. + * + * Generated from protobuf field bool single_user_bot_dm = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $single_user_bot_dm = false; + /** + * Output only. Deprecated: Use `spaceThreadingState` instead. + * Whether messages are threaded in this space. + * + * Generated from protobuf field bool threaded = 5 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @deprecated + */ + protected $threaded = false; + /** + * The space's display name. Required when [creating a + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create). + * If you receive the error message `ALREADY_EXISTS` when creating a space or + * updating the `displayName`, try a different `displayName`. An + * existing space within the Google Workspace organization might already use + * this display name. + * For direct messages, this field might be empty. + * Supports up to 128 characters. + * + * Generated from protobuf field string display_name = 3; + */ + protected $display_name = ''; + /** + * Immutable. Whether this space permits any Google Chat user as a member. + * Input when creating a space in a Google Workspace organization. Omit this + * field when creating spaces in the following conditions: + * * The authenticated user uses a consumer account (unmanaged user + * account). By default, a space created by a consumer account permits any + * Google Chat user. + * * The space is used to [import data to Google Chat] + * (https://developers.google.com/chat/api/guides/import-data-overview) + * because import mode spaces must only permit members from the same + * Google Workspace organization. However, as part of the [Google + * Workspace Developer Preview + * Program](https://developers.google.com/workspace/preview), import mode + * spaces can permit any Google Chat user so this field can then be set + * for import mode spaces. + * For existing spaces, this field is output only. + * + * Generated from protobuf field bool external_user_allowed = 8 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $external_user_allowed = false; + /** + * Output only. The threading state in the Chat space. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceThreadingState space_threading_state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $space_threading_state = 0; + /** + * Details about the space including description and rules. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceDetails space_details = 11; + */ + protected $space_details = null; + /** + * The message history state for messages and threads in this space. + * + * Generated from protobuf field .google.chat.v1.HistoryState space_history_state = 13; + */ + protected $space_history_state = 0; + /** + * Optional. Whether this space is created in `Import Mode` as part of a data + * migration into Google Workspace. While spaces are being imported, they + * aren't visible to users until the import is complete. + * + * Generated from protobuf field bool import_mode = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $import_mode = false; + /** + * Optional. Immutable. For spaces created in Chat, the time the space was + * created. This field is output only, except when used in import mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the space was created in the source in order to preserve the original + * creation time. + * Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 17 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $create_time = null; + /** + * Output only. Whether the Chat app was installed by a Google Workspace + * administrator. Administrators can install a Chat app for their domain, + * organizational unit, or a group of users. + * Administrators can only install Chat apps for direct messaging between + * users and the app. To support admin install, your app must feature direct + * messaging. + * + * Generated from protobuf field bool admin_installed = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $admin_installed = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the space. + * Format: `spaces/{space}` + * @type int $type + * Output only. Deprecated: Use `space_type` instead. + * The type of a space. + * @type int $space_type + * The type of space. Required when creating a space or updating the space + * type of a space. Output only for other usage. + * @type bool $single_user_bot_dm + * Optional. Whether the space is a DM between a Chat app and a single + * human. + * @type bool $threaded + * Output only. Deprecated: Use `spaceThreadingState` instead. + * Whether messages are threaded in this space. + * @type string $display_name + * The space's display name. Required when [creating a + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create). + * If you receive the error message `ALREADY_EXISTS` when creating a space or + * updating the `displayName`, try a different `displayName`. An + * existing space within the Google Workspace organization might already use + * this display name. + * For direct messages, this field might be empty. + * Supports up to 128 characters. + * @type bool $external_user_allowed + * Immutable. Whether this space permits any Google Chat user as a member. + * Input when creating a space in a Google Workspace organization. Omit this + * field when creating spaces in the following conditions: + * * The authenticated user uses a consumer account (unmanaged user + * account). By default, a space created by a consumer account permits any + * Google Chat user. + * * The space is used to [import data to Google Chat] + * (https://developers.google.com/chat/api/guides/import-data-overview) + * because import mode spaces must only permit members from the same + * Google Workspace organization. However, as part of the [Google + * Workspace Developer Preview + * Program](https://developers.google.com/workspace/preview), import mode + * spaces can permit any Google Chat user so this field can then be set + * for import mode spaces. + * For existing spaces, this field is output only. + * @type int $space_threading_state + * Output only. The threading state in the Chat space. + * @type \Google\Apps\Chat\V1\Space\SpaceDetails $space_details + * Details about the space including description and rules. + * @type int $space_history_state + * The message history state for messages and threads in this space. + * @type bool $import_mode + * Optional. Whether this space is created in `Import Mode` as part of a data + * migration into Google Workspace. While spaces are being imported, they + * aren't visible to users until the import is complete. + * @type \Google\Protobuf\Timestamp $create_time + * Optional. Immutable. For spaces created in Chat, the time the space was + * created. This field is output only, except when used in import mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the space was created in the source in order to preserve the original + * creation time. + * Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`. + * @type bool $admin_installed + * Output only. Whether the Chat app was installed by a Google Workspace + * administrator. Administrators can install a Chat app for their domain, + * organizational unit, or a group of users. + * Administrators can only install Chat apps for direct messaging between + * users and the app. To support admin install, your app must feature direct + * messaging. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the space. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the space. + * Format: `spaces/{space}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Deprecated: Use `space_type` instead. + * The type of a space. + * + * Generated from protobuf field .google.chat.v1.Space.Type type = 2 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + * @deprecated + */ + public function getType() + { + @trigger_error('type is deprecated.', E_USER_DEPRECATED); + return $this->type; + } + + /** + * Output only. Deprecated: Use `space_type` instead. + * The type of a space. + * + * Generated from protobuf field .google.chat.v1.Space.Type type = 2 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + * @deprecated + */ + public function setType($var) + { + @trigger_error('type is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\Space\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The type of space. Required when creating a space or updating the space + * type of a space. Output only for other usage. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceType space_type = 10; + * @return int + */ + public function getSpaceType() + { + return $this->space_type; + } + + /** + * The type of space. Required when creating a space or updating the space + * type of a space. Output only for other usage. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceType space_type = 10; + * @param int $var + * @return $this + */ + public function setSpaceType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\Space\SpaceType::class); + $this->space_type = $var; + + return $this; + } + + /** + * Optional. Whether the space is a DM between a Chat app and a single + * human. + * + * Generated from protobuf field bool single_user_bot_dm = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getSingleUserBotDm() + { + return $this->single_user_bot_dm; + } + + /** + * Optional. Whether the space is a DM between a Chat app and a single + * human. + * + * Generated from protobuf field bool single_user_bot_dm = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setSingleUserBotDm($var) + { + GPBUtil::checkBool($var); + $this->single_user_bot_dm = $var; + + return $this; + } + + /** + * Output only. Deprecated: Use `spaceThreadingState` instead. + * Whether messages are threaded in this space. + * + * Generated from protobuf field bool threaded = 5 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + * @deprecated + */ + public function getThreaded() + { + @trigger_error('threaded is deprecated.', E_USER_DEPRECATED); + return $this->threaded; + } + + /** + * Output only. Deprecated: Use `spaceThreadingState` instead. + * Whether messages are threaded in this space. + * + * Generated from protobuf field bool threaded = 5 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setThreaded($var) + { + @trigger_error('threaded is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->threaded = $var; + + return $this; + } + + /** + * The space's display name. Required when [creating a + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create). + * If you receive the error message `ALREADY_EXISTS` when creating a space or + * updating the `displayName`, try a different `displayName`. An + * existing space within the Google Workspace organization might already use + * this display name. + * For direct messages, this field might be empty. + * Supports up to 128 characters. + * + * Generated from protobuf field string display_name = 3; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The space's display name. Required when [creating a + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create). + * If you receive the error message `ALREADY_EXISTS` when creating a space or + * updating the `displayName`, try a different `displayName`. An + * existing space within the Google Workspace organization might already use + * this display name. + * For direct messages, this field might be empty. + * Supports up to 128 characters. + * + * Generated from protobuf field string display_name = 3; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Immutable. Whether this space permits any Google Chat user as a member. + * Input when creating a space in a Google Workspace organization. Omit this + * field when creating spaces in the following conditions: + * * The authenticated user uses a consumer account (unmanaged user + * account). By default, a space created by a consumer account permits any + * Google Chat user. + * * The space is used to [import data to Google Chat] + * (https://developers.google.com/chat/api/guides/import-data-overview) + * because import mode spaces must only permit members from the same + * Google Workspace organization. However, as part of the [Google + * Workspace Developer Preview + * Program](https://developers.google.com/workspace/preview), import mode + * spaces can permit any Google Chat user so this field can then be set + * for import mode spaces. + * For existing spaces, this field is output only. + * + * Generated from protobuf field bool external_user_allowed = 8 [(.google.api.field_behavior) = IMMUTABLE]; + * @return bool + */ + public function getExternalUserAllowed() + { + return $this->external_user_allowed; + } + + /** + * Immutable. Whether this space permits any Google Chat user as a member. + * Input when creating a space in a Google Workspace organization. Omit this + * field when creating spaces in the following conditions: + * * The authenticated user uses a consumer account (unmanaged user + * account). By default, a space created by a consumer account permits any + * Google Chat user. + * * The space is used to [import data to Google Chat] + * (https://developers.google.com/chat/api/guides/import-data-overview) + * because import mode spaces must only permit members from the same + * Google Workspace organization. However, as part of the [Google + * Workspace Developer Preview + * Program](https://developers.google.com/workspace/preview), import mode + * spaces can permit any Google Chat user so this field can then be set + * for import mode spaces. + * For existing spaces, this field is output only. + * + * Generated from protobuf field bool external_user_allowed = 8 [(.google.api.field_behavior) = IMMUTABLE]; + * @param bool $var + * @return $this + */ + public function setExternalUserAllowed($var) + { + GPBUtil::checkBool($var); + $this->external_user_allowed = $var; + + return $this; + } + + /** + * Output only. The threading state in the Chat space. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceThreadingState space_threading_state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSpaceThreadingState() + { + return $this->space_threading_state; + } + + /** + * Output only. The threading state in the Chat space. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceThreadingState space_threading_state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSpaceThreadingState($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\Space\SpaceThreadingState::class); + $this->space_threading_state = $var; + + return $this; + } + + /** + * Details about the space including description and rules. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceDetails space_details = 11; + * @return \Google\Apps\Chat\V1\Space\SpaceDetails|null + */ + public function getSpaceDetails() + { + return $this->space_details; + } + + public function hasSpaceDetails() + { + return isset($this->space_details); + } + + public function clearSpaceDetails() + { + unset($this->space_details); + } + + /** + * Details about the space including description and rules. + * + * Generated from protobuf field .google.chat.v1.Space.SpaceDetails space_details = 11; + * @param \Google\Apps\Chat\V1\Space\SpaceDetails $var + * @return $this + */ + public function setSpaceDetails($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Space\SpaceDetails::class); + $this->space_details = $var; + + return $this; + } + + /** + * The message history state for messages and threads in this space. + * + * Generated from protobuf field .google.chat.v1.HistoryState space_history_state = 13; + * @return int + */ + public function getSpaceHistoryState() + { + return $this->space_history_state; + } + + /** + * The message history state for messages and threads in this space. + * + * Generated from protobuf field .google.chat.v1.HistoryState space_history_state = 13; + * @param int $var + * @return $this + */ + public function setSpaceHistoryState($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\HistoryState::class); + $this->space_history_state = $var; + + return $this; + } + + /** + * Optional. Whether this space is created in `Import Mode` as part of a data + * migration into Google Workspace. While spaces are being imported, they + * aren't visible to users until the import is complete. + * + * Generated from protobuf field bool import_mode = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getImportMode() + { + return $this->import_mode; + } + + /** + * Optional. Whether this space is created in `Import Mode` as part of a data + * migration into Google Workspace. While spaces are being imported, they + * aren't visible to users until the import is complete. + * + * Generated from protobuf field bool import_mode = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setImportMode($var) + { + GPBUtil::checkBool($var); + $this->import_mode = $var; + + return $this; + } + + /** + * Optional. Immutable. For spaces created in Chat, the time the space was + * created. This field is output only, except when used in import mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the space was created in the source in order to preserve the original + * creation time. + * Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 17 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Optional. Immutable. For spaces created in Chat, the time the space was + * created. This field is output only, except when used in import mode spaces. + * For import mode spaces, set this field to the historical timestamp at which + * the space was created in the source in order to preserve the original + * creation time. + * Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 17 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Whether the Chat app was installed by a Google Workspace + * administrator. Administrators can install a Chat app for their domain, + * organizational unit, or a group of users. + * Administrators can only install Chat apps for direct messaging between + * users and the app. To support admin install, your app must feature direct + * messaging. + * + * Generated from protobuf field bool admin_installed = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAdminInstalled() + { + return $this->admin_installed; + } + + /** + * Output only. Whether the Chat app was installed by a Google Workspace + * administrator. Administrators can install a Chat app for their domain, + * organizational unit, or a group of users. + * Administrators can only install Chat apps for direct messaging between + * users and the app. To support admin install, your app must feature direct + * messaging. + * + * Generated from protobuf field bool admin_installed = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAdminInstalled($var) + { + GPBUtil::checkBool($var); + $this->admin_installed = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/Space/SpaceDetails.php b/AppsChat/src/Chat/V1/Space/SpaceDetails.php new file mode 100644 index 000000000000..92ae7537b62c --- /dev/null +++ b/AppsChat/src/Chat/V1/Space/SpaceDetails.php @@ -0,0 +1,114 @@ +google.chat.v1.Space.SpaceDetails + */ +class SpaceDetails extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A description of the space. For example, describe the space's + * discussion topic, functional purpose, or participants. + * Supports up to 150 characters. + * + * Generated from protobuf field string description = 1; + */ + protected $description = ''; + /** + * Optional. The space's rules, expectations, and etiquette. + * Supports up to 5,000 characters. + * + * Generated from protobuf field string guidelines = 2; + */ + protected $guidelines = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $description + * Optional. A description of the space. For example, describe the space's + * discussion topic, functional purpose, or participants. + * Supports up to 150 characters. + * @type string $guidelines + * Optional. The space's rules, expectations, and etiquette. + * Supports up to 5,000 characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A description of the space. For example, describe the space's + * discussion topic, functional purpose, or participants. + * Supports up to 150 characters. + * + * Generated from protobuf field string description = 1; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. A description of the space. For example, describe the space's + * discussion topic, functional purpose, or participants. + * Supports up to 150 characters. + * + * Generated from protobuf field string description = 1; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. The space's rules, expectations, and etiquette. + * Supports up to 5,000 characters. + * + * Generated from protobuf field string guidelines = 2; + * @return string + */ + public function getGuidelines() + { + return $this->guidelines; + } + + /** + * Optional. The space's rules, expectations, and etiquette. + * Supports up to 5,000 characters. + * + * Generated from protobuf field string guidelines = 2; + * @param string $var + * @return $this + */ + public function setGuidelines($var) + { + GPBUtil::checkString($var, True); + $this->guidelines = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/Space/SpaceThreadingState.php b/AppsChat/src/Chat/V1/Space/SpaceThreadingState.php new file mode 100644 index 000000000000..445c079d953a --- /dev/null +++ b/AppsChat/src/Chat/V1/Space/SpaceThreadingState.php @@ -0,0 +1,73 @@ +google.chat.v1.Space.SpaceThreadingState + */ +class SpaceThreadingState +{ + /** + * Reserved. + * + * Generated from protobuf enum SPACE_THREADING_STATE_UNSPECIFIED = 0; + */ + const SPACE_THREADING_STATE_UNSPECIFIED = 0; + /** + * Named spaces that support message threads. When users respond to a + * message, they can reply in-thread, which keeps their response in the + * context of the original message. + * + * Generated from protobuf enum THREADED_MESSAGES = 2; + */ + const THREADED_MESSAGES = 2; + /** + * Named spaces where the conversation is organized by topic. Topics and + * their replies are grouped together. + * + * Generated from protobuf enum GROUPED_MESSAGES = 3; + */ + const GROUPED_MESSAGES = 3; + /** + * Direct messages (DMs) between two people and group conversations between + * 3 or more people. + * + * Generated from protobuf enum UNTHREADED_MESSAGES = 4; + */ + const UNTHREADED_MESSAGES = 4; + + private static $valueToName = [ + self::SPACE_THREADING_STATE_UNSPECIFIED => 'SPACE_THREADING_STATE_UNSPECIFIED', + self::THREADED_MESSAGES => 'THREADED_MESSAGES', + self::GROUPED_MESSAGES => 'GROUPED_MESSAGES', + self::UNTHREADED_MESSAGES => 'UNTHREADED_MESSAGES', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Space/SpaceType.php b/AppsChat/src/Chat/V1/Space/SpaceType.php new file mode 100644 index 000000000000..88e12bba4c49 --- /dev/null +++ b/AppsChat/src/Chat/V1/Space/SpaceType.php @@ -0,0 +1,72 @@ +google.chat.v1.Space.SpaceType + */ +class SpaceType +{ + /** + * Reserved. + * + * Generated from protobuf enum SPACE_TYPE_UNSPECIFIED = 0; + */ + const SPACE_TYPE_UNSPECIFIED = 0; + /** + * A place where people send messages, share files, and collaborate. + * A `SPACE` can include Chat apps. + * + * Generated from protobuf enum SPACE = 1; + */ + const SPACE = 1; + /** + * Group conversations between 3 or more people. + * A `GROUP_CHAT` can include Chat apps. + * + * Generated from protobuf enum GROUP_CHAT = 2; + */ + const GROUP_CHAT = 2; + /** + * 1:1 messages between two humans or a human and a Chat app. + * + * Generated from protobuf enum DIRECT_MESSAGE = 3; + */ + const DIRECT_MESSAGE = 3; + + private static $valueToName = [ + self::SPACE_TYPE_UNSPECIFIED => 'SPACE_TYPE_UNSPECIFIED', + self::SPACE => 'SPACE', + self::GROUP_CHAT => 'GROUP_CHAT', + self::DIRECT_MESSAGE => 'DIRECT_MESSAGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Space/Type.php b/AppsChat/src/Chat/V1/Space/Type.php new file mode 100644 index 000000000000..3abc63374c1c --- /dev/null +++ b/AppsChat/src/Chat/V1/Space/Type.php @@ -0,0 +1,63 @@ +google.chat.v1.Space.Type + */ +class Type +{ + /** + * Reserved. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Conversations between two or more humans. + * + * Generated from protobuf enum ROOM = 1; + */ + const ROOM = 1; + /** + * 1:1 Direct Message between a human and a Chat app, where all messages are + * flat. Note that this doesn't include direct messages between two humans. + * + * Generated from protobuf enum DM = 2; + */ + const DM = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ROOM => 'ROOM', + self::DM => 'DM', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/Thread.php b/AppsChat/src/Chat/V1/Thread.php new file mode 100644 index 000000000000..199a101cc358 --- /dev/null +++ b/AppsChat/src/Chat/V1/Thread.php @@ -0,0 +1,134 @@ +google.chat.v1.Thread + */ +class Thread extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Resource name of the thread. + * Example: `spaces/{space}/threads/{thread}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Optional. Input for creating or updating a thread. Otherwise, output only. + * ID for the thread. Supports up to 4000 characters. + * This ID is unique to the Chat app that sets it. For example, if + * multiple Chat apps create a message using the same thread key, + * the messages are posted in different threads. To reply in a + * thread created by a person or another Chat app, specify the thread `name` + * field instead. + * + * Generated from protobuf field string thread_key = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $thread_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Resource name of the thread. + * Example: `spaces/{space}/threads/{thread}` + * @type string $thread_key + * Optional. Input for creating or updating a thread. Otherwise, output only. + * ID for the thread. Supports up to 4000 characters. + * This ID is unique to the Chat app that sets it. For example, if + * multiple Chat apps create a message using the same thread key, + * the messages are posted in different threads. To reply in a + * thread created by a person or another Chat app, specify the thread `name` + * field instead. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Resource name of the thread. + * Example: `spaces/{space}/threads/{thread}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Resource name of the thread. + * Example: `spaces/{space}/threads/{thread}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. Input for creating or updating a thread. Otherwise, output only. + * ID for the thread. Supports up to 4000 characters. + * This ID is unique to the Chat app that sets it. For example, if + * multiple Chat apps create a message using the same thread key, + * the messages are posted in different threads. To reply in a + * thread created by a person or another Chat app, specify the thread `name` + * field instead. + * + * Generated from protobuf field string thread_key = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getThreadKey() + { + return $this->thread_key; + } + + /** + * Optional. Input for creating or updating a thread. Otherwise, output only. + * ID for the thread. Supports up to 4000 characters. + * This ID is unique to the Chat app that sets it. For example, if + * multiple Chat apps create a message using the same thread key, + * the messages are posted in different threads. To reply in a + * thread created by a person or another Chat app, specify the thread `name` + * field instead. + * + * Generated from protobuf field string thread_key = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setThreadKey($var) + { + GPBUtil::checkString($var, True); + $this->thread_key = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/UpdateMessageRequest.php b/AppsChat/src/Chat/V1/UpdateMessageRequest.php new file mode 100644 index 000000000000..338ec6bf863c --- /dev/null +++ b/AppsChat/src/Chat/V1/UpdateMessageRequest.php @@ -0,0 +1,238 @@ +google.chat.v1.UpdateMessageRequest + */ +class UpdateMessageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Message with fields updated. + * + * Generated from protobuf field .google.chat.v1.Message message = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $message = null; + /** + * Required. The field paths to update. Separate multiple values with commas + * or use `*` to update all field paths. + * Currently supported field paths: + * - `text` + * - `attachment` + * - `cards` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `cards_v2` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `accessory_widgets` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + /** + * Optional. If `true` and the message isn't found, a new message is created + * and `updateMask` is ignored. The specified message ID must be + * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message) + * or the request fails. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * @param \Google\Apps\Chat\V1\Message $message Required. Message with fields updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. The field paths to update. Separate multiple values with commas + * or use `*` to update all field paths. + * + * Currently supported field paths: + * + * - `text` + * + * - `attachment` + * + * - `cards` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * + * - `cards_v2` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * + * - `accessory_widgets` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * + * @return \Google\Apps\Chat\V1\UpdateMessageRequest + * + * @experimental + */ + public static function build(\Google\Apps\Chat\V1\Message $message, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setMessage($message) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Message $message + * Required. Message with fields updated. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The field paths to update. Separate multiple values with commas + * or use `*` to update all field paths. + * Currently supported field paths: + * - `text` + * - `attachment` + * - `cards` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `cards_v2` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `accessory_widgets` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * @type bool $allow_missing + * Optional. If `true` and the message isn't found, a new message is created + * and `updateMask` is ignored. The specified message ID must be + * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message) + * or the request fails. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Message::initOnce(); + parent::__construct($data); + } + + /** + * Required. Message with fields updated. + * + * Generated from protobuf field .google.chat.v1.Message message = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Message|null + */ + public function getMessage() + { + return $this->message; + } + + public function hasMessage() + { + return isset($this->message); + } + + public function clearMessage() + { + unset($this->message); + } + + /** + * Required. Message with fields updated. + * + * Generated from protobuf field .google.chat.v1.Message message = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Message $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Message::class); + $this->message = $var; + + return $this; + } + + /** + * Required. The field paths to update. Separate multiple values with commas + * or use `*` to update all field paths. + * Currently supported field paths: + * - `text` + * - `attachment` + * - `cards` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `cards_v2` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `accessory_widgets` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The field paths to update. Separate multiple values with commas + * or use `*` to update all field paths. + * Currently supported field paths: + * - `text` + * - `attachment` + * - `cards` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `cards_v2` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * - `accessory_widgets` (Requires [app + * authentication](/chat/api/guides/auth/service-accounts).) + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. If `true` and the message isn't found, a new message is created + * and `updateMask` is ignored. The specified message ID must be + * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message) + * or the request fails. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If `true` and the message isn't found, a new message is created + * and `updateMask` is ignored. The specified message ID must be + * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message) + * or the request fails. + * + * Generated from protobuf field bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/UpdateSpaceRequest.php b/AppsChat/src/Chat/V1/UpdateSpaceRequest.php new file mode 100644 index 000000000000..b612dda4892f --- /dev/null +++ b/AppsChat/src/Chat/V1/UpdateSpaceRequest.php @@ -0,0 +1,292 @@ +google.chat.v1.UpdateSpaceRequest + */ +class UpdateSpaceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Space with fields to be updated. `Space.name` must be + * populated in the form of `spaces/{space}`. Only fields + * specified by `update_mask` are updated. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $space = null; + /** + * Required. The updated field paths, comma separated if there are + * multiple. + * Currently supported field paths: + * - `display_name` (Only supports changing the display name of a space with + * the `SPACE` type, or when also including the `space_type` mask to change a + * `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a + * `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument + * error. If you receive the error message `ALREADY_EXISTS` when updating the + * `displayName`, try a different `displayName`. An existing space within the + * Google Workspace organization might already use this display name.) + * - `space_type` (Only supports changing a `GROUP_CHAT` space type to + * `SPACE`. Include `display_name` together + * with `space_type` in the update mask and ensure that the specified space + * has a non-empty display name and the `SPACE` space type. Including the + * `space_type` mask and the `SPACE` type in the specified space when updating + * the display name is optional if the existing space already has the `SPACE` + * type. Trying to update the space type in other ways results in an invalid + * argument error). + * - `space_details` + * - `space_history_state` (Supports [turning history on or off for the + * space](https://support.google.com/chat/answer/7664687) if [the organization + * allows users to change their history + * setting](https://support.google.com/a/answer/7664184). + * Warning: mutually exclusive with all other field paths.) + * - Developer Preview: `access_settings.audience` (Supports changing the + * [access setting](https://support.google.com/chat/answer/11971020) of a + * space. If no audience is specified in the access setting, the space's + * access setting is updated to restricted. Warning: mutually exclusive with + * all other field paths.) + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Apps\Chat\V1\Space $space Required. Space with fields to be updated. `Space.name` must be + * populated in the form of `spaces/{space}`. Only fields + * specified by `update_mask` are updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. The updated field paths, comma separated if there are + * multiple. + * + * Currently supported field paths: + * + * - `display_name` (Only supports changing the display name of a space with + * the `SPACE` type, or when also including the `space_type` mask to change a + * `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a + * `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument + * error. If you receive the error message `ALREADY_EXISTS` when updating the + * `displayName`, try a different `displayName`. An existing space within the + * Google Workspace organization might already use this display name.) + * + * - `space_type` (Only supports changing a `GROUP_CHAT` space type to + * `SPACE`. Include `display_name` together + * with `space_type` in the update mask and ensure that the specified space + * has a non-empty display name and the `SPACE` space type. Including the + * `space_type` mask and the `SPACE` type in the specified space when updating + * the display name is optional if the existing space already has the `SPACE` + * type. Trying to update the space type in other ways results in an invalid + * argument error). + * + * - `space_details` + * + * - `space_history_state` (Supports [turning history on or off for the + * space](https://support.google.com/chat/answer/7664687) if [the organization + * allows users to change their history + * setting](https://support.google.com/a/answer/7664184). + * Warning: mutually exclusive with all other field paths.) + * + * - Developer Preview: `access_settings.audience` (Supports changing the + * [access setting](https://support.google.com/chat/answer/11971020) of a + * space. If no audience is specified in the access setting, the space's + * access setting is updated to restricted. Warning: mutually exclusive with + * all other field paths.) + * + * @return \Google\Apps\Chat\V1\UpdateSpaceRequest + * + * @experimental + */ + public static function build(\Google\Apps\Chat\V1\Space $space, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSpace($space) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\Space $space + * Required. Space with fields to be updated. `Space.name` must be + * populated in the form of `spaces/{space}`. Only fields + * specified by `update_mask` are updated. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The updated field paths, comma separated if there are + * multiple. + * Currently supported field paths: + * - `display_name` (Only supports changing the display name of a space with + * the `SPACE` type, or when also including the `space_type` mask to change a + * `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a + * `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument + * error. If you receive the error message `ALREADY_EXISTS` when updating the + * `displayName`, try a different `displayName`. An existing space within the + * Google Workspace organization might already use this display name.) + * - `space_type` (Only supports changing a `GROUP_CHAT` space type to + * `SPACE`. Include `display_name` together + * with `space_type` in the update mask and ensure that the specified space + * has a non-empty display name and the `SPACE` space type. Including the + * `space_type` mask and the `SPACE` type in the specified space when updating + * the display name is optional if the existing space already has the `SPACE` + * type. Trying to update the space type in other ways results in an invalid + * argument error). + * - `space_details` + * - `space_history_state` (Supports [turning history on or off for the + * space](https://support.google.com/chat/answer/7664687) if [the organization + * allows users to change their history + * setting](https://support.google.com/a/answer/7664184). + * Warning: mutually exclusive with all other field paths.) + * - Developer Preview: `access_settings.audience` (Supports changing the + * [access setting](https://support.google.com/chat/answer/11971020) of a + * space. If no audience is specified in the access setting, the space's + * access setting is updated to restricted. Warning: mutually exclusive with + * all other field paths.) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Space::initOnce(); + parent::__construct($data); + } + + /** + * Required. Space with fields to be updated. `Space.name` must be + * populated in the form of `spaces/{space}`. Only fields + * specified by `update_mask` are updated. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Chat\V1\Space|null + */ + public function getSpace() + { + return $this->space; + } + + public function hasSpace() + { + return isset($this->space); + } + + public function clearSpace() + { + unset($this->space); + } + + /** + * Required. Space with fields to be updated. `Space.name` must be + * populated in the form of `spaces/{space}`. Only fields + * specified by `update_mask` are updated. + * + * Generated from protobuf field .google.chat.v1.Space space = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Chat\V1\Space $var + * @return $this + */ + public function setSpace($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Space::class); + $this->space = $var; + + return $this; + } + + /** + * Required. The updated field paths, comma separated if there are + * multiple. + * Currently supported field paths: + * - `display_name` (Only supports changing the display name of a space with + * the `SPACE` type, or when also including the `space_type` mask to change a + * `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a + * `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument + * error. If you receive the error message `ALREADY_EXISTS` when updating the + * `displayName`, try a different `displayName`. An existing space within the + * Google Workspace organization might already use this display name.) + * - `space_type` (Only supports changing a `GROUP_CHAT` space type to + * `SPACE`. Include `display_name` together + * with `space_type` in the update mask and ensure that the specified space + * has a non-empty display name and the `SPACE` space type. Including the + * `space_type` mask and the `SPACE` type in the specified space when updating + * the display name is optional if the existing space already has the `SPACE` + * type. Trying to update the space type in other ways results in an invalid + * argument error). + * - `space_details` + * - `space_history_state` (Supports [turning history on or off for the + * space](https://support.google.com/chat/answer/7664687) if [the organization + * allows users to change their history + * setting](https://support.google.com/a/answer/7664184). + * Warning: mutually exclusive with all other field paths.) + * - Developer Preview: `access_settings.audience` (Supports changing the + * [access setting](https://support.google.com/chat/answer/11971020) of a + * space. If no audience is specified in the access setting, the space's + * access setting is updated to restricted. Warning: mutually exclusive with + * all other field paths.) + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The updated field paths, comma separated if there are + * multiple. + * Currently supported field paths: + * - `display_name` (Only supports changing the display name of a space with + * the `SPACE` type, or when also including the `space_type` mask to change a + * `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a + * `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument + * error. If you receive the error message `ALREADY_EXISTS` when updating the + * `displayName`, try a different `displayName`. An existing space within the + * Google Workspace organization might already use this display name.) + * - `space_type` (Only supports changing a `GROUP_CHAT` space type to + * `SPACE`. Include `display_name` together + * with `space_type` in the update mask and ensure that the specified space + * has a non-empty display name and the `SPACE` space type. Including the + * `space_type` mask and the `SPACE` type in the specified space when updating + * the display name is optional if the existing space already has the `SPACE` + * type. Trying to update the space type in other ways results in an invalid + * argument error). + * - `space_details` + * - `space_history_state` (Supports [turning history on or off for the + * space](https://support.google.com/chat/answer/7664687) if [the organization + * allows users to change their history + * setting](https://support.google.com/a/answer/7664184). + * Warning: mutually exclusive with all other field paths.) + * - Developer Preview: `access_settings.audience` (Supports changing the + * [access setting](https://support.google.com/chat/answer/11971020) of a + * space. If no audience is specified in the access setting, the space's + * access setting is updated to restricted. Warning: mutually exclusive with + * all other field paths.) + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/UploadAttachmentRequest.php b/AppsChat/src/Chat/V1/UploadAttachmentRequest.php new file mode 100644 index 000000000000..2afa91efd97d --- /dev/null +++ b/AppsChat/src/Chat/V1/UploadAttachmentRequest.php @@ -0,0 +1,105 @@ +google.chat.v1.UploadAttachmentRequest + */ +class UploadAttachmentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the Chat space in which the attachment is + * uploaded. Format "spaces/{space}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The filename of the attachment, including the file extension. + * + * Generated from protobuf field string filename = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filename = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the Chat space in which the attachment is + * uploaded. Format "spaces/{space}". + * @type string $filename + * Required. The filename of the attachment, including the file extension. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Attachment::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the Chat space in which the attachment is + * uploaded. Format "spaces/{space}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the Chat space in which the attachment is + * uploaded. Format "spaces/{space}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The filename of the attachment, including the file extension. + * + * Generated from protobuf field string filename = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Required. The filename of the attachment, including the file extension. + * + * Generated from protobuf field string filename = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilename($var) + { + GPBUtil::checkString($var, True); + $this->filename = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/UploadAttachmentResponse.php b/AppsChat/src/Chat/V1/UploadAttachmentResponse.php new file mode 100644 index 000000000000..942c71f0fe3b --- /dev/null +++ b/AppsChat/src/Chat/V1/UploadAttachmentResponse.php @@ -0,0 +1,77 @@ +google.chat.v1.UploadAttachmentResponse + */ +class UploadAttachmentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Reference to the uploaded attachment. + * + * Generated from protobuf field .google.chat.v1.AttachmentDataRef attachment_data_ref = 1; + */ + protected $attachment_data_ref = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\AttachmentDataRef $attachment_data_ref + * Reference to the uploaded attachment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Attachment::initOnce(); + parent::__construct($data); + } + + /** + * Reference to the uploaded attachment. + * + * Generated from protobuf field .google.chat.v1.AttachmentDataRef attachment_data_ref = 1; + * @return \Google\Apps\Chat\V1\AttachmentDataRef|null + */ + public function getAttachmentDataRef() + { + return $this->attachment_data_ref; + } + + public function hasAttachmentDataRef() + { + return isset($this->attachment_data_ref); + } + + public function clearAttachmentDataRef() + { + unset($this->attachment_data_ref); + } + + /** + * Reference to the uploaded attachment. + * + * Generated from protobuf field .google.chat.v1.AttachmentDataRef attachment_data_ref = 1; + * @param \Google\Apps\Chat\V1\AttachmentDataRef $var + * @return $this + */ + public function setAttachmentDataRef($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\AttachmentDataRef::class); + $this->attachment_data_ref = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/User.php b/AppsChat/src/Chat/V1/User.php new file mode 100644 index 000000000000..87cb7134117f --- /dev/null +++ b/AppsChat/src/Chat/V1/User.php @@ -0,0 +1,275 @@ +google.chat.v1.User + */ +class User extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name for a Google Chat [user][google.chat.v1.User]. + * Format: `users/{user}`. `users/app` can be used as an alias for the calling + * app [bot][google.chat.v1.User.Type.BOT] user. + * For [human users][google.chat.v1.User.Type.HUMAN], `{user}` is the same + * user identifier as: + * - the `id` for the + * [Person](https://developers.google.com/people/api/rest/v1/people) in the + * People API. For example, `users/123456789` in Chat API represents the same + * person as the `123456789` Person profile ID in People API. + * - the `id` for a + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Admin SDK Directory API. + * - the user's email address can be used as an alias for `{user}` in API + * requests. For example, if the People API Person profile ID for + * `user@example.com` is `123456789`, you can use `users/user@example.com` as + * an alias to reference `users/123456789`. Only the canonical resource name + * (for example `users/123456789`) will be returned from the API. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The user's display name. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Unique identifier of the user's Google Workspace domain. + * + * Generated from protobuf field string domain_id = 6; + */ + protected $domain_id = ''; + /** + * User type. + * + * Generated from protobuf field .google.chat.v1.User.Type type = 5; + */ + protected $type = 0; + /** + * Output only. When `true`, the user is deleted or their profile is not + * visible. + * + * Generated from protobuf field bool is_anonymous = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $is_anonymous = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name for a Google Chat [user][google.chat.v1.User]. + * Format: `users/{user}`. `users/app` can be used as an alias for the calling + * app [bot][google.chat.v1.User.Type.BOT] user. + * For [human users][google.chat.v1.User.Type.HUMAN], `{user}` is the same + * user identifier as: + * - the `id` for the + * [Person](https://developers.google.com/people/api/rest/v1/people) in the + * People API. For example, `users/123456789` in Chat API represents the same + * person as the `123456789` Person profile ID in People API. + * - the `id` for a + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Admin SDK Directory API. + * - the user's email address can be used as an alias for `{user}` in API + * requests. For example, if the People API Person profile ID for + * `user@example.com` is `123456789`, you can use `users/user@example.com` as + * an alias to reference `users/123456789`. Only the canonical resource name + * (for example `users/123456789`) will be returned from the API. + * @type string $display_name + * Output only. The user's display name. + * @type string $domain_id + * Unique identifier of the user's Google Workspace domain. + * @type int $type + * User type. + * @type bool $is_anonymous + * Output only. When `true`, the user is deleted or their profile is not + * visible. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\User::initOnce(); + parent::__construct($data); + } + + /** + * Resource name for a Google Chat [user][google.chat.v1.User]. + * Format: `users/{user}`. `users/app` can be used as an alias for the calling + * app [bot][google.chat.v1.User.Type.BOT] user. + * For [human users][google.chat.v1.User.Type.HUMAN], `{user}` is the same + * user identifier as: + * - the `id` for the + * [Person](https://developers.google.com/people/api/rest/v1/people) in the + * People API. For example, `users/123456789` in Chat API represents the same + * person as the `123456789` Person profile ID in People API. + * - the `id` for a + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Admin SDK Directory API. + * - the user's email address can be used as an alias for `{user}` in API + * requests. For example, if the People API Person profile ID for + * `user@example.com` is `123456789`, you can use `users/user@example.com` as + * an alias to reference `users/123456789`. Only the canonical resource name + * (for example `users/123456789`) will be returned from the API. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name for a Google Chat [user][google.chat.v1.User]. + * Format: `users/{user}`. `users/app` can be used as an alias for the calling + * app [bot][google.chat.v1.User.Type.BOT] user. + * For [human users][google.chat.v1.User.Type.HUMAN], `{user}` is the same + * user identifier as: + * - the `id` for the + * [Person](https://developers.google.com/people/api/rest/v1/people) in the + * People API. For example, `users/123456789` in Chat API represents the same + * person as the `123456789` Person profile ID in People API. + * - the `id` for a + * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) + * in the Admin SDK Directory API. + * - the user's email address can be used as an alias for `{user}` in API + * requests. For example, if the People API Person profile ID for + * `user@example.com` is `123456789`, you can use `users/user@example.com` as + * an alias to reference `users/123456789`. Only the canonical resource name + * (for example `users/123456789`) will be returned from the API. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The user's display name. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The user's display name. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Unique identifier of the user's Google Workspace domain. + * + * Generated from protobuf field string domain_id = 6; + * @return string + */ + public function getDomainId() + { + return $this->domain_id; + } + + /** + * Unique identifier of the user's Google Workspace domain. + * + * Generated from protobuf field string domain_id = 6; + * @param string $var + * @return $this + */ + public function setDomainId($var) + { + GPBUtil::checkString($var, True); + $this->domain_id = $var; + + return $this; + } + + /** + * User type. + * + * Generated from protobuf field .google.chat.v1.User.Type type = 5; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * User type. + * + * Generated from protobuf field .google.chat.v1.User.Type type = 5; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\User\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. When `true`, the user is deleted or their profile is not + * visible. + * + * Generated from protobuf field bool is_anonymous = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getIsAnonymous() + { + return $this->is_anonymous; + } + + /** + * Output only. When `true`, the user is deleted or their profile is not + * visible. + * + * Generated from protobuf field bool is_anonymous = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setIsAnonymous($var) + { + GPBUtil::checkBool($var); + $this->is_anonymous = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/User/Type.php b/AppsChat/src/Chat/V1/User/Type.php new file mode 100644 index 000000000000..7d1767886f98 --- /dev/null +++ b/AppsChat/src/Chat/V1/User/Type.php @@ -0,0 +1,60 @@ +google.chat.v1.User.Type + */ +class Type +{ + /** + * Default value for the enum. DO NOT USE. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Human user. + * + * Generated from protobuf enum HUMAN = 1; + */ + const HUMAN = 1; + /** + * Chat app user. + * + * Generated from protobuf enum BOT = 2; + */ + const BOT = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::HUMAN => 'HUMAN', + self::BOT => 'BOT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/UserMentionMetadata.php b/AppsChat/src/Chat/V1/UserMentionMetadata.php new file mode 100644 index 000000000000..2ac7ee99c979 --- /dev/null +++ b/AppsChat/src/Chat/V1/UserMentionMetadata.php @@ -0,0 +1,111 @@ +google.chat.v1.UserMentionMetadata + */ +class UserMentionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The user mentioned. + * + * Generated from protobuf field .google.chat.v1.User user = 1; + */ + protected $user = null; + /** + * The type of user mention. + * + * Generated from protobuf field .google.chat.v1.UserMentionMetadata.Type type = 2; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\User $user + * The user mentioned. + * @type int $type + * The type of user mention. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Annotation::initOnce(); + parent::__construct($data); + } + + /** + * The user mentioned. + * + * Generated from protobuf field .google.chat.v1.User user = 1; + * @return \Google\Apps\Chat\V1\User|null + */ + public function getUser() + { + return $this->user; + } + + public function hasUser() + { + return isset($this->user); + } + + public function clearUser() + { + unset($this->user); + } + + /** + * The user mentioned. + * + * Generated from protobuf field .google.chat.v1.User user = 1; + * @param \Google\Apps\Chat\V1\User $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\User::class); + $this->user = $var; + + return $this; + } + + /** + * The type of user mention. + * + * Generated from protobuf field .google.chat.v1.UserMentionMetadata.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of user mention. + * + * Generated from protobuf field .google.chat.v1.UserMentionMetadata.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\UserMentionMetadata\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/AppsChat/src/Chat/V1/UserMentionMetadata/Type.php b/AppsChat/src/Chat/V1/UserMentionMetadata/Type.php new file mode 100644 index 000000000000..d49e4e9330a3 --- /dev/null +++ b/AppsChat/src/Chat/V1/UserMentionMetadata/Type.php @@ -0,0 +1,60 @@ +google.chat.v1.UserMentionMetadata.Type + */ +class Type +{ + /** + * Default value for the enum. Don't use. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Add user to space. + * + * Generated from protobuf enum ADD = 1; + */ + const ADD = 1; + /** + * Mention user in space. + * + * Generated from protobuf enum MENTION = 2; + */ + const MENTION = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ADD => 'ADD', + self::MENTION => 'MENTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup.php b/AppsChat/src/Chat/V1/WidgetMarkup.php new file mode 100644 index 000000000000..e247cc73adae --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup.php @@ -0,0 +1,179 @@ +google.chat.v1.WidgetMarkup + */ +class WidgetMarkup extends \Google\Protobuf\Internal\Message +{ + /** + * A list of buttons. Buttons is also `oneof data` and only one of these + * fields should be set. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup.Button buttons = 6; + */ + private $buttons; + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\WidgetMarkup\TextParagraph $text_paragraph + * Display a text paragraph in this widget. + * @type \Google\Apps\Chat\V1\WidgetMarkup\Image $image + * Display an image in this widget. + * @type \Google\Apps\Chat\V1\WidgetMarkup\KeyValue $key_value + * Display a key value item in this widget. + * @type array<\Google\Apps\Chat\V1\WidgetMarkup\Button>|\Google\Protobuf\Internal\RepeatedField $buttons + * A list of buttons. Buttons is also `oneof data` and only one of these + * fields should be set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * Display a text paragraph in this widget. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.TextParagraph text_paragraph = 1; + * @return \Google\Apps\Chat\V1\WidgetMarkup\TextParagraph|null + */ + public function getTextParagraph() + { + return $this->readOneof(1); + } + + public function hasTextParagraph() + { + return $this->hasOneof(1); + } + + /** + * Display a text paragraph in this widget. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.TextParagraph text_paragraph = 1; + * @param \Google\Apps\Chat\V1\WidgetMarkup\TextParagraph $var + * @return $this + */ + public function setTextParagraph($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\TextParagraph::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Display an image in this widget. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Image image = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\Image|null + */ + public function getImage() + { + return $this->readOneof(2); + } + + public function hasImage() + { + return $this->hasOneof(2); + } + + /** + * Display an image in this widget. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Image image = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\Image::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Display a key value item in this widget. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.KeyValue key_value = 3; + * @return \Google\Apps\Chat\V1\WidgetMarkup\KeyValue|null + */ + public function getKeyValue() + { + return $this->readOneof(3); + } + + public function hasKeyValue() + { + return $this->hasOneof(3); + } + + /** + * Display a key value item in this widget. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.KeyValue key_value = 3; + * @param \Google\Apps\Chat\V1\WidgetMarkup\KeyValue $var + * @return $this + */ + public function setKeyValue($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\KeyValue::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * A list of buttons. Buttons is also `oneof data` and only one of these + * fields should be set. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup.Button buttons = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getButtons() + { + return $this->buttons; + } + + /** + * A list of buttons. Buttons is also `oneof data` and only one of these + * fields should be set. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup.Button buttons = 6; + * @param array<\Google\Apps\Chat\V1\WidgetMarkup\Button>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setButtons($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\WidgetMarkup\Button::class); + $this->buttons = $arr; + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/Button.php b/AppsChat/src/Chat/V1/WidgetMarkup/Button.php new file mode 100644 index 000000000000..1a89528a0894 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/Button.php @@ -0,0 +1,109 @@ +google.chat.v1.WidgetMarkup.Button + */ +class Button extends \Google\Protobuf\Internal\Message +{ + protected $type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\WidgetMarkup\TextButton $text_button + * A button with text and `onclick` action. + * @type \Google\Apps\Chat\V1\WidgetMarkup\ImageButton $image_button + * A button with image and `onclick` action. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * A button with text and `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.TextButton text_button = 1; + * @return \Google\Apps\Chat\V1\WidgetMarkup\TextButton|null + */ + public function getTextButton() + { + return $this->readOneof(1); + } + + public function hasTextButton() + { + return $this->hasOneof(1); + } + + /** + * A button with text and `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.TextButton text_button = 1; + * @param \Google\Apps\Chat\V1\WidgetMarkup\TextButton $var + * @return $this + */ + public function setTextButton($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\TextButton::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A button with image and `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.ImageButton image_button = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\ImageButton|null + */ + public function getImageButton() + { + return $this->readOneof(2); + } + + public function hasImageButton() + { + return $this->hasOneof(2); + } + + /** + * A button with image and `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.ImageButton image_button = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\ImageButton $var + * @return $this + */ + public function setImageButton($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\ImageButton::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->whichOneof("type"); + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/FormAction.php b/AppsChat/src/Chat/V1/WidgetMarkup/FormAction.php new file mode 100644 index 000000000000..8d8e7aa7cebe --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/FormAction.php @@ -0,0 +1,115 @@ +google.chat.v1.WidgetMarkup.FormAction + */ +class FormAction extends \Google\Protobuf\Internal\Message +{ + /** + * The method name is used to identify which part of the form triggered the + * form submission. This information is echoed back to the Chat app as part + * of the card click event. You can use the same method name for several + * elements that trigger a common behavior. + * + * Generated from protobuf field string action_method_name = 1; + */ + protected $action_method_name = ''; + /** + * List of action parameters. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup.FormAction.ActionParameter parameters = 2; + */ + private $parameters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action_method_name + * The method name is used to identify which part of the form triggered the + * form submission. This information is echoed back to the Chat app as part + * of the card click event. You can use the same method name for several + * elements that trigger a common behavior. + * @type array<\Google\Apps\Chat\V1\WidgetMarkup\FormAction\ActionParameter>|\Google\Protobuf\Internal\RepeatedField $parameters + * List of action parameters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * The method name is used to identify which part of the form triggered the + * form submission. This information is echoed back to the Chat app as part + * of the card click event. You can use the same method name for several + * elements that trigger a common behavior. + * + * Generated from protobuf field string action_method_name = 1; + * @return string + */ + public function getActionMethodName() + { + return $this->action_method_name; + } + + /** + * The method name is used to identify which part of the form triggered the + * form submission. This information is echoed back to the Chat app as part + * of the card click event. You can use the same method name for several + * elements that trigger a common behavior. + * + * Generated from protobuf field string action_method_name = 1; + * @param string $var + * @return $this + */ + public function setActionMethodName($var) + { + GPBUtil::checkString($var, True); + $this->action_method_name = $var; + + return $this; + } + + /** + * List of action parameters. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup.FormAction.ActionParameter parameters = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * List of action parameters. + * + * Generated from protobuf field repeated .google.chat.v1.WidgetMarkup.FormAction.ActionParameter parameters = 2; + * @param array<\Google\Apps\Chat\V1\WidgetMarkup\FormAction\ActionParameter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Chat\V1\WidgetMarkup\FormAction\ActionParameter::class); + $this->parameters = $arr; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/FormAction/ActionParameter.php b/AppsChat/src/Chat/V1/WidgetMarkup/FormAction/ActionParameter.php new file mode 100644 index 000000000000..2777a10e24c4 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/FormAction/ActionParameter.php @@ -0,0 +1,105 @@ +google.chat.v1.WidgetMarkup.FormAction.ActionParameter + */ +class ActionParameter extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the parameter for the action script. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The value of the parameter. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The name of the parameter for the action script. + * @type string $value + * The value of the parameter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * The name of the parameter for the action script. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The name of the parameter for the action script. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The value of the parameter. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the parameter. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/Icon.php b/AppsChat/src/Chat/V1/WidgetMarkup/Icon.php new file mode 100644 index 000000000000..19bc217126ef --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/Icon.php @@ -0,0 +1,196 @@ +google.chat.v1.WidgetMarkup.Icon + */ +class Icon +{ + /** + * Generated from protobuf enum ICON_UNSPECIFIED = 0; + */ + const ICON_UNSPECIFIED = 0; + /** + * Generated from protobuf enum AIRPLANE = 1; + */ + const AIRPLANE = 1; + /** + * Generated from protobuf enum BOOKMARK = 26; + */ + const BOOKMARK = 26; + /** + * Generated from protobuf enum BUS = 25; + */ + const BUS = 25; + /** + * Generated from protobuf enum CAR = 9; + */ + const CAR = 9; + /** + * Generated from protobuf enum CLOCK = 2; + */ + const CLOCK = 2; + /** + * Generated from protobuf enum CONFIRMATION_NUMBER_ICON = 12; + */ + const CONFIRMATION_NUMBER_ICON = 12; + /** + * Generated from protobuf enum DOLLAR = 14; + */ + const DOLLAR = 14; + /** + * Generated from protobuf enum DESCRIPTION = 27; + */ + const DESCRIPTION = 27; + /** + * Generated from protobuf enum EMAIL = 10; + */ + const EMAIL = 10; + /** + * Generated from protobuf enum EVENT_PERFORMER = 20; + */ + const EVENT_PERFORMER = 20; + /** + * Generated from protobuf enum EVENT_SEAT = 21; + */ + const EVENT_SEAT = 21; + /** + * Generated from protobuf enum FLIGHT_ARRIVAL = 16; + */ + const FLIGHT_ARRIVAL = 16; + /** + * Generated from protobuf enum FLIGHT_DEPARTURE = 15; + */ + const FLIGHT_DEPARTURE = 15; + /** + * Generated from protobuf enum HOTEL = 6; + */ + const HOTEL = 6; + /** + * Generated from protobuf enum HOTEL_ROOM_TYPE = 17; + */ + const HOTEL_ROOM_TYPE = 17; + /** + * Generated from protobuf enum INVITE = 19; + */ + const INVITE = 19; + /** + * Generated from protobuf enum MAP_PIN = 3; + */ + const MAP_PIN = 3; + /** + * Generated from protobuf enum MEMBERSHIP = 24; + */ + const MEMBERSHIP = 24; + /** + * Generated from protobuf enum MULTIPLE_PEOPLE = 18; + */ + const MULTIPLE_PEOPLE = 18; + /** + * Generated from protobuf enum OFFER = 30; + */ + const OFFER = 30; + /** + * Generated from protobuf enum PERSON = 11; + */ + const PERSON = 11; + /** + * Generated from protobuf enum PHONE = 13; + */ + const PHONE = 13; + /** + * Generated from protobuf enum RESTAURANT_ICON = 7; + */ + const RESTAURANT_ICON = 7; + /** + * Generated from protobuf enum SHOPPING_CART = 8; + */ + const SHOPPING_CART = 8; + /** + * Generated from protobuf enum STAR = 5; + */ + const STAR = 5; + /** + * Generated from protobuf enum STORE = 22; + */ + const STORE = 22; + /** + * Generated from protobuf enum TICKET = 4; + */ + const TICKET = 4; + /** + * Generated from protobuf enum TRAIN = 23; + */ + const TRAIN = 23; + /** + * Generated from protobuf enum VIDEO_CAMERA = 28; + */ + const VIDEO_CAMERA = 28; + /** + * Generated from protobuf enum VIDEO_PLAY = 29; + */ + const VIDEO_PLAY = 29; + + private static $valueToName = [ + self::ICON_UNSPECIFIED => 'ICON_UNSPECIFIED', + self::AIRPLANE => 'AIRPLANE', + self::BOOKMARK => 'BOOKMARK', + self::BUS => 'BUS', + self::CAR => 'CAR', + self::CLOCK => 'CLOCK', + self::CONFIRMATION_NUMBER_ICON => 'CONFIRMATION_NUMBER_ICON', + self::DOLLAR => 'DOLLAR', + self::DESCRIPTION => 'DESCRIPTION', + self::EMAIL => 'EMAIL', + self::EVENT_PERFORMER => 'EVENT_PERFORMER', + self::EVENT_SEAT => 'EVENT_SEAT', + self::FLIGHT_ARRIVAL => 'FLIGHT_ARRIVAL', + self::FLIGHT_DEPARTURE => 'FLIGHT_DEPARTURE', + self::HOTEL => 'HOTEL', + self::HOTEL_ROOM_TYPE => 'HOTEL_ROOM_TYPE', + self::INVITE => 'INVITE', + self::MAP_PIN => 'MAP_PIN', + self::MEMBERSHIP => 'MEMBERSHIP', + self::MULTIPLE_PEOPLE => 'MULTIPLE_PEOPLE', + self::OFFER => 'OFFER', + self::PERSON => 'PERSON', + self::PHONE => 'PHONE', + self::RESTAURANT_ICON => 'RESTAURANT_ICON', + self::SHOPPING_CART => 'SHOPPING_CART', + self::STAR => 'STAR', + self::STORE => 'STORE', + self::TICKET => 'TICKET', + self::TRAIN => 'TRAIN', + self::VIDEO_CAMERA => 'VIDEO_CAMERA', + self::VIDEO_PLAY => 'VIDEO_PLAY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/Image.php b/AppsChat/src/Chat/V1/WidgetMarkup/Image.php new file mode 100644 index 000000000000..e73d78caa4c1 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/Image.php @@ -0,0 +1,158 @@ +google.chat.v1.WidgetMarkup.Image + */ +class Image extends \Google\Protobuf\Internal\Message +{ + /** + * The URL of the image. + * + * Generated from protobuf field string image_url = 1; + */ + protected $image_url = ''; + /** + * The `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + */ + protected $on_click = null; + /** + * The aspect ratio of this image (width and height). This field lets you + * reserve the right height for the image while waiting for it to load. + * It's not meant to override the built-in aspect ratio of the image. + * If unset, the server fills it by prefetching the image. + * + * Generated from protobuf field double aspect_ratio = 3; + */ + protected $aspect_ratio = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $image_url + * The URL of the image. + * @type \Google\Apps\Chat\V1\WidgetMarkup\OnClick $on_click + * The `onclick` action. + * @type float $aspect_ratio + * The aspect ratio of this image (width and height). This field lets you + * reserve the right height for the image while waiting for it to load. + * It's not meant to override the built-in aspect ratio of the image. + * If unset, the server fills it by prefetching the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * The URL of the image. + * + * Generated from protobuf field string image_url = 1; + * @return string + */ + public function getImageUrl() + { + return $this->image_url; + } + + /** + * The URL of the image. + * + * Generated from protobuf field string image_url = 1; + * @param string $var + * @return $this + */ + public function setImageUrl($var) + { + GPBUtil::checkString($var, True); + $this->image_url = $var; + + return $this; + } + + /** + * The `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * The `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\OnClick::class); + $this->on_click = $var; + + return $this; + } + + /** + * The aspect ratio of this image (width and height). This field lets you + * reserve the right height for the image while waiting for it to load. + * It's not meant to override the built-in aspect ratio of the image. + * If unset, the server fills it by prefetching the image. + * + * Generated from protobuf field double aspect_ratio = 3; + * @return float + */ + public function getAspectRatio() + { + return $this->aspect_ratio; + } + + /** + * The aspect ratio of this image (width and height). This field lets you + * reserve the right height for the image while waiting for it to load. + * It's not meant to override the built-in aspect ratio of the image. + * If unset, the server fills it by prefetching the image. + * + * Generated from protobuf field double aspect_ratio = 3; + * @param float $var + * @return $this + */ + public function setAspectRatio($var) + { + GPBUtil::checkDouble($var); + $this->aspect_ratio = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/ImageButton.php b/AppsChat/src/Chat/V1/WidgetMarkup/ImageButton.php new file mode 100644 index 000000000000..b53e4aafde23 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/ImageButton.php @@ -0,0 +1,194 @@ +google.chat.v1.WidgetMarkup.ImageButton + */ +class ImageButton extends \Google\Protobuf\Internal\Message +{ + /** + * The `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + */ + protected $on_click = null; + /** + * The name of this `image_button` that's used for accessibility. + * Default value is provided if this name isn't specified. + * + * Generated from protobuf field string name = 4; + */ + protected $name = ''; + protected $icons; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $icon + * The icon specified by an `enum` that indices to an icon provided by + * Chat API. + * @type string $icon_url + * The icon specified by a URL. + * @type \Google\Apps\Chat\V1\WidgetMarkup\OnClick $on_click + * The `onclick` action. + * @type string $name + * The name of this `image_button` that's used for accessibility. + * Default value is provided if this name isn't specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * The icon specified by an `enum` that indices to an icon provided by + * Chat API. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Icon icon = 1; + * @return int + */ + public function getIcon() + { + return $this->readOneof(1); + } + + public function hasIcon() + { + return $this->hasOneof(1); + } + + /** + * The icon specified by an `enum` that indices to an icon provided by + * Chat API. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Icon icon = 1; + * @param int $var + * @return $this + */ + public function setIcon($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\WidgetMarkup\Icon::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The icon specified by a URL. + * + * Generated from protobuf field string icon_url = 3; + * @return string + */ + public function getIconUrl() + { + return $this->readOneof(3); + } + + public function hasIconUrl() + { + return $this->hasOneof(3); + } + + /** + * The icon specified by a URL. + * + * Generated from protobuf field string icon_url = 3; + * @param string $var + * @return $this + */ + public function setIconUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * The `onclick` action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\OnClick::class); + $this->on_click = $var; + + return $this; + } + + /** + * The name of this `image_button` that's used for accessibility. + * Default value is provided if this name isn't specified. + * + * Generated from protobuf field string name = 4; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this `image_button` that's used for accessibility. + * Default value is provided if this name isn't specified. + * + * Generated from protobuf field string name = 4; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * @return string + */ + public function getIcons() + { + return $this->whichOneof("icons"); + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/KeyValue.php b/AppsChat/src/Chat/V1/WidgetMarkup/KeyValue.php new file mode 100644 index 000000000000..61aa4b92e409 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/KeyValue.php @@ -0,0 +1,423 @@ +google.chat.v1.WidgetMarkup.KeyValue + */ +class KeyValue extends \Google\Protobuf\Internal\Message +{ + /** + * The text of the top label. Formatted text supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string top_label = 3; + */ + protected $top_label = ''; + /** + * The text of the content. Formatted text supported and always required. + * For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string content = 4; + */ + protected $content = ''; + /** + * If the content should be multiline. + * + * Generated from protobuf field bool content_multiline = 9; + */ + protected $content_multiline = false; + /** + * The text of the bottom label. Formatted text supported. For more + * information about formatting text, see [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string bottom_label = 5; + */ + protected $bottom_label = ''; + /** + * The `onclick` action. Only the top label, bottom label, and content + * region are clickable. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 6; + */ + protected $on_click = null; + protected $icons; + protected $control; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $icon + * An enum value that's replaced by the Chat API with the + * corresponding icon image. + * @type string $icon_url + * The icon specified by a URL. + * @type string $top_label + * The text of the top label. Formatted text supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * @type string $content + * The text of the content. Formatted text supported and always required. + * For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * @type bool $content_multiline + * If the content should be multiline. + * @type string $bottom_label + * The text of the bottom label. Formatted text supported. For more + * information about formatting text, see [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * @type \Google\Apps\Chat\V1\WidgetMarkup\OnClick $on_click + * The `onclick` action. Only the top label, bottom label, and content + * region are clickable. + * @type \Google\Apps\Chat\V1\WidgetMarkup\Button $button + * A button that can be clicked to trigger an action. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * An enum value that's replaced by the Chat API with the + * corresponding icon image. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Icon icon = 1; + * @return int + */ + public function getIcon() + { + return $this->readOneof(1); + } + + public function hasIcon() + { + return $this->hasOneof(1); + } + + /** + * An enum value that's replaced by the Chat API with the + * corresponding icon image. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Icon icon = 1; + * @param int $var + * @return $this + */ + public function setIcon($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\WidgetMarkup\Icon::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The icon specified by a URL. + * + * Generated from protobuf field string icon_url = 2; + * @return string + */ + public function getIconUrl() + { + return $this->readOneof(2); + } + + public function hasIconUrl() + { + return $this->hasOneof(2); + } + + /** + * The icon specified by a URL. + * + * Generated from protobuf field string icon_url = 2; + * @param string $var + * @return $this + */ + public function setIconUrl($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The text of the top label. Formatted text supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string top_label = 3; + * @return string + */ + public function getTopLabel() + { + return $this->top_label; + } + + /** + * The text of the top label. Formatted text supported. For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string top_label = 3; + * @param string $var + * @return $this + */ + public function setTopLabel($var) + { + GPBUtil::checkString($var, True); + $this->top_label = $var; + + return $this; + } + + /** + * The text of the content. Formatted text supported and always required. + * For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string content = 4; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The text of the content. Formatted text supported and always required. + * For more information + * about formatting text, see + * [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string content = 4; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * If the content should be multiline. + * + * Generated from protobuf field bool content_multiline = 9; + * @return bool + */ + public function getContentMultiline() + { + return $this->content_multiline; + } + + /** + * If the content should be multiline. + * + * Generated from protobuf field bool content_multiline = 9; + * @param bool $var + * @return $this + */ + public function setContentMultiline($var) + { + GPBUtil::checkBool($var); + $this->content_multiline = $var; + + return $this; + } + + /** + * The text of the bottom label. Formatted text supported. For more + * information about formatting text, see [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string bottom_label = 5; + * @return string + */ + public function getBottomLabel() + { + return $this->bottom_label; + } + + /** + * The text of the bottom label. Formatted text supported. For more + * information about formatting text, see [Formatting text in Google Chat + * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) + * and + * [Formatting + * text in Google Workspace + * Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). + * + * Generated from protobuf field string bottom_label = 5; + * @param string $var + * @return $this + */ + public function setBottomLabel($var) + { + GPBUtil::checkString($var, True); + $this->bottom_label = $var; + + return $this; + } + + /** + * The `onclick` action. Only the top label, bottom label, and content + * region are clickable. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 6; + * @return \Google\Apps\Chat\V1\WidgetMarkup\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * The `onclick` action. Only the top label, bottom label, and content + * region are clickable. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 6; + * @param \Google\Apps\Chat\V1\WidgetMarkup\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\OnClick::class); + $this->on_click = $var; + + return $this; + } + + /** + * A button that can be clicked to trigger an action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Button button = 7; + * @return \Google\Apps\Chat\V1\WidgetMarkup\Button|null + */ + public function getButton() + { + return $this->readOneof(7); + } + + public function hasButton() + { + return $this->hasOneof(7); + } + + /** + * A button that can be clicked to trigger an action. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.Button button = 7; + * @param \Google\Apps\Chat\V1\WidgetMarkup\Button $var + * @return $this + */ + public function setButton($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\Button::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getIcons() + { + return $this->whichOneof("icons"); + } + + /** + * @return string + */ + public function getControl() + { + return $this->whichOneof("control"); + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/OnClick.php b/AppsChat/src/Chat/V1/WidgetMarkup/OnClick.php new file mode 100644 index 000000000000..12acdb4d9ed7 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/OnClick.php @@ -0,0 +1,109 @@ +google.chat.v1.WidgetMarkup.OnClick + */ +class OnClick extends \Google\Protobuf\Internal\Message +{ + protected $data; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Chat\V1\WidgetMarkup\FormAction $action + * A form action is triggered by this `onclick` action if specified. + * @type \Google\Apps\Chat\V1\WidgetMarkup\OpenLink $open_link + * This `onclick` action triggers an open link action if specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * A form action is triggered by this `onclick` action if specified. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.FormAction action = 1; + * @return \Google\Apps\Chat\V1\WidgetMarkup\FormAction|null + */ + public function getAction() + { + return $this->readOneof(1); + } + + public function hasAction() + { + return $this->hasOneof(1); + } + + /** + * A form action is triggered by this `onclick` action if specified. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.FormAction action = 1; + * @param \Google\Apps\Chat\V1\WidgetMarkup\FormAction $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\FormAction::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * This `onclick` action triggers an open link action if specified. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OpenLink open_link = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\OpenLink|null + */ + public function getOpenLink() + { + return $this->readOneof(2); + } + + public function hasOpenLink() + { + return $this->hasOneof(2); + } + + /** + * This `onclick` action triggers an open link action if specified. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OpenLink open_link = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\OpenLink $var + * @return $this + */ + public function setOpenLink($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\OpenLink::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->whichOneof("data"); + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/OpenLink.php b/AppsChat/src/Chat/V1/WidgetMarkup/OpenLink.php new file mode 100644 index 000000000000..3f7fca309f7d --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/OpenLink.php @@ -0,0 +1,68 @@ +google.chat.v1.WidgetMarkup.OpenLink + */ +class OpenLink extends \Google\Protobuf\Internal\Message +{ + /** + * The URL to open. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The URL to open. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * The URL to open. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL to open. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/TextButton.php b/AppsChat/src/Chat/V1/WidgetMarkup/TextButton.php new file mode 100644 index 000000000000..7a6b10d65b94 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/TextButton.php @@ -0,0 +1,112 @@ +google.chat.v1.WidgetMarkup.TextButton + */ +class TextButton extends \Google\Protobuf\Internal\Message +{ + /** + * The text of the button. + * + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + /** + * The `onclick` action of the button. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + */ + protected $on_click = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The text of the button. + * @type \Google\Apps\Chat\V1\WidgetMarkup\OnClick $on_click + * The `onclick` action of the button. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * The text of the button. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The text of the button. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * The `onclick` action of the button. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @return \Google\Apps\Chat\V1\WidgetMarkup\OnClick|null + */ + public function getOnClick() + { + return $this->on_click; + } + + public function hasOnClick() + { + return isset($this->on_click); + } + + public function clearOnClick() + { + unset($this->on_click); + } + + /** + * The `onclick` action of the button. + * + * Generated from protobuf field .google.chat.v1.WidgetMarkup.OnClick on_click = 2; + * @param \Google\Apps\Chat\V1\WidgetMarkup\OnClick $var + * @return $this + */ + public function setOnClick($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\WidgetMarkup\OnClick::class); + $this->on_click = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/WidgetMarkup/TextParagraph.php b/AppsChat/src/Chat/V1/WidgetMarkup/TextParagraph.php new file mode 100644 index 000000000000..3c124c0da7a8 --- /dev/null +++ b/AppsChat/src/Chat/V1/WidgetMarkup/TextParagraph.php @@ -0,0 +1,68 @@ +google.chat.v1.WidgetMarkup.TextParagraph + */ +class TextParagraph extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Chat\V1\Widgets::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + + diff --git a/AppsChat/src/Chat/V1/gapic_metadata.json b/AppsChat/src/Chat/V1/gapic_metadata.json new file mode 100644 index 000000000000..8d2fed5a4092 --- /dev/null +++ b/AppsChat/src/Chat/V1/gapic_metadata.json @@ -0,0 +1,128 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.chat.v1", + "libraryPackage": "Google\\Apps\\Chat\\V1", + "services": { + "ChatService": { + "clients": { + "grpc": { + "libraryClient": "ChatServiceGapicClient", + "rpcs": { + "CompleteImportSpace": { + "methods": [ + "completeImportSpace" + ] + }, + "CreateMembership": { + "methods": [ + "createMembership" + ] + }, + "CreateMessage": { + "methods": [ + "createMessage" + ] + }, + "CreateReaction": { + "methods": [ + "createReaction" + ] + }, + "CreateSpace": { + "methods": [ + "createSpace" + ] + }, + "DeleteMembership": { + "methods": [ + "deleteMembership" + ] + }, + "DeleteMessage": { + "methods": [ + "deleteMessage" + ] + }, + "DeleteReaction": { + "methods": [ + "deleteReaction" + ] + }, + "DeleteSpace": { + "methods": [ + "deleteSpace" + ] + }, + "FindDirectMessage": { + "methods": [ + "findDirectMessage" + ] + }, + "GetAttachment": { + "methods": [ + "getAttachment" + ] + }, + "GetMembership": { + "methods": [ + "getMembership" + ] + }, + "GetMessage": { + "methods": [ + "getMessage" + ] + }, + "GetSpace": { + "methods": [ + "getSpace" + ] + }, + "ListMemberships": { + "methods": [ + "listMemberships" + ] + }, + "ListMessages": { + "methods": [ + "listMessages" + ] + }, + "ListReactions": { + "methods": [ + "listReactions" + ] + }, + "ListSpaces": { + "methods": [ + "listSpaces" + ] + }, + "SetUpSpace": { + "methods": [ + "setUpSpace" + ] + }, + "UpdateMessage": { + "methods": [ + "updateMessage" + ] + }, + "UpdateSpace": { + "methods": [ + "updateSpace" + ] + }, + "UploadAttachment": { + "methods": [ + "uploadAttachment" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/AppsChat/src/Chat/V1/resources/chat_service_client_config.json b/AppsChat/src/Chat/V1/resources/chat_service_client_config.json new file mode 100644 index 000000000000..dfc25d11fb1d --- /dev/null +++ b/AppsChat/src/Chat/V1/resources/chat_service_client_config.json @@ -0,0 +1,144 @@ +{ + "interfaces": { + "google.chat.v1.ChatService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CompleteImportSpace": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateMembership": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateMessage": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateReaction": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateSpace": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteMembership": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteMessage": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteReaction": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteSpace": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "FindDirectMessage": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetAttachment": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMembership": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMessage": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetSpace": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMemberships": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMessages": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListReactions": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListSpaces": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "SetUpSpace": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateMessage": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateSpace": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UploadAttachment": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/AppsChat/src/Chat/V1/resources/chat_service_descriptor_config.php b/AppsChat/src/Chat/V1/resources/chat_service_descriptor_config.php new file mode 100644 index 000000000000..9e77fdd75081 --- /dev/null +++ b/AppsChat/src/Chat/V1/resources/chat_service_descriptor_config.php @@ -0,0 +1,303 @@ + [ + 'google.chat.v1.ChatService' => [ + 'CompleteImportSpace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\CompleteImportSpaceResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateMembership' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Membership', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Message', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateReaction' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Reaction', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSpace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Space', + ], + 'DeleteMembership' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Membership', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteReaction' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSpace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'FindDirectMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Space', + ], + 'GetAttachment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Attachment', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMembership' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Membership', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Message', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSpace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Space', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListMemberships' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMemberships', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Apps\Chat\V1\ListMembershipsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListMessages' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMessages', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Apps\Chat\V1\ListMessagesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListReactions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getReactions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Apps\Chat\V1\ListReactionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListSpaces' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSpaces', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Apps\Chat\V1\ListSpacesResponse', + ], + 'SetUpSpace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Space', + ], + 'UpdateMessage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Message', + 'headerParams' => [ + [ + 'keyName' => 'message.name', + 'fieldAccessors' => [ + 'getMessage', + 'getName', + ], + ], + ], + ], + 'UpdateSpace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\Space', + 'headerParams' => [ + [ + 'keyName' => 'space.name', + 'fieldAccessors' => [ + 'getSpace', + 'getName', + ], + ], + ], + ], + 'UploadAttachment' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Chat\V1\UploadAttachmentResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'attachment' => 'spaces/{space}/messages/{message}/attachments/{attachment}', + 'membership' => 'spaces/{space}/members/{member}', + 'message' => 'spaces/{space}/messages/{message}', + 'quotedMessageMetadata' => 'spaces/{space}/messages/{message}/quotedMessageMetadata/{quoted_message_metadata}', + 'reaction' => 'spaces/{space}/messages/{message}/reactions/{reaction}', + 'space' => 'spaces/{space}', + 'thread' => 'spaces/{space}/threads/{thread}', + ], + ], + ], +]; diff --git a/AppsChat/src/Chat/V1/resources/chat_service_rest_client_config.php b/AppsChat/src/Chat/V1/resources/chat_service_rest_client_config.php new file mode 100644 index 000000000000..591234af557b --- /dev/null +++ b/AppsChat/src/Chat/V1/resources/chat_service_rest_client_config.php @@ -0,0 +1,261 @@ + [ + 'google.chat.v1.ChatService' => [ + 'CompleteImportSpace' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=spaces/*}:completeImport', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateMembership' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=spaces/*}/members', + 'body' => 'membership', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateMessage' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=spaces/*}/messages', + 'body' => 'message', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateReaction' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=spaces/*/messages/*}/reactions', + 'body' => 'reaction', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSpace' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/spaces', + 'body' => 'space', + ], + 'DeleteMembership' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=spaces/*/members/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMessage' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=spaces/*/messages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteReaction' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=spaces/*/messages/*/reactions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSpace' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=spaces/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FindDirectMessage' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/spaces:findDirectMessage', + ], + 'GetAttachment' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=spaces/*/messages/*/attachments/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMembership' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=spaces/*/members/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMessage' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=spaces/*/messages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSpace' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=spaces/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListMemberships' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=spaces/*}/members', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMessages' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=spaces/*}/messages', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListReactions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=spaces/*/messages/*}/reactions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSpaces' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/spaces', + ], + 'SetUpSpace' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/spaces:setup', + 'body' => '*', + ], + 'UpdateMessage' => [ + 'method' => 'put', + 'uriTemplate' => '/v1/{message.name=spaces/*/messages/*}', + 'body' => 'message', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{message.name=spaces/*/messages/*}', + 'body' => 'message', + ], + ], + 'placeholders' => [ + 'message.name' => [ + 'getters' => [ + 'getMessage', + 'getName', + ], + ], + ], + ], + 'UpdateSpace' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{space.name=spaces/*}', + 'body' => 'space', + 'placeholders' => [ + 'space.name' => [ + 'getters' => [ + 'getSpace', + 'getName', + ], + ], + ], + ], + 'UploadAttachment' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=spaces/*}/attachments:upload', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/AppsChat/tests/Unit/V1/Client/ChatServiceClientTest.php b/AppsChat/tests/Unit/V1/Client/ChatServiceClientTest.php new file mode 100644 index 000000000000..39b216d86be8 --- /dev/null +++ b/AppsChat/tests/Unit/V1/Client/ChatServiceClientTest.php @@ -0,0 +1,1677 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ChatServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ChatServiceClient($options); + } + + /** @test */ + public function completeImportSpaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new CompleteImportSpaceResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new CompleteImportSpaceRequest())->setName($formattedName); + $response = $gapicClient->completeImportSpace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/CompleteImportSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function completeImportSpaceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new CompleteImportSpaceRequest())->setName($formattedName); + try { + $gapicClient->completeImportSpace($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMembershipTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Membership(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $membership = new Membership(); + $request = (new CreateMembershipRequest())->setParent($formattedParent)->setMembership($membership); + $response = $gapicClient->createMembership($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/CreateMembership', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getMembership(); + $this->assertProtobufEquals($membership, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMembershipExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $membership = new Membership(); + $request = (new CreateMembershipRequest())->setParent($formattedParent)->setMembership($membership); + try { + $gapicClient->createMembership($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $text = 'text3556653'; + $formattedText = 'formattedText-1686936880'; + $fallbackText = 'fallbackText563106922'; + $argumentText = 'argumentText-39826065'; + $threadReply = false; + $clientAssignedMessageId = 'clientAssignedMessageId-1116632848'; + $expectedResponse = new Message(); + $expectedResponse->setName($name); + $expectedResponse->setText($text); + $expectedResponse->setFormattedText($formattedText); + $expectedResponse->setFallbackText($fallbackText); + $expectedResponse->setArgumentText($argumentText); + $expectedResponse->setThreadReply($threadReply); + $expectedResponse->setClientAssignedMessageId($clientAssignedMessageId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $message = new Message(); + $request = (new CreateMessageRequest())->setParent($formattedParent)->setMessage($message); + $response = $gapicClient->createMessage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/CreateMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getMessage(); + $this->assertProtobufEquals($message, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $message = new Message(); + $request = (new CreateMessageRequest())->setParent($formattedParent)->setMessage($message); + try { + $gapicClient->createMessage($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createReactionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new Reaction(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $reaction = new Reaction(); + $request = (new CreateReactionRequest())->setParent($formattedParent)->setReaction($reaction); + $response = $gapicClient->createReaction($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/CreateReaction', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getReaction(); + $this->assertProtobufEquals($reaction, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createReactionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $reaction = new Reaction(); + $request = (new CreateReactionRequest())->setParent($formattedParent)->setReaction($reaction); + try { + $gapicClient->createReaction($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSpaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $singleUserBotDm = true; + $threaded = false; + $displayName = 'displayName1615086568'; + $externalUserAllowed = true; + $importMode = false; + $adminInstalled = true; + $expectedResponse = new Space(); + $expectedResponse->setName($name); + $expectedResponse->setSingleUserBotDm($singleUserBotDm); + $expectedResponse->setThreaded($threaded); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setExternalUserAllowed($externalUserAllowed); + $expectedResponse->setImportMode($importMode); + $expectedResponse->setAdminInstalled($adminInstalled); + $transport->addResponse($expectedResponse); + // Mock request + $space = new Space(); + $request = (new CreateSpaceRequest())->setSpace($space); + $response = $gapicClient->createSpace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/CreateSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getSpace(); + $this->assertProtobufEquals($space, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSpaceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $space = new Space(); + $request = (new CreateSpaceRequest())->setSpace($space); + try { + $gapicClient->createSpace($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMembershipTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Membership(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->membershipName('[SPACE]', '[MEMBER]'); + $request = (new DeleteMembershipRequest())->setName($formattedName); + $response = $gapicClient->deleteMembership($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/DeleteMembership', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMembershipExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->membershipName('[SPACE]', '[MEMBER]'); + $request = (new DeleteMembershipRequest())->setName($formattedName); + try { + $gapicClient->deleteMembership($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $request = (new DeleteMessageRequest())->setName($formattedName); + $gapicClient->deleteMessage($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/DeleteMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $request = (new DeleteMessageRequest())->setName($formattedName); + try { + $gapicClient->deleteMessage($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteReactionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->reactionName('[SPACE]', '[MESSAGE]', '[REACTION]'); + $request = (new DeleteReactionRequest())->setName($formattedName); + $gapicClient->deleteReaction($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/DeleteReaction', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteReactionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->reactionName('[SPACE]', '[MESSAGE]', '[REACTION]'); + $request = (new DeleteReactionRequest())->setName($formattedName); + try { + $gapicClient->deleteReaction($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSpaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new DeleteSpaceRequest())->setName($formattedName); + $gapicClient->deleteSpace($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/DeleteSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSpaceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new DeleteSpaceRequest())->setName($formattedName); + try { + $gapicClient->deleteSpace($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function findDirectMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $singleUserBotDm = true; + $threaded = false; + $displayName = 'displayName1615086568'; + $externalUserAllowed = true; + $importMode = false; + $adminInstalled = true; + $expectedResponse = new Space(); + $expectedResponse->setName($name2); + $expectedResponse->setSingleUserBotDm($singleUserBotDm); + $expectedResponse->setThreaded($threaded); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setExternalUserAllowed($externalUserAllowed); + $expectedResponse->setImportMode($importMode); + $expectedResponse->setAdminInstalled($adminInstalled); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new FindDirectMessageRequest())->setName($name); + $response = $gapicClient->findDirectMessage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/FindDirectMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function findDirectMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new FindDirectMessageRequest())->setName($name); + try { + $gapicClient->findDirectMessage($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAttachmentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $contentName = 'contentName831644305'; + $contentType = 'contentType831846208'; + $thumbnailUri = 'thumbnailUri1825632153'; + $downloadUri = 'downloadUri1109408053'; + $expectedResponse = new Attachment(); + $expectedResponse->setName($name2); + $expectedResponse->setContentName($contentName); + $expectedResponse->setContentType($contentType); + $expectedResponse->setThumbnailUri($thumbnailUri); + $expectedResponse->setDownloadUri($downloadUri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->attachmentName('[SPACE]', '[MESSAGE]', '[ATTACHMENT]'); + $request = (new GetAttachmentRequest())->setName($formattedName); + $response = $gapicClient->getAttachment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/GetAttachment', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAttachmentExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->attachmentName('[SPACE]', '[MESSAGE]', '[ATTACHMENT]'); + $request = (new GetAttachmentRequest())->setName($formattedName); + try { + $gapicClient->getAttachment($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMembershipTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Membership(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->membershipName('[SPACE]', '[MEMBER]'); + $request = (new GetMembershipRequest())->setName($formattedName); + $response = $gapicClient->getMembership($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/GetMembership', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMembershipExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->membershipName('[SPACE]', '[MEMBER]'); + $request = (new GetMembershipRequest())->setName($formattedName); + try { + $gapicClient->getMembership($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $text = 'text3556653'; + $formattedText = 'formattedText-1686936880'; + $fallbackText = 'fallbackText563106922'; + $argumentText = 'argumentText-39826065'; + $threadReply = false; + $clientAssignedMessageId = 'clientAssignedMessageId-1116632848'; + $expectedResponse = new Message(); + $expectedResponse->setName($name2); + $expectedResponse->setText($text); + $expectedResponse->setFormattedText($formattedText); + $expectedResponse->setFallbackText($fallbackText); + $expectedResponse->setArgumentText($argumentText); + $expectedResponse->setThreadReply($threadReply); + $expectedResponse->setClientAssignedMessageId($clientAssignedMessageId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $request = (new GetMessageRequest())->setName($formattedName); + $response = $gapicClient->getMessage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/GetMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $request = (new GetMessageRequest())->setName($formattedName); + try { + $gapicClient->getMessage($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSpaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $singleUserBotDm = true; + $threaded = false; + $displayName = 'displayName1615086568'; + $externalUserAllowed = true; + $importMode = false; + $adminInstalled = true; + $expectedResponse = new Space(); + $expectedResponse->setName($name2); + $expectedResponse->setSingleUserBotDm($singleUserBotDm); + $expectedResponse->setThreaded($threaded); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setExternalUserAllowed($externalUserAllowed); + $expectedResponse->setImportMode($importMode); + $expectedResponse->setAdminInstalled($adminInstalled); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new GetSpaceRequest())->setName($formattedName); + $response = $gapicClient->getSpace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/GetSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSpaceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new GetSpaceRequest())->setName($formattedName); + try { + $gapicClient->getSpace($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMembershipsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $membershipsElement = new Membership(); + $memberships = [$membershipsElement]; + $expectedResponse = new ListMembershipsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMemberships($memberships); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $request = (new ListMembershipsRequest())->setParent($formattedParent); + $response = $gapicClient->listMemberships($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMemberships()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/ListMemberships', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMembershipsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $request = (new ListMembershipsRequest())->setParent($formattedParent); + try { + $gapicClient->listMemberships($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMessagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $messagesElement = new Message(); + $messages = [$messagesElement]; + $expectedResponse = new ListMessagesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMessages($messages); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $request = (new ListMessagesRequest())->setParent($formattedParent); + $response = $gapicClient->listMessages($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMessages()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/ListMessages', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMessagesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $request = (new ListMessagesRequest())->setParent($formattedParent); + try { + $gapicClient->listMessages($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReactionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $reactionsElement = new Reaction(); + $reactions = [$reactionsElement]; + $expectedResponse = new ListReactionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReactions($reactions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $request = (new ListReactionsRequest())->setParent($formattedParent); + $response = $gapicClient->listReactions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReactions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/ListReactions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReactionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->messageName('[SPACE]', '[MESSAGE]'); + $request = (new ListReactionsRequest())->setParent($formattedParent); + try { + $gapicClient->listReactions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSpacesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $spacesElement = new Space(); + $spaces = [$spacesElement]; + $expectedResponse = new ListSpacesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSpaces($spaces); + $transport->addResponse($expectedResponse); + $request = new ListSpacesRequest(); + $response = $gapicClient->listSpaces($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSpaces()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/ListSpaces', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSpacesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new ListSpacesRequest(); + try { + $gapicClient->listSpaces($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setUpSpaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $singleUserBotDm = true; + $threaded = false; + $displayName = 'displayName1615086568'; + $externalUserAllowed = true; + $importMode = false; + $adminInstalled = true; + $expectedResponse = new Space(); + $expectedResponse->setName($name); + $expectedResponse->setSingleUserBotDm($singleUserBotDm); + $expectedResponse->setThreaded($threaded); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setExternalUserAllowed($externalUserAllowed); + $expectedResponse->setImportMode($importMode); + $expectedResponse->setAdminInstalled($adminInstalled); + $transport->addResponse($expectedResponse); + // Mock request + $space = new Space(); + $request = (new SetUpSpaceRequest())->setSpace($space); + $response = $gapicClient->setUpSpace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/SetUpSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getSpace(); + $this->assertProtobufEquals($space, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setUpSpaceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $space = new Space(); + $request = (new SetUpSpaceRequest())->setSpace($space); + try { + $gapicClient->setUpSpace($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateMessageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $text = 'text3556653'; + $formattedText = 'formattedText-1686936880'; + $fallbackText = 'fallbackText563106922'; + $argumentText = 'argumentText-39826065'; + $threadReply = false; + $clientAssignedMessageId = 'clientAssignedMessageId-1116632848'; + $expectedResponse = new Message(); + $expectedResponse->setName($name); + $expectedResponse->setText($text); + $expectedResponse->setFormattedText($formattedText); + $expectedResponse->setFallbackText($fallbackText); + $expectedResponse->setArgumentText($argumentText); + $expectedResponse->setThreadReply($threadReply); + $expectedResponse->setClientAssignedMessageId($clientAssignedMessageId); + $transport->addResponse($expectedResponse); + // Mock request + $message = new Message(); + $request = (new UpdateMessageRequest())->setMessage($message); + $response = $gapicClient->updateMessage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/UpdateMessage', $actualFuncCall); + $actualValue = $actualRequestObject->getMessage(); + $this->assertProtobufEquals($message, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateMessageExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $message = new Message(); + $request = (new UpdateMessageRequest())->setMessage($message); + try { + $gapicClient->updateMessage($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSpaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $singleUserBotDm = true; + $threaded = false; + $displayName = 'displayName1615086568'; + $externalUserAllowed = true; + $importMode = false; + $adminInstalled = true; + $expectedResponse = new Space(); + $expectedResponse->setName($name); + $expectedResponse->setSingleUserBotDm($singleUserBotDm); + $expectedResponse->setThreaded($threaded); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setExternalUserAllowed($externalUserAllowed); + $expectedResponse->setImportMode($importMode); + $expectedResponse->setAdminInstalled($adminInstalled); + $transport->addResponse($expectedResponse); + // Mock request + $space = new Space(); + $request = (new UpdateSpaceRequest())->setSpace($space); + $response = $gapicClient->updateSpace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/UpdateSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getSpace(); + $this->assertProtobufEquals($space, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSpaceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $space = new Space(); + $request = (new UpdateSpaceRequest())->setSpace($space); + try { + $gapicClient->updateSpace($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function uploadAttachmentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new UploadAttachmentResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $filename = 'filename-734768633'; + $request = (new UploadAttachmentRequest())->setParent($formattedParent)->setFilename($filename); + $response = $gapicClient->uploadAttachment($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/UploadAttachment', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFilename(); + $this->assertProtobufEquals($filename, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function uploadAttachmentExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->spaceName('[SPACE]'); + $filename = 'filename-734768633'; + $request = (new UploadAttachmentRequest())->setParent($formattedParent)->setFilename($filename); + try { + $gapicClient->uploadAttachment($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function completeImportSpaceAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new CompleteImportSpaceResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->spaceName('[SPACE]'); + $request = (new CompleteImportSpaceRequest())->setName($formattedName); + $response = $gapicClient->completeImportSpaceAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.chat.v1.ChatService/CompleteImportSpace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 1030316b57ec..ea6d094edf64 100644 --- a/composer.json +++ b/composer.json @@ -74,6 +74,7 @@ "google/analytics-admin": "0.22.2", "google/analytics-data": "0.16.2", "google/apps-events-subscriptions": "0.1.0", + "google/apps-chat": "0.0.0", "google/apps-meet": "0.2.0", "google/cloud-access-approval": "1.2.2", "google/cloud-advisorynotifications": "0.8.0", @@ -264,6 +265,8 @@ "GPBMetadata\\Google\\Apps\\Meet\\": "AppsMeet/metadata", "GPBMetadata\\Google\\Apps\\Script\\Type\\": "GSuiteAddOns/external/metadata", "GPBMetadata\\Google\\Bigtable\\": "Bigtable/metadata", + "GPBMetadata\\Google\\Chat\\": "AppsChat/metadata/Chat", + "GPBMetadata\\Google\\Apps\\Card\\": "AppsChat/metadata/Card", "GPBMetadata\\Google\\Cloud\\Accessapproval\\": "AccessApproval/metadata", "GPBMetadata\\Google\\Cloud\\Advisorynotifications\\": "AdvisoryNotifications/metadata", "GPBMetadata\\Google\\Cloud\\Aiplatform\\": "AiPlatform/metadata", @@ -436,6 +439,8 @@ "Google\\Analytics\\Admin\\": "AnalyticsAdmin/src", "Google\\Analytics\\Data\\": "AnalyticsData/src", "Google\\ApiCore\\LongRunning\\": "LongRunning/src/ApiCore/LongRunning", + "Google\\Apps\\Chat\\": "AppsChat/src/Chat", + "Google\\Apps\\Card\\": "AppsChat/src/Card", "Google\\Apps\\Events\\Subscriptions\\": "AppsEventsSubscriptions/src", "Google\\Apps\\Meet\\": "AppsMeet/src", "Google\\Apps\\Script\\Type\\": "GSuiteAddOns/external/protos",