From 5d9ae9e2be62ab5e96e65877049316ed2496f5f0 Mon Sep 17 00:00:00 2001 From: Vishwaraj Anand Date: Thu, 21 Mar 2024 11:47:43 +0000 Subject: [PATCH] feat: [AppsEventsSubscriptions] add new client library surface for Subscription PHP --- AppsEventsSubscriptions/.OwlBot.yaml | 4 + AppsEventsSubscriptions/.gitattributes | 8 + .../.github/pull_request_template.md | 24 + AppsEventsSubscriptions/.repo-metadata.json | 8 + AppsEventsSubscriptions/CONTRIBUTING.md | 10 + AppsEventsSubscriptions/LICENSE | 202 ++++ AppsEventsSubscriptions/README.md | 45 + AppsEventsSubscriptions/VERSION | 1 + AppsEventsSubscriptions/composer.json | 30 + .../metadata/V1/SubscriptionResource.php | Bin 0 -> 2939 bytes .../metadata/V1/SubscriptionsService.php | 77 ++ AppsEventsSubscriptions/owlbot.py | 62 ++ AppsEventsSubscriptions/phpunit.xml.dist | 16 + .../create_subscription.php | 117 +++ .../delete_subscription.php | 84 ++ .../get_subscription.php | 75 ++ .../list_subscriptions.php | 104 +++ .../reactivate_subscription.php | 91 ++ .../update_subscription.php | 117 +++ .../V1/Client/SubscriptionsServiceClient.php | 480 ++++++++++ .../src/V1/CreateSubscriptionMetadata.php | 33 + .../src/V1/CreateSubscriptionRequest.php | 129 +++ .../src/V1/DeleteSubscriptionMetadata.php | 33 + .../src/V1/DeleteSubscriptionRequest.php | 206 +++++ .../src/V1/GetSubscriptionRequest.php | 88 ++ .../src/V1/ListSubscriptionsRequest.php | 280 ++++++ .../src/V1/ListSubscriptionsResponse.php | 106 +++ .../src/V1/NotificationEndpoint.php | 96 ++ .../src/V1/PayloadOptions.php | 156 ++++ .../src/V1/ReactivateSubscriptionMetadata.php | 33 + .../src/V1/ReactivateSubscriptionRequest.php | 88 ++ .../src/V1/Subscription.php | 734 +++++++++++++++ .../src/V1/Subscription/ErrorType.php | 105 +++ .../src/V1/Subscription/State.php | 73 ++ .../src/V1/UpdateSubscriptionMetadata.php | 33 + .../src/V1/UpdateSubscriptionRequest.php | 218 +++++ .../src/V1/gapic_metadata.json | 48 + .../subscriptions_service_client_config.json | 74 ++ ...ubscriptions_service_descriptor_config.php | 106 +++ ...bscriptions_service_rest_client_config.php | 81 ++ .../Client/SubscriptionsServiceClientTest.php | 869 ++++++++++++++++++ composer.json | 3 + 42 files changed, 5147 insertions(+) create mode 100644 AppsEventsSubscriptions/.OwlBot.yaml create mode 100644 AppsEventsSubscriptions/.gitattributes create mode 100644 AppsEventsSubscriptions/.github/pull_request_template.md create mode 100644 AppsEventsSubscriptions/.repo-metadata.json create mode 100644 AppsEventsSubscriptions/CONTRIBUTING.md create mode 100644 AppsEventsSubscriptions/LICENSE create mode 100644 AppsEventsSubscriptions/README.md create mode 100644 AppsEventsSubscriptions/VERSION create mode 100644 AppsEventsSubscriptions/composer.json create mode 100644 AppsEventsSubscriptions/metadata/V1/SubscriptionResource.php create mode 100644 AppsEventsSubscriptions/metadata/V1/SubscriptionsService.php create mode 100644 AppsEventsSubscriptions/owlbot.py create mode 100644 AppsEventsSubscriptions/phpunit.xml.dist create mode 100644 AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/create_subscription.php create mode 100644 AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/delete_subscription.php create mode 100644 AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/get_subscription.php create mode 100644 AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/list_subscriptions.php create mode 100644 AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/reactivate_subscription.php create mode 100644 AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/update_subscription.php create mode 100644 AppsEventsSubscriptions/src/V1/Client/SubscriptionsServiceClient.php create mode 100644 AppsEventsSubscriptions/src/V1/CreateSubscriptionMetadata.php create mode 100644 AppsEventsSubscriptions/src/V1/CreateSubscriptionRequest.php create mode 100644 AppsEventsSubscriptions/src/V1/DeleteSubscriptionMetadata.php create mode 100644 AppsEventsSubscriptions/src/V1/DeleteSubscriptionRequest.php create mode 100644 AppsEventsSubscriptions/src/V1/GetSubscriptionRequest.php create mode 100644 AppsEventsSubscriptions/src/V1/ListSubscriptionsRequest.php create mode 100644 AppsEventsSubscriptions/src/V1/ListSubscriptionsResponse.php create mode 100644 AppsEventsSubscriptions/src/V1/NotificationEndpoint.php create mode 100644 AppsEventsSubscriptions/src/V1/PayloadOptions.php create mode 100644 AppsEventsSubscriptions/src/V1/ReactivateSubscriptionMetadata.php create mode 100644 AppsEventsSubscriptions/src/V1/ReactivateSubscriptionRequest.php create mode 100644 AppsEventsSubscriptions/src/V1/Subscription.php create mode 100644 AppsEventsSubscriptions/src/V1/Subscription/ErrorType.php create mode 100644 AppsEventsSubscriptions/src/V1/Subscription/State.php create mode 100644 AppsEventsSubscriptions/src/V1/UpdateSubscriptionMetadata.php create mode 100644 AppsEventsSubscriptions/src/V1/UpdateSubscriptionRequest.php create mode 100644 AppsEventsSubscriptions/src/V1/gapic_metadata.json create mode 100644 AppsEventsSubscriptions/src/V1/resources/subscriptions_service_client_config.json create mode 100644 AppsEventsSubscriptions/src/V1/resources/subscriptions_service_descriptor_config.php create mode 100644 AppsEventsSubscriptions/src/V1/resources/subscriptions_service_rest_client_config.php create mode 100644 AppsEventsSubscriptions/tests/Unit/V1/Client/SubscriptionsServiceClientTest.php diff --git a/AppsEventsSubscriptions/.OwlBot.yaml b/AppsEventsSubscriptions/.OwlBot.yaml new file mode 100644 index 000000000000..da2c7d0bfd9d --- /dev/null +++ b/AppsEventsSubscriptions/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/apps/events/subscriptions/(v1)/.*-php/(.*) + dest: /owl-bot-staging/AppsEventsSubscriptions/$1/$2 +api-name: AppsEventsSubscriptions diff --git a/AppsEventsSubscriptions/.gitattributes b/AppsEventsSubscriptions/.gitattributes new file mode 100644 index 000000000000..8119e7fcc1b2 --- /dev/null +++ b/AppsEventsSubscriptions/.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/AppsEventsSubscriptions/.github/pull_request_template.md b/AppsEventsSubscriptions/.github/pull_request_template.md new file mode 100644 index 000000000000..943ede83299d --- /dev/null +++ b/AppsEventsSubscriptions/.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 `AppsEventsSubscriptions/src`, and tests in `AppsEventsSubscriptions/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/AppsEventsSubscriptions/.repo-metadata.json b/AppsEventsSubscriptions/.repo-metadata.json new file mode 100644 index 000000000000..fc82b08f9157 --- /dev/null +++ b/AppsEventsSubscriptions/.repo-metadata.json @@ -0,0 +1,8 @@ +{ + "language": "php", + "distribution_name": "google/apps-events-subscriptions", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/apps-events-subscriptions/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "workspaceevents" +} diff --git a/AppsEventsSubscriptions/CONTRIBUTING.md b/AppsEventsSubscriptions/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/AppsEventsSubscriptions/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/AppsEventsSubscriptions/LICENSE b/AppsEventsSubscriptions/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/AppsEventsSubscriptions/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/AppsEventsSubscriptions/README.md b/AppsEventsSubscriptions/README.md new file mode 100644 index 000000000000..20c20c9b220c --- /dev/null +++ b/AppsEventsSubscriptions/README.md @@ -0,0 +1,45 @@ +# Google Apps Events Subscriptions for PHP + +> Idiomatic PHP client for [Google Apps Events Subscriptions](https://developers.google.com/workspace/events). + +[![Latest Stable Version](https://poser.pugx.org/google/apps-events-subscriptions/v/stable)](https://packagist.org/packages/google/apps-events-subscriptions) [![Packagist](https://img.shields.io/packagist/dm/google/apps-events-subscriptions.svg)](https://packagist.org/packages/google/apps-events-subscriptions) + +* [API documentation](https://cloud.google.com/php/docs/reference/apps-events-subscriptions/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/apps-events-subscriptions +``` + +> 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-apps-events-subscriptions/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/workspace/events). diff --git a/AppsEventsSubscriptions/VERSION b/AppsEventsSubscriptions/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/AppsEventsSubscriptions/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/AppsEventsSubscriptions/composer.json b/AppsEventsSubscriptions/composer.json new file mode 100644 index 000000000000..5d6771b7c21f --- /dev/null +++ b/AppsEventsSubscriptions/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/apps-events-subscriptions", + "description": "Google Apps Events Subscriptions Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Apps\\Events\\Subscriptions\\": "src", + "GPBMetadata\\Google\\Apps\\Events\\Subscriptions\\": "metadata" + } + }, + "extra": { + "component": { + "id": "apps-events-subscriptions", + "path": "AppsEventsSubscriptions", + "target": "googleapis/php-apps-events-subscriptions" + } + }, + "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/AppsEventsSubscriptions/metadata/V1/SubscriptionResource.php b/AppsEventsSubscriptions/metadata/V1/SubscriptionResource.php new file mode 100644 index 0000000000000000000000000000000000000000..c33126ca5455be630d1d6805c27bd5c4b22ba258 GIT binary patch literal 2939 zcmbtW-BQ~|6pn2S_~0Z)lcWl15(UzMq>Vg4r=5zVsf-19lGv^-Gi~Y_Rmf}DMo1d{ z&{D=Tz3j8}C3@dC=pEO2gk1IPN*02Ul%~Fsch5QBp8d|xp2ttUJr5S7P2v#W49P&+ zIh4XZB6+?Wx|VB8JJE1Re93b6J!%tQmZW-1YPNJqt2gv}Xd1YYZxKb>b=_T?R87wd zs^ow;VNeaCoxt*`7gE;=st3!bHVmJ{rZPVZz%lnp;F%VYHrurqBs2$RX!bWbY+ps# zzQ$qu-7IW>dwC7OvdtinvVu;64o4v2&x>|!YDqz8hWNQp1A{s=q^3=O#Y;bthNc}5 z1bSO{7&#WZfW!=1jzyLpNHHeUz3;h5(i3UyXPfbcob?+{NPNe%`*jj?;QDP;Rg_&4 zrfjpFr3cBe42}+^rPxPBdCSQsQs_q{d%7g~B#eA#jr+|2M(Mx)xh&HD1|{~OM)u4D z>iUXua;p=NcbSeky|`6MM?J#yLKZ*3lso*w3|@VJtxhqgLUZ3c-Cjq5O#4_Um8edI6ExO)~M9Fr6)%>P+}a<-I&FJOlJ;!&R%OjW!r<(6hv=H%oi z{{Vio!Yu2Jc2?P+Ts@qy!Y6PwG<__kw2O!nTw3NP`8R3-au0<&=s4>cMtJCvKrBjy7&w2dPNJgl zEnM}?L)$e6h8uS&agsZ`I(GJbVUpXiZ7Viq*T@M!!ga?D>5y7H-womnJQov8oZ`S= zT?n|DLC_L_8hVU=7lmg~WG#Y-(};Lw<;x2pX5%S$nK^T}Ap8KcK@@nz39vYkOfzsD zQQ*L9{~cKKeb?8K>lpkol*}mHbA1{fih!V{+5y2%#k`pdNsoO(gvyP&? zFauL{?YXAoqA>q=4oWFw!W`VtI-OR>(7$h=MZ5t*ud8*8?s^Ml9c{by3=wj|HK=s7 zZmZW>*Nic496#C=e>?rDKI(u({44Iy3y7;FB;u0Q>bfA z=Kq9%r=@ay>5Yw6uUW553U}dFx}P4aeYd6dy6i$zLJ5j3eM{?9ii-1EeFdNX?E0_x zlb$rXxMQSY&L*Ys@u@CYJ<2Xe4=-nz!Ad#1?BsH_G5~K;yy)f!aOHGu3b&y`9m|de z0pWz>EzKz|YI;Ua}tyV=c*MdO#6zrXF=%PudsF%B!SUH3hs8b;{M zv=(?fYgx{5{YQRblMiPy8_wi-IFqwp1oHOsUt_I)Jj0ELxHD56j&ZN^{lyqiQ5d44 z#E^<|3R6)~Rb9SF2PsF`M}q1R`;1S8(ZQW#u~v0;2&oe$Y1~f literal 0 HcmV?d00001 diff --git a/AppsEventsSubscriptions/metadata/V1/SubscriptionsService.php b/AppsEventsSubscriptions/metadata/V1/SubscriptionsService.php new file mode 100644 index 000000000000..0c62e7126f27 --- /dev/null +++ b/AppsEventsSubscriptions/metadata/V1/SubscriptionsService.php @@ -0,0 +1,77 @@ +internalAddGeneratedFile( + ' + +?google/apps/events/subscriptions/v1/subscriptions_service.proto#google.apps.events.subscriptions.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto?google/apps/events/subscriptions/v1/subscription_resource.proto#google/longrunning/operations.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto" +CreateSubscriptionRequestL + subscription ( 21.google.apps.events.subscriptions.v1.SubscriptionBA + validate_only (BA" +DeleteSubscriptionRequestA +name ( B3AA- ++workspaceevents.googleapis.com/Subscription + validate_only (BA + allow_missing (BA +etag ( BA"[ +GetSubscriptionRequestA +name ( B3AA- ++workspaceevents.googleapis.com/Subscription" +UpdateSubscriptionRequestL + subscription ( 21.google.apps.events.subscriptions.v1.SubscriptionBA4 + update_mask ( 2.google.protobuf.FieldMaskBA + validate_only (BA"b +ReactivateSubscriptionRequestA +name ( B3AA- ++workspaceevents.googleapis.com/Subscription"` +ListSubscriptionsRequest + page_size (BA + +page_token ( BA +filter ( BA"~ +ListSubscriptionsResponseH + subscriptions ( 21.google.apps.events.subscriptions.v1.Subscription +next_page_token ( " +UpdateSubscriptionMetadata" +CreateSubscriptionMetadata" +DeleteSubscriptionMetadata" +ReactivateSubscriptionMetadata2 +SubscriptionsService +CreateSubscription>.google.apps.events.subscriptions.v1.CreateSubscriptionRequest.google.longrunning.Operation"cA* + SubscriptionCreateSubscriptionMetadataA subscription!"/v1/subscriptions: subscription +DeleteSubscription>.google.apps.events.subscriptions.v1.DeleteSubscriptionRequest.google.longrunning.Operation"_A3 +google.protobuf.EmptyDeleteSubscriptionMetadataAname*/v1/{name=subscriptions/*} +GetSubscription;.google.apps.events.subscriptions.v1.GetSubscriptionRequest1.google.apps.events.subscriptions.v1.Subscription")Aname/v1/{name=subscriptions/*} +ListSubscriptions=.google.apps.events.subscriptions.v1.ListSubscriptionsRequest>.google.apps.events.subscriptions.v1.ListSubscriptionsResponse""Afilter/v1/subscriptions +UpdateSubscription>.google.apps.events.subscriptions.v1.UpdateSubscriptionRequest.google.longrunning.Operation"A* + SubscriptionUpdateSubscriptionMetadataAsubscription,update_mask72\'/v1/{subscription.name=subscriptions/*}: subscription +ReactivateSubscriptionB.google.apps.events.subscriptions.v1.ReactivateSubscriptionRequest.google.longrunning.Operation"hA. + SubscriptionReactivateSubscriptionMetadataAname*"%/v1/{name=subscriptions/*}:reactivate:*Aworkspaceevents.googleapis.comAhttps://www.googleapis.com/auth/chat.bot,https://www.googleapis.com/auth/chat.memberships,https://www.googleapis.com/auth/chat.memberships.readonly,https://www.googleapis.com/auth/chat.messages,https://www.googleapis.com/auth/chat.messages.reactions,https://www.googleapis.com/auth/chat.messages.reactions.readonly,https://www.googleapis.com/auth/chat.messages.readonly,https://www.googleapis.com/auth/chat.spaces,https://www.googleapis.com/auth/chat.spaces.readonly,https://www.googleapis.com/auth/meetings.space.created,https://www.googleapis.com/auth/meetings.space.readonlyB +\'com.google.apps.events.subscriptions.v1BSubscriptionsServiceProtoPZScloud.google.com/go/apps/events/subscriptions/apiv1/subscriptionspb;subscriptionspb#Google.Apps.Events.Subscriptions.V1#Google\\Apps\\Events\\Subscriptions\\V1\'Google::Apps::Events::Subscriptions::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/AppsEventsSubscriptions/owlbot.py b/AppsEventsSubscriptions/owlbot.py new file mode 100644 index 000000000000..4791a871fb94 --- /dev/null +++ b/AppsEventsSubscriptions/owlbot.py @@ -0,0 +1,62 @@ +# 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 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}/AppsEventsSubscriptions").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main( + src=src, + dest=dest, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + ] +) + +# remove class_alias code +s.replace( + "src/V*/**/*.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/AppsEventsSubscriptions/phpunit.xml.dist b/AppsEventsSubscriptions/phpunit.xml.dist new file mode 100644 index 000000000000..2909b2bfb50e --- /dev/null +++ b/AppsEventsSubscriptions/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/create_subscription.php b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/create_subscription.php new file mode 100644 index 000000000000..13cb6fe2ff51 --- /dev/null +++ b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/create_subscription.php @@ -0,0 +1,117 @@ +setTargetResource($subscriptionTargetResource) + ->setEventTypes($subscriptionEventTypes) + ->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new CreateSubscriptionRequest()) + ->setSubscription($subscription); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $subscriptionsServiceClient->createSubscription($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Subscription $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->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 +{ + $subscriptionTargetResource = '[TARGET_RESOURCE]'; + $subscriptionEventTypesElement = '[EVENT_TYPES]'; + + create_subscription_sample($subscriptionTargetResource, $subscriptionEventTypesElement); +} +// [END workspaceevents_v1_generated_SubscriptionsService_CreateSubscription_sync] diff --git a/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/delete_subscription.php b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/delete_subscription.php new file mode 100644 index 000000000000..b7350021e958 --- /dev/null +++ b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/delete_subscription.php @@ -0,0 +1,84 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $subscriptionsServiceClient->deleteSubscription($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->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 = SubscriptionsServiceClient::subscriptionName('[SUBSCRIPTION]'); + + delete_subscription_sample($formattedName); +} +// [END workspaceevents_v1_generated_SubscriptionsService_DeleteSubscription_sync] diff --git a/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/get_subscription.php b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/get_subscription.php new file mode 100644 index 000000000000..9d9c407a9b00 --- /dev/null +++ b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/get_subscription.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Subscription $response */ + $response = $subscriptionsServiceClient->getSubscription($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 = SubscriptionsServiceClient::subscriptionName('[SUBSCRIPTION]'); + + get_subscription_sample($formattedName); +} +// [END workspaceevents_v1_generated_SubscriptionsService_GetSubscription_sync] diff --git a/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/list_subscriptions.php b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/list_subscriptions.php new file mode 100644 index 000000000000..287427485254 --- /dev/null +++ b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/list_subscriptions.php @@ -0,0 +1,104 @@ +setFilter($filter); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $subscriptionsServiceClient->listSubscriptions($request); + + /** @var Subscription $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 +{ + $filter = '[FILTER]'; + + list_subscriptions_sample($filter); +} +// [END workspaceevents_v1_generated_SubscriptionsService_ListSubscriptions_sync] diff --git a/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/reactivate_subscription.php b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/reactivate_subscription.php new file mode 100644 index 000000000000..37048b6e861f --- /dev/null +++ b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/reactivate_subscription.php @@ -0,0 +1,91 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $subscriptionsServiceClient->reactivateSubscription($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Subscription $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->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 = SubscriptionsServiceClient::subscriptionName('[SUBSCRIPTION]'); + + reactivate_subscription_sample($formattedName); +} +// [END workspaceevents_v1_generated_SubscriptionsService_ReactivateSubscription_sync] diff --git a/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/update_subscription.php b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/update_subscription.php new file mode 100644 index 000000000000..c47384b4d4e1 --- /dev/null +++ b/AppsEventsSubscriptions/samples/V1/SubscriptionsServiceClient/update_subscription.php @@ -0,0 +1,117 @@ +setTargetResource($subscriptionTargetResource) + ->setEventTypes($subscriptionEventTypes) + ->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new UpdateSubscriptionRequest()) + ->setSubscription($subscription); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $subscriptionsServiceClient->updateSubscription($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Subscription $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->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 +{ + $subscriptionTargetResource = '[TARGET_RESOURCE]'; + $subscriptionEventTypesElement = '[EVENT_TYPES]'; + + update_subscription_sample($subscriptionTargetResource, $subscriptionEventTypesElement); +} +// [END workspaceevents_v1_generated_SubscriptionsService_UpdateSubscription_sync] diff --git a/AppsEventsSubscriptions/src/V1/Client/SubscriptionsServiceClient.php b/AppsEventsSubscriptions/src/V1/Client/SubscriptionsServiceClient.php new file mode 100644 index 000000000000..24289981d332 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/Client/SubscriptionsServiceClient.php @@ -0,0 +1,480 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/subscriptions_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/subscriptions_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/subscriptions_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/subscriptions_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a subscription + * resource. + * + * @param string $subscription + * + * @return string The formatted subscription resource. + */ + public static function subscriptionName(string $subscription): string + { + return self::getPathTemplate('subscription')->render([ + 'subscription' => $subscription, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a topic + * resource. + * + * @param string $project + * @param string $topic + * + * @return string The formatted topic resource. + */ + public static function topicName(string $project, string $topic): string + { + return self::getPathTemplate('topic')->render([ + 'project' => $project, + 'topic' => $topic, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a user + * resource. + * + * @param string $user + * + * @return string The formatted user resource. + */ + public static function userName(string $user): string + { + return self::getPathTemplate('user')->render([ + 'user' => $user, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - subscription: subscriptions/{subscription} + * - topic: projects/{project}/topics/{topic} + * - user: users/{user} + * + * 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 'workspaceevents.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); + $this->operationsClient = $this->createOperationsClient($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); + } + + /** + * Creates a Google Workspace subscription. To learn how to use this + * method, see [Create a Google Workspace + * subscription](https://developers.google.com/workspace/events/guides/create-subscription). + * + * The async variant is + * {@see SubscriptionsServiceClient::createSubscriptionAsync()} . + * + * @example samples/V1/SubscriptionsServiceClient/create_subscription.php + * + * @param CreateSubscriptionRequest $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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSubscription(CreateSubscriptionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateSubscription', $request, $callOptions)->wait(); + } + + /** + * Deletes a Google Workspace subscription. + * To learn how to use this method, see [Delete a Google Workspace + * subscription](https://developers.google.com/workspace/events/guides/delete-subscription). + * + * The async variant is + * {@see SubscriptionsServiceClient::deleteSubscriptionAsync()} . + * + * @example samples/V1/SubscriptionsServiceClient/delete_subscription.php + * + * @param DeleteSubscriptionRequest $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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSubscription(DeleteSubscriptionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteSubscription', $request, $callOptions)->wait(); + } + + /** + * Gets details about a Google Workspace subscription. To learn how to use + * this method, see [Get details about a Google Workspace + * subscription](https://developers.google.com/workspace/events/guides/get-subscription). + * + * The async variant is {@see SubscriptionsServiceClient::getSubscriptionAsync()} . + * + * @example samples/V1/SubscriptionsServiceClient/get_subscription.php + * + * @param GetSubscriptionRequest $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 Subscription + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSubscription(GetSubscriptionRequest $request, array $callOptions = []): Subscription + { + return $this->startApiCall('GetSubscription', $request, $callOptions)->wait(); + } + + /** + * Lists Google Workspace subscriptions. To learn how to use this method, see + * [List Google Workspace + * subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions). + * + * The async variant is {@see SubscriptionsServiceClient::listSubscriptionsAsync()} + * . + * + * @example samples/V1/SubscriptionsServiceClient/list_subscriptions.php + * + * @param ListSubscriptionsRequest $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 listSubscriptions(ListSubscriptionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSubscriptions', $request, $callOptions); + } + + /** + * Reactivates a suspended Google Workspace subscription. + * + * This method resets your subscription's `State` field to `ACTIVE`. Before + * you use this method, you must fix the error that suspended the + * subscription. To learn how to use this method, see [Reactivate a Google + * Workspace + * subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription). + * + * The async variant is + * {@see SubscriptionsServiceClient::reactivateSubscriptionAsync()} . + * + * @example samples/V1/SubscriptionsServiceClient/reactivate_subscription.php + * + * @param ReactivateSubscriptionRequest $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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function reactivateSubscription( + ReactivateSubscriptionRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('ReactivateSubscription', $request, $callOptions)->wait(); + } + + /** + * Updates or renews a Google Workspace subscription. To learn how to use this + * method, see [Update or renew a Google Workspace + * subscription](https://developers.google.com/workspace/events/guides/update-subscription). + * + * The async variant is + * {@see SubscriptionsServiceClient::updateSubscriptionAsync()} . + * + * @example samples/V1/SubscriptionsServiceClient/update_subscription.php + * + * @param UpdateSubscriptionRequest $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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSubscription(UpdateSubscriptionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateSubscription', $request, $callOptions)->wait(); + } +} diff --git a/AppsEventsSubscriptions/src/V1/CreateSubscriptionMetadata.php b/AppsEventsSubscriptions/src/V1/CreateSubscriptionMetadata.php new file mode 100644 index 000000000000..960d4cba6fad --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/CreateSubscriptionMetadata.php @@ -0,0 +1,33 @@ +google.apps.events.subscriptions.v1.CreateSubscriptionMetadata + */ +class CreateSubscriptionMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/CreateSubscriptionRequest.php b/AppsEventsSubscriptions/src/V1/CreateSubscriptionRequest.php new file mode 100644 index 000000000000..80878ed4a32e --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/CreateSubscriptionRequest.php @@ -0,0 +1,129 @@ +google.apps.events.subscriptions.v1.CreateSubscriptionRequest + */ +class CreateSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription resource to create. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subscription = null; + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * create the subscription. + * + * Generated from protobuf field bool validate_only = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param \Google\Apps\Events\Subscriptions\V1\Subscription $subscription Required. The subscription resource to create. + * + * @return \Google\Apps\Events\Subscriptions\V1\CreateSubscriptionRequest + * + * @experimental + */ + public static function build(\Google\Apps\Events\Subscriptions\V1\Subscription $subscription): self + { + return (new self()) + ->setSubscription($subscription); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Events\Subscriptions\V1\Subscription $subscription + * Required. The subscription resource to create. + * @type bool $validate_only + * Optional. If set to `true`, validates and previews the request, but doesn't + * create the subscription. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription resource to create. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Events\Subscriptions\V1\Subscription|null + */ + public function getSubscription() + { + return $this->subscription; + } + + public function hasSubscription() + { + return isset($this->subscription); + } + + public function clearSubscription() + { + unset($this->subscription); + } + + /** + * Required. The subscription resource to create. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Events\Subscriptions\V1\Subscription $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Events\Subscriptions\V1\Subscription::class); + $this->subscription = $var; + + return $this; + } + + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * create the subscription. + * + * Generated from protobuf field bool validate_only = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * create the subscription. + * + * Generated from protobuf field bool validate_only = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/DeleteSubscriptionMetadata.php b/AppsEventsSubscriptions/src/V1/DeleteSubscriptionMetadata.php new file mode 100644 index 000000000000..b27ec001d521 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/DeleteSubscriptionMetadata.php @@ -0,0 +1,33 @@ +google.apps.events.subscriptions.v1.DeleteSubscriptionMetadata + */ +class DeleteSubscriptionMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/DeleteSubscriptionRequest.php b/AppsEventsSubscriptions/src/V1/DeleteSubscriptionRequest.php new file mode 100644 index 000000000000..c8b623b86491 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/DeleteSubscriptionRequest.php @@ -0,0 +1,206 @@ +google.apps.events.subscriptions.v1.DeleteSubscriptionRequest + */ +class DeleteSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the subscription to delete. + * Format: `subscriptions/{subscription}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * delete the subscription. + * + * Generated from protobuf field bool validate_only = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to `true` and the subscription isn't found, the request + * succeeds but doesn't delete the subscription. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + /** + * Optional. Etag of the subscription. + * If present, it must match with the server's etag. Otherwise, request + * fails with the status `ABORTED`. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * @param string $name Required. Resource name of the subscription to delete. + * + * Format: `subscriptions/{subscription}` + * Please see {@see SubscriptionsServiceClient::subscriptionName()} for help formatting this field. + * + * @return \Google\Apps\Events\Subscriptions\V1\DeleteSubscriptionRequest + * + * @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 subscription to delete. + * Format: `subscriptions/{subscription}` + * @type bool $validate_only + * Optional. If set to `true`, validates and previews the request, but doesn't + * delete the subscription. + * @type bool $allow_missing + * Optional. If set to `true` and the subscription isn't found, the request + * succeeds but doesn't delete the subscription. + * @type string $etag + * Optional. Etag of the subscription. + * If present, it must match with the server's etag. Otherwise, request + * fails with the status `ABORTED`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the subscription to delete. + * Format: `subscriptions/{subscription}` + * + * 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 subscription to delete. + * Format: `subscriptions/{subscription}` + * + * 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; + } + + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * delete the subscription. + * + * Generated from protobuf field bool validate_only = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * delete the subscription. + * + * Generated from protobuf field bool validate_only = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to `true` and the subscription isn't found, the request + * succeeds but doesn't delete the subscription. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to `true` and the subscription isn't found, the request + * succeeds but doesn't delete the subscription. + * + * Generated from protobuf field bool allow_missing = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + + /** + * Optional. Etag of the subscription. + * If present, it must match with the server's etag. Otherwise, request + * fails with the status `ABORTED`. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. Etag of the subscription. + * If present, it must match with the server's etag. Otherwise, request + * fails with the status `ABORTED`. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/GetSubscriptionRequest.php b/AppsEventsSubscriptions/src/V1/GetSubscriptionRequest.php new file mode 100644 index 000000000000..d83540dbf787 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/GetSubscriptionRequest.php @@ -0,0 +1,88 @@ +google.apps.events.subscriptions.v1.GetSubscriptionRequest + */ +class GetSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * 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 subscription. + * + * Format: `subscriptions/{subscription}` + * Please see {@see SubscriptionsServiceClient::subscriptionName()} for help formatting this field. + * + * @return \Google\Apps\Events\Subscriptions\V1\GetSubscriptionRequest + * + * @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 subscription. + * Format: `subscriptions/{subscription}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * 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 subscription. + * Format: `subscriptions/{subscription}` + * + * 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/AppsEventsSubscriptions/src/V1/ListSubscriptionsRequest.php b/AppsEventsSubscriptions/src/V1/ListSubscriptionsRequest.php new file mode 100644 index 000000000000..f7fd25838a0d --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/ListSubscriptionsRequest.php @@ -0,0 +1,280 @@ +google.apps.events.subscriptions.v1.ListSubscriptionsRequest + */ +class ListSubscriptionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The maximum number of subscriptions to return. The service might + * return fewer than this value. + * If unspecified or set to `0`, up to 50 subscriptions are returned. + * The maximum value is 100. If you specify a value more than 100, the system + * only returns 100 subscriptions. + * + * 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 subscriptions 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 might lead to unexpected results. + * + * Generated from protobuf field string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Required. A query filter. + * You can filter subscriptions by event type (`event_types`) + * and target resource (`target_resource`). + * You must specify at least one event type in your query. To filter for + * multiple event types, use the `OR` operator. + * To filter by both event type and target resource, use the `AND` operator + * and specify the full resource name, such as + * `//chat.googleapis.com/spaces/{space}`. + * For example, the following queries are valid: + * ``` + * event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" + * event_types:"google.workspace.chat.message.v1.created" AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ( event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" ) AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ``` + * The server rejects invalid queries with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + + /** + * @param string $filter Required. A query filter. + * + * You can filter subscriptions by event type (`event_types`) + * and target resource (`target_resource`). + * + * You must specify at least one event type in your query. To filter for + * multiple event types, use the `OR` operator. + * + * To filter by both event type and target resource, use the `AND` operator + * and specify the full resource name, such as + * `//chat.googleapis.com/spaces/{space}`. + * + * For example, the following queries are valid: + * + * ``` + * event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" + * + * event_types:"google.workspace.chat.message.v1.created" AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * + * ( event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" ) AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ``` + * + * The server rejects invalid queries with an `INVALID_ARGUMENT` + * error. + * + * @return \Google\Apps\Events\Subscriptions\V1\ListSubscriptionsRequest + * + * @experimental + */ + public static function build(string $filter): self + { + return (new self()) + ->setFilter($filter); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $page_size + * Optional. The maximum number of subscriptions to return. The service might + * return fewer than this value. + * If unspecified or set to `0`, up to 50 subscriptions are returned. + * The maximum value is 100. If you specify a value more than 100, the system + * only returns 100 subscriptions. + * @type string $page_token + * Optional. A page token, received from a previous list subscriptions 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 might lead to unexpected results. + * @type string $filter + * Required. A query filter. + * You can filter subscriptions by event type (`event_types`) + * and target resource (`target_resource`). + * You must specify at least one event type in your query. To filter for + * multiple event types, use the `OR` operator. + * To filter by both event type and target resource, use the `AND` operator + * and specify the full resource name, such as + * `//chat.googleapis.com/spaces/{space}`. + * For example, the following queries are valid: + * ``` + * event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" + * event_types:"google.workspace.chat.message.v1.created" AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ( event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" ) AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ``` + * The server rejects invalid queries with an `INVALID_ARGUMENT` + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The maximum number of subscriptions to return. The service might + * return fewer than this value. + * If unspecified or set to `0`, up to 50 subscriptions are returned. + * The maximum value is 100. If you specify a value more than 100, the system + * only returns 100 subscriptions. + * + * 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 subscriptions to return. The service might + * return fewer than this value. + * If unspecified or set to `0`, up to 50 subscriptions are returned. + * The maximum value is 100. If you specify a value more than 100, the system + * only returns 100 subscriptions. + * + * 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 subscriptions 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 might 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 subscriptions 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 might 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; + } + + /** + * Required. A query filter. + * You can filter subscriptions by event type (`event_types`) + * and target resource (`target_resource`). + * You must specify at least one event type in your query. To filter for + * multiple event types, use the `OR` operator. + * To filter by both event type and target resource, use the `AND` operator + * and specify the full resource name, such as + * `//chat.googleapis.com/spaces/{space}`. + * For example, the following queries are valid: + * ``` + * event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" + * event_types:"google.workspace.chat.message.v1.created" AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ( event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" ) AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ``` + * The server rejects invalid queries with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A query filter. + * You can filter subscriptions by event type (`event_types`) + * and target resource (`target_resource`). + * You must specify at least one event type in your query. To filter for + * multiple event types, use the `OR` operator. + * To filter by both event type and target resource, use the `AND` operator + * and specify the full resource name, such as + * `//chat.googleapis.com/spaces/{space}`. + * For example, the following queries are valid: + * ``` + * event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" + * event_types:"google.workspace.chat.message.v1.created" AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ( event_types:"google.workspace.chat.membership.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created" ) AND + * target_resource="//chat.googleapis.com/spaces/{space}" + * ``` + * The server rejects invalid queries with an `INVALID_ARGUMENT` + * error. + * + * Generated from protobuf field string filter = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/ListSubscriptionsResponse.php b/AppsEventsSubscriptions/src/V1/ListSubscriptionsResponse.php new file mode 100644 index 000000000000..c90da100d04e --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/ListSubscriptionsResponse.php @@ -0,0 +1,106 @@ +google.apps.events.subscriptions.v1.ListSubscriptionsResponse + */ +class ListSubscriptionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of subscriptions. + * + * Generated from protobuf field repeated .google.apps.events.subscriptions.v1.Subscription subscriptions = 1; + */ + private $subscriptions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, 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\Events\Subscriptions\V1\Subscription>|\Google\Protobuf\Internal\RepeatedField $subscriptions + * List of subscriptions. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * List of subscriptions. + * + * Generated from protobuf field repeated .google.apps.events.subscriptions.v1.Subscription subscriptions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubscriptions() + { + return $this->subscriptions; + } + + /** + * List of subscriptions. + * + * Generated from protobuf field repeated .google.apps.events.subscriptions.v1.Subscription subscriptions = 1; + * @param array<\Google\Apps\Events\Subscriptions\V1\Subscription>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubscriptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Events\Subscriptions\V1\Subscription::class); + $this->subscriptions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, 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, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, 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/AppsEventsSubscriptions/src/V1/NotificationEndpoint.php b/AppsEventsSubscriptions/src/V1/NotificationEndpoint.php new file mode 100644 index 000000000000..933d59ee089b --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/NotificationEndpoint.php @@ -0,0 +1,96 @@ +google.apps.events.subscriptions.v1.NotificationEndpoint + */ +class NotificationEndpoint extends \Google\Protobuf\Internal\Message +{ + protected $endpoint; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $pubsub_topic + * Immutable. The Cloud Pub/Sub topic that receives events for the + * subscription. + * Format: `projects/{project}/topics/{topic}` + * You must create the topic in the same Google Cloud project where + * you create this subscription. + * When the topic receives events, the events are encoded as Cloud Pub/Sub + * messages. For details, see the [Google Cloud Pub/Sub Protocol Binding for + * CloudEvents](https://github.com/googleapis/google-cloudevents/blob/main/docs/spec/pubsub.md). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionResource::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. The Cloud Pub/Sub topic that receives events for the + * subscription. + * Format: `projects/{project}/topics/{topic}` + * You must create the topic in the same Google Cloud project where + * you create this subscription. + * When the topic receives events, the events are encoded as Cloud Pub/Sub + * messages. For details, see the [Google Cloud Pub/Sub Protocol Binding for + * CloudEvents](https://github.com/googleapis/google-cloudevents/blob/main/docs/spec/pubsub.md). + * + * Generated from protobuf field string pubsub_topic = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getPubsubTopic() + { + return $this->readOneof(1); + } + + public function hasPubsubTopic() + { + return $this->hasOneof(1); + } + + /** + * Immutable. The Cloud Pub/Sub topic that receives events for the + * subscription. + * Format: `projects/{project}/topics/{topic}` + * You must create the topic in the same Google Cloud project where + * you create this subscription. + * When the topic receives events, the events are encoded as Cloud Pub/Sub + * messages. For details, see the [Google Cloud Pub/Sub Protocol Binding for + * CloudEvents](https://github.com/googleapis/google-cloudevents/blob/main/docs/spec/pubsub.md). + * + * Generated from protobuf field string pubsub_topic = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPubsubTopic($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEndpoint() + { + return $this->whichOneof("endpoint"); + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/PayloadOptions.php b/AppsEventsSubscriptions/src/V1/PayloadOptions.php new file mode 100644 index 000000000000..081972c4159c --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/PayloadOptions.php @@ -0,0 +1,156 @@ +google.apps.events.subscriptions.v1.PayloadOptions + */ +class PayloadOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Whether the event payload includes data about the resource that + * changed. For example, for an event where a Google Chat message was created, + * whether the payload contains data about the + * [`Message`](https://developers.google.com/chat/api/reference/rest/v1/spaces.messages) + * resource. If false, the event payload only includes the name of the changed + * resource. + * + * Generated from protobuf field bool include_resource = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $include_resource = false; + /** + * Optional. If `include_resource` is set to `true`, the list of fields to + * include in the event payload. Separate fields with a comma. For example, to + * include a Google Chat message's sender and create time, enter + * `message.sender,message.createTime`. If omitted, the payload includes all + * fields for the resource. + * If you specify a field that doesn't exist for the resource, the system + * ignores the field. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $field_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $include_resource + * Optional. Whether the event payload includes data about the resource that + * changed. For example, for an event where a Google Chat message was created, + * whether the payload contains data about the + * [`Message`](https://developers.google.com/chat/api/reference/rest/v1/spaces.messages) + * resource. If false, the event payload only includes the name of the changed + * resource. + * @type \Google\Protobuf\FieldMask $field_mask + * Optional. If `include_resource` is set to `true`, the list of fields to + * include in the event payload. Separate fields with a comma. For example, to + * include a Google Chat message's sender and create time, enter + * `message.sender,message.createTime`. If omitted, the payload includes all + * fields for the resource. + * If you specify a field that doesn't exist for the resource, the system + * ignores the field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionResource::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Whether the event payload includes data about the resource that + * changed. For example, for an event where a Google Chat message was created, + * whether the payload contains data about the + * [`Message`](https://developers.google.com/chat/api/reference/rest/v1/spaces.messages) + * resource. If false, the event payload only includes the name of the changed + * resource. + * + * Generated from protobuf field bool include_resource = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIncludeResource() + { + return $this->include_resource; + } + + /** + * Optional. Whether the event payload includes data about the resource that + * changed. For example, for an event where a Google Chat message was created, + * whether the payload contains data about the + * [`Message`](https://developers.google.com/chat/api/reference/rest/v1/spaces.messages) + * resource. If false, the event payload only includes the name of the changed + * resource. + * + * Generated from protobuf field bool include_resource = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIncludeResource($var) + { + GPBUtil::checkBool($var); + $this->include_resource = $var; + + return $this; + } + + /** + * Optional. If `include_resource` is set to `true`, the list of fields to + * include in the event payload. Separate fields with a comma. For example, to + * include a Google Chat message's sender and create time, enter + * `message.sender,message.createTime`. If omitted, the payload includes all + * fields for the resource. + * If you specify a field that doesn't exist for the resource, the system + * ignores the field. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getFieldMask() + { + return $this->field_mask; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * Optional. If `include_resource` is set to `true`, the list of fields to + * include in the event payload. Separate fields with a comma. For example, to + * include a Google Chat message's sender and create time, enter + * `message.sender,message.createTime`. If omitted, the payload includes all + * fields for the resource. + * If you specify a field that doesn't exist for the resource, the system + * ignores the field. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/ReactivateSubscriptionMetadata.php b/AppsEventsSubscriptions/src/V1/ReactivateSubscriptionMetadata.php new file mode 100644 index 000000000000..7e42c89b7475 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/ReactivateSubscriptionMetadata.php @@ -0,0 +1,33 @@ +google.apps.events.subscriptions.v1.ReactivateSubscriptionMetadata + */ +class ReactivateSubscriptionMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/ReactivateSubscriptionRequest.php b/AppsEventsSubscriptions/src/V1/ReactivateSubscriptionRequest.php new file mode 100644 index 000000000000..b4cd32be6af2 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/ReactivateSubscriptionRequest.php @@ -0,0 +1,88 @@ +google.apps.events.subscriptions.v1.ReactivateSubscriptionRequest + */ +class ReactivateSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * 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 subscription. + * + * Format: `subscriptions/{subscription}` + * Please see {@see SubscriptionsServiceClient::subscriptionName()} for help formatting this field. + * + * @return \Google\Apps\Events\Subscriptions\V1\ReactivateSubscriptionRequest + * + * @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 subscription. + * Format: `subscriptions/{subscription}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * 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 subscription. + * Format: `subscriptions/{subscription}` + * + * 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/AppsEventsSubscriptions/src/V1/Subscription.php b/AppsEventsSubscriptions/src/V1/Subscription.php new file mode 100644 index 000000000000..348f5b03ccb7 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/Subscription.php @@ -0,0 +1,734 @@ +google.apps.events.subscriptions.v1.Subscription + */ +class Subscription extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Immutable. Identifier. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $name = ''; + /** + * Output only. System-assigned unique identifier for the subscription. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Required. Immutable. The Google Workspace resource that's monitored for + * events, formatted as the [full resource + * name](https://google.aip.dev/122#full-resource-names). To learn about + * target resources and the events that they support, see [Supported Google + * Workspace + * events](https://developers.google.com/workspace/events#supported-events). + * A user can only authorize your app to create one subscription for a given + * target resource. If your app tries to create another subscription with the + * same user credentials, the request returns an `ALREADY_EXISTS` error. + * + * Generated from protobuf field string target_resource = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $target_resource = ''; + /** + * Required. Immutable. Unordered list. Input for creating a subscription. + * Otherwise, output only. One or more types of events to receive about the + * target resource. Formatted according to the CloudEvents specification. + * The supported event types depend on the target resource of your + * subscription. For details, see [Supported Google Workspace + * events](https://developers.google.com/workspace/events/guides#supported-events). + * By default, you also receive events about the [lifecycle of your + * subscription](https://developers.google.com/workspace/events/guides/events-lifecycle). + * You don't need to specify lifecycle events for this field. + * If you specify an event type that doesn't exist for the target resource, + * the request returns an HTTP `400 Bad Request` status code. + * + * Generated from protobuf field repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE]; + */ + private $event_types; + /** + * Optional. Options about what data to include in the event payload. Only + * supported for Google Chat events. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.PayloadOptions payload_options = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $payload_options = null; + /** + * Required. Immutable. The endpoint where the subscription delivers events, + * such as a Pub/Sub topic. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.NotificationEndpoint notification_endpoint = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $notification_endpoint = null; + /** + * Output only. The state of the subscription. Determines whether the + * subscription can receive events and deliver them to the notification + * endpoint. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The error that suspended the subscription. + * To reactivate the subscription, resolve the error and call the + * [`ReactivateSubscription`][google.apps.events.subscriptions.v1.SubscriptionsService.ReactivateSubscription] + * method. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription.ErrorType suspension_reason = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $suspension_reason = 0; + /** + * Output only. The user who authorized the creation of the + * subscription. + * Format: `users/{user}` + * For Google Workspace users, the `{user}` value is the + * [`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids) + * field from the Directory API. + * + * Generated from protobuf field string authority = 10 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $authority = ''; + /** + * Output only. The time when the subscription is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The last time that the subscription is updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. If `true`, the subscription is in the process of being + * updated. + * + * Generated from protobuf field bool reconciling = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and might be sent on update requests to ensure the client has + * an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + protected $expiration; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $expire_time + * Non-empty default. The timestamp in UTC when the subscription expires. + * Always displayed on output, regardless of what was used on input. + * @type \Google\Protobuf\Duration $ttl + * Input only. The time-to-live (TTL) or duration for the subscription. If + * unspecified or set to `0`, uses the maximum possible duration. + * @type string $name + * Optional. Immutable. Identifier. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * @type string $uid + * Output only. System-assigned unique identifier for the subscription. + * @type string $target_resource + * Required. Immutable. The Google Workspace resource that's monitored for + * events, formatted as the [full resource + * name](https://google.aip.dev/122#full-resource-names). To learn about + * target resources and the events that they support, see [Supported Google + * Workspace + * events](https://developers.google.com/workspace/events#supported-events). + * A user can only authorize your app to create one subscription for a given + * target resource. If your app tries to create another subscription with the + * same user credentials, the request returns an `ALREADY_EXISTS` error. + * @type array|\Google\Protobuf\Internal\RepeatedField $event_types + * Required. Immutable. Unordered list. Input for creating a subscription. + * Otherwise, output only. One or more types of events to receive about the + * target resource. Formatted according to the CloudEvents specification. + * The supported event types depend on the target resource of your + * subscription. For details, see [Supported Google Workspace + * events](https://developers.google.com/workspace/events/guides#supported-events). + * By default, you also receive events about the [lifecycle of your + * subscription](https://developers.google.com/workspace/events/guides/events-lifecycle). + * You don't need to specify lifecycle events for this field. + * If you specify an event type that doesn't exist for the target resource, + * the request returns an HTTP `400 Bad Request` status code. + * @type \Google\Apps\Events\Subscriptions\V1\PayloadOptions $payload_options + * Optional. Options about what data to include in the event payload. Only + * supported for Google Chat events. + * @type \Google\Apps\Events\Subscriptions\V1\NotificationEndpoint $notification_endpoint + * Required. Immutable. The endpoint where the subscription delivers events, + * such as a Pub/Sub topic. + * @type int $state + * Output only. The state of the subscription. Determines whether the + * subscription can receive events and deliver them to the notification + * endpoint. + * @type int $suspension_reason + * Output only. The error that suspended the subscription. + * To reactivate the subscription, resolve the error and call the + * [`ReactivateSubscription`][google.apps.events.subscriptions.v1.SubscriptionsService.ReactivateSubscription] + * method. + * @type string $authority + * Output only. The user who authorized the creation of the + * subscription. + * Format: `users/{user}` + * For Google Workspace users, the `{user}` value is the + * [`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids) + * field from the Directory API. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the subscription is created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last time that the subscription is updated. + * @type bool $reconciling + * Output only. If `true`, the subscription is in the process of being + * updated. + * @type string $etag + * Optional. This checksum is computed by the server based on the value of + * other fields, and might be sent on update requests to ensure the client has + * an up-to-date value before proceeding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionResource::initOnce(); + parent::__construct($data); + } + + /** + * Non-empty default. The timestamp in UTC when the subscription expires. + * Always displayed on output, regardless of what was used on input. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 13 [(.google.api.field_behavior) = NON_EMPTY_DEFAULT]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->readOneof(13); + } + + public function hasExpireTime() + { + return $this->hasOneof(13); + } + + /** + * Non-empty default. The timestamp in UTC when the subscription expires. + * Always displayed on output, regardless of what was used on input. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 13 [(.google.api.field_behavior) = NON_EMPTY_DEFAULT]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Input only. The time-to-live (TTL) or duration for the subscription. If + * unspecified or set to `0`, uses the maximum possible duration. + * + * Generated from protobuf field .google.protobuf.Duration ttl = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Protobuf\Duration|null + */ + public function getTtl() + { + return $this->readOneof(14); + } + + public function hasTtl() + { + return $this->hasOneof(14); + } + + /** + * Input only. The time-to-live (TTL) or duration for the subscription. If + * unspecified or set to `0`, uses the maximum possible duration. + * + * Generated from protobuf field .google.protobuf.Duration ttl = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTtl($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Optional. Immutable. Identifier. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Optional. Immutable. Identifier. Resource name of the subscription. + * Format: `subscriptions/{subscription}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER, (.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. System-assigned unique identifier for the subscription. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-assigned unique identifier for the subscription. + * + * Generated from protobuf field string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Required. Immutable. The Google Workspace resource that's monitored for + * events, formatted as the [full resource + * name](https://google.aip.dev/122#full-resource-names). To learn about + * target resources and the events that they support, see [Supported Google + * Workspace + * events](https://developers.google.com/workspace/events#supported-events). + * A user can only authorize your app to create one subscription for a given + * target resource. If your app tries to create another subscription with the + * same user credentials, the request returns an `ALREADY_EXISTS` error. + * + * Generated from protobuf field string target_resource = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTargetResource() + { + return $this->target_resource; + } + + /** + * Required. Immutable. The Google Workspace resource that's monitored for + * events, formatted as the [full resource + * name](https://google.aip.dev/122#full-resource-names). To learn about + * target resources and the events that they support, see [Supported Google + * Workspace + * events](https://developers.google.com/workspace/events#supported-events). + * A user can only authorize your app to create one subscription for a given + * target resource. If your app tries to create another subscription with the + * same user credentials, the request returns an `ALREADY_EXISTS` error. + * + * Generated from protobuf field string target_resource = 4 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetResource($var) + { + GPBUtil::checkString($var, True); + $this->target_resource = $var; + + return $this; + } + + /** + * Required. Immutable. Unordered list. Input for creating a subscription. + * Otherwise, output only. One or more types of events to receive about the + * target resource. Formatted according to the CloudEvents specification. + * The supported event types depend on the target resource of your + * subscription. For details, see [Supported Google Workspace + * events](https://developers.google.com/workspace/events/guides#supported-events). + * By default, you also receive events about the [lifecycle of your + * subscription](https://developers.google.com/workspace/events/guides/events-lifecycle). + * You don't need to specify lifecycle events for this field. + * If you specify an event type that doesn't exist for the target resource, + * the request returns an HTTP `400 Bad Request` status code. + * + * Generated from protobuf field repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEventTypes() + { + return $this->event_types; + } + + /** + * Required. Immutable. Unordered list. Input for creating a subscription. + * Otherwise, output only. One or more types of events to receive about the + * target resource. Formatted according to the CloudEvents specification. + * The supported event types depend on the target resource of your + * subscription. For details, see [Supported Google Workspace + * events](https://developers.google.com/workspace/events/guides#supported-events). + * By default, you also receive events about the [lifecycle of your + * subscription](https://developers.google.com/workspace/events/guides/events-lifecycle). + * You don't need to specify lifecycle events for this field. + * If you specify an event type that doesn't exist for the target resource, + * the request returns an HTTP `400 Bad Request` status code. + * + * Generated from protobuf field repeated string event_types = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = IMMUTABLE]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEventTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->event_types = $arr; + + return $this; + } + + /** + * Optional. Options about what data to include in the event payload. Only + * supported for Google Chat events. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.PayloadOptions payload_options = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Apps\Events\Subscriptions\V1\PayloadOptions|null + */ + public function getPayloadOptions() + { + return $this->payload_options; + } + + public function hasPayloadOptions() + { + return isset($this->payload_options); + } + + public function clearPayloadOptions() + { + unset($this->payload_options); + } + + /** + * Optional. Options about what data to include in the event payload. Only + * supported for Google Chat events. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.PayloadOptions payload_options = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Apps\Events\Subscriptions\V1\PayloadOptions $var + * @return $this + */ + public function setPayloadOptions($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Events\Subscriptions\V1\PayloadOptions::class); + $this->payload_options = $var; + + return $this; + } + + /** + * Required. Immutable. The endpoint where the subscription delivers events, + * such as a Pub/Sub topic. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.NotificationEndpoint notification_endpoint = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Apps\Events\Subscriptions\V1\NotificationEndpoint|null + */ + public function getNotificationEndpoint() + { + return $this->notification_endpoint; + } + + public function hasNotificationEndpoint() + { + return isset($this->notification_endpoint); + } + + public function clearNotificationEndpoint() + { + unset($this->notification_endpoint); + } + + /** + * Required. Immutable. The endpoint where the subscription delivers events, + * such as a Pub/Sub topic. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.NotificationEndpoint notification_endpoint = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Apps\Events\Subscriptions\V1\NotificationEndpoint $var + * @return $this + */ + public function setNotificationEndpoint($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Events\Subscriptions\V1\NotificationEndpoint::class); + $this->notification_endpoint = $var; + + return $this; + } + + /** + * Output only. The state of the subscription. Determines whether the + * subscription can receive events and deliver them to the notification + * endpoint. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the subscription. Determines whether the + * subscription can receive events and deliver them to the notification + * endpoint. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Events\Subscriptions\V1\Subscription\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The error that suspended the subscription. + * To reactivate the subscription, resolve the error and call the + * [`ReactivateSubscription`][google.apps.events.subscriptions.v1.SubscriptionsService.ReactivateSubscription] + * method. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription.ErrorType suspension_reason = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSuspensionReason() + { + return $this->suspension_reason; + } + + /** + * Output only. The error that suspended the subscription. + * To reactivate the subscription, resolve the error and call the + * [`ReactivateSubscription`][google.apps.events.subscriptions.v1.SubscriptionsService.ReactivateSubscription] + * method. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription.ErrorType suspension_reason = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSuspensionReason($var) + { + GPBUtil::checkEnum($var, \Google\Apps\Events\Subscriptions\V1\Subscription\ErrorType::class); + $this->suspension_reason = $var; + + return $this; + } + + /** + * Output only. The user who authorized the creation of the + * subscription. + * Format: `users/{user}` + * For Google Workspace users, the `{user}` value is the + * [`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids) + * field from the Directory API. + * + * Generated from protobuf field string authority = 10 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthority() + { + return $this->authority; + } + + /** + * Output only. The user who authorized the creation of the + * subscription. + * Format: `users/{user}` + * For Google Workspace users, the `{user}` value is the + * [`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids) + * field from the Directory API. + * + * Generated from protobuf field string authority = 10 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthority($var) + { + GPBUtil::checkString($var, True); + $this->authority = $var; + + return $this; + } + + /** + * Output only. The time when the subscription is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @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); + } + + /** + * Output only. The time when the subscription is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @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 last time that the subscription is updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The last time that the subscription is updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. If `true`, the subscription is in the process of being + * updated. + * + * Generated from protobuf field bool reconciling = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If `true`, the subscription is in the process of being + * updated. + * + * Generated from protobuf field bool reconciling = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and might be sent on update requests to ensure the client has + * an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. This checksum is computed by the server based on the value of + * other fields, and might be sent on update requests to ensure the client has + * an up-to-date value before proceeding. + * + * Generated from protobuf field string etag = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * @return string + */ + public function getExpiration() + { + return $this->whichOneof("expiration"); + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/Subscription/ErrorType.php b/AppsEventsSubscriptions/src/V1/Subscription/ErrorType.php new file mode 100644 index 000000000000..d98cb651ef44 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/Subscription/ErrorType.php @@ -0,0 +1,105 @@ +google.apps.events.subscriptions.v1.Subscription.ErrorType + */ +class ErrorType +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum ERROR_TYPE_UNSPECIFIED = 0; + */ + const ERROR_TYPE_UNSPECIFIED = 0; + /** + * The authorizing user has revoked the grant of one or more OAuth scopes. + * To learn more about authorization for Google Workspace, see [Configure + * the OAuth consent + * screen](https://developers.google.com/workspace/guides/configure-oauth-consent#choose-scopes). + * + * Generated from protobuf enum USER_SCOPE_REVOKED = 1; + */ + const USER_SCOPE_REVOKED = 1; + /** + * The target resource for the subscription no longer exists. + * + * Generated from protobuf enum RESOURCE_DELETED = 2; + */ + const RESOURCE_DELETED = 2; + /** + * The user that authorized the creation of the subscription no longer has + * access to the subscription's target resource. + * + * Generated from protobuf enum USER_AUTHORIZATION_FAILURE = 3; + */ + const USER_AUTHORIZATION_FAILURE = 3; + /** + * The Google Workspace application doesn't have access to deliver + * events to your subscription's notification endpoint. + * + * Generated from protobuf enum ENDPOINT_PERMISSION_DENIED = 4; + */ + const ENDPOINT_PERMISSION_DENIED = 4; + /** + * The subscription's notification endpoint doesn't exist, or the endpoint + * can't be found in the Google Cloud project where you created the + * subscription. + * + * Generated from protobuf enum ENDPOINT_NOT_FOUND = 6; + */ + const ENDPOINT_NOT_FOUND = 6; + /** + * The subscription's notification endpoint failed to receive events due to + * insufficient quota or reaching rate limiting. + * + * Generated from protobuf enum ENDPOINT_RESOURCE_EXHAUSTED = 7; + */ + const ENDPOINT_RESOURCE_EXHAUSTED = 7; + /** + * An unidentified error has occurred. + * + * Generated from protobuf enum OTHER = 5; + */ + const OTHER = 5; + + private static $valueToName = [ + self::ERROR_TYPE_UNSPECIFIED => 'ERROR_TYPE_UNSPECIFIED', + self::USER_SCOPE_REVOKED => 'USER_SCOPE_REVOKED', + self::RESOURCE_DELETED => 'RESOURCE_DELETED', + self::USER_AUTHORIZATION_FAILURE => 'USER_AUTHORIZATION_FAILURE', + self::ENDPOINT_PERMISSION_DENIED => 'ENDPOINT_PERMISSION_DENIED', + self::ENDPOINT_NOT_FOUND => 'ENDPOINT_NOT_FOUND', + self::ENDPOINT_RESOURCE_EXHAUSTED => 'ENDPOINT_RESOURCE_EXHAUSTED', + self::OTHER => 'OTHER', + ]; + + 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/AppsEventsSubscriptions/src/V1/Subscription/State.php b/AppsEventsSubscriptions/src/V1/Subscription/State.php new file mode 100644 index 000000000000..9c434cfc121c --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/Subscription/State.php @@ -0,0 +1,73 @@ +google.apps.events.subscriptions.v1.Subscription.State + */ +class State +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The subscription is active and can receive and deliver events to its + * notification endpoint. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The subscription is unable to receive events due to an error. + * To identify the error, see the + * [`suspension_reason`][google.apps.events.subscriptions.v1.Subscription.suspension_reason] + * field. + * + * Generated from protobuf enum SUSPENDED = 2; + */ + const SUSPENDED = 2; + /** + * The subscription is deleted. + * + * Generated from protobuf enum DELETED = 3; + */ + const DELETED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::SUSPENDED => 'SUSPENDED', + self::DELETED => 'DELETED', + ]; + + 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/AppsEventsSubscriptions/src/V1/UpdateSubscriptionMetadata.php b/AppsEventsSubscriptions/src/V1/UpdateSubscriptionMetadata.php new file mode 100644 index 000000000000..dbe1d0d94f1d --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/UpdateSubscriptionMetadata.php @@ -0,0 +1,33 @@ +google.apps.events.subscriptions.v1.UpdateSubscriptionMetadata + */ +class UpdateSubscriptionMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/UpdateSubscriptionRequest.php b/AppsEventsSubscriptions/src/V1/UpdateSubscriptionRequest.php new file mode 100644 index 000000000000..890c2651a159 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/UpdateSubscriptionRequest.php @@ -0,0 +1,218 @@ +google.apps.events.subscriptions.v1.UpdateSubscriptionRequest + */ +class UpdateSubscriptionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The subscription to update. + * The subscription's `name` field is used to identify the subscription to + * update. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subscription = null; + /** + * Optional. Required. The field to update. + * You can update one of the following fields in a subscription: + * * [`expire_time`][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the + * subscription expires. + * * [`ttl`][google.apps.events.subscriptions.v1.Subscription.ttl]: The + * time-to-live (TTL) or duration of the + * subscription. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * update the subscription. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param \Google\Apps\Events\Subscriptions\V1\Subscription $subscription Required. The subscription to update. + * + * The subscription's `name` field is used to identify the subscription to + * update. + * @param \Google\Protobuf\FieldMask $updateMask Optional. Required. The field to update. + * + * You can update one of the following fields in a subscription: + * + * * [`expire_time`][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the + * subscription expires. + * * [`ttl`][google.apps.events.subscriptions.v1.Subscription.ttl]: The + * time-to-live (TTL) or duration of the + * subscription. + * + * @return \Google\Apps\Events\Subscriptions\V1\UpdateSubscriptionRequest + * + * @experimental + */ + public static function build(\Google\Apps\Events\Subscriptions\V1\Subscription $subscription, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSubscription($subscription) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Apps\Events\Subscriptions\V1\Subscription $subscription + * Required. The subscription to update. + * The subscription's `name` field is used to identify the subscription to + * update. + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Required. The field to update. + * You can update one of the following fields in a subscription: + * * [`expire_time`][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the + * subscription expires. + * * [`ttl`][google.apps.events.subscriptions.v1.Subscription.ttl]: The + * time-to-live (TTL) or duration of the + * subscription. + * @type bool $validate_only + * Optional. If set to `true`, validates and previews the request, but doesn't + * update the subscription. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Apps\Events\Subscriptions\V1\SubscriptionsService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The subscription to update. + * The subscription's `name` field is used to identify the subscription to + * update. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Apps\Events\Subscriptions\V1\Subscription|null + */ + public function getSubscription() + { + return $this->subscription; + } + + public function hasSubscription() + { + return isset($this->subscription); + } + + public function clearSubscription() + { + unset($this->subscription); + } + + /** + * Required. The subscription to update. + * The subscription's `name` field is used to identify the subscription to + * update. + * + * Generated from protobuf field .google.apps.events.subscriptions.v1.Subscription subscription = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Apps\Events\Subscriptions\V1\Subscription $var + * @return $this + */ + public function setSubscription($var) + { + GPBUtil::checkMessage($var, \Google\Apps\Events\Subscriptions\V1\Subscription::class); + $this->subscription = $var; + + return $this; + } + + /** + * Optional. Required. The field to update. + * You can update one of the following fields in a subscription: + * * [`expire_time`][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the + * subscription expires. + * * [`ttl`][google.apps.events.subscriptions.v1.Subscription.ttl]: The + * time-to-live (TTL) or duration of the + * subscription. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Required. The field to update. + * You can update one of the following fields in a subscription: + * * [`expire_time`][google.apps.events.subscriptions.v1.Subscription.expire_time]: The timestamp when the + * subscription expires. + * * [`ttl`][google.apps.events.subscriptions.v1.Subscription.ttl]: The + * time-to-live (TTL) or duration of the + * subscription. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @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 set to `true`, validates and previews the request, but doesn't + * update the subscription. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set to `true`, validates and previews the request, but doesn't + * update the subscription. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AppsEventsSubscriptions/src/V1/gapic_metadata.json b/AppsEventsSubscriptions/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..701d13468747 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/gapic_metadata.json @@ -0,0 +1,48 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.apps.events.subscriptions.v1", + "libraryPackage": "Google\\Apps\\Events\\Subscriptions\\V1", + "services": { + "SubscriptionsService": { + "clients": { + "grpc": { + "libraryClient": "SubscriptionsServiceGapicClient", + "rpcs": { + "CreateSubscription": { + "methods": [ + "createSubscription" + ] + }, + "DeleteSubscription": { + "methods": [ + "deleteSubscription" + ] + }, + "GetSubscription": { + "methods": [ + "getSubscription" + ] + }, + "ListSubscriptions": { + "methods": [ + "listSubscriptions" + ] + }, + "ReactivateSubscription": { + "methods": [ + "reactivateSubscription" + ] + }, + "UpdateSubscription": { + "methods": [ + "updateSubscription" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_client_config.json b/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_client_config.json new file mode 100644 index 000000000000..15ea2f8e0538 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.apps.events.subscriptions.v1.SubscriptionsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [] + }, + "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": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListSubscriptions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ReactivateSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateSubscription": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_descriptor_config.php b/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_descriptor_config.php new file mode 100644 index 000000000000..bee3307222d7 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_descriptor_config.php @@ -0,0 +1,106 @@ + [ + 'google.apps.events.subscriptions.v1.SubscriptionsService' => [ + 'CreateSubscription' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Apps\Events\Subscriptions\V1\Subscription', + 'metadataReturnType' => '\Google\Apps\Events\Subscriptions\V1\CreateSubscriptionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + ], + 'DeleteSubscription' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Apps\Events\Subscriptions\V1\DeleteSubscriptionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ReactivateSubscription' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Apps\Events\Subscriptions\V1\Subscription', + 'metadataReturnType' => '\Google\Apps\Events\Subscriptions\V1\ReactivateSubscriptionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateSubscription' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Apps\Events\Subscriptions\V1\Subscription', + 'metadataReturnType' => '\Google\Apps\Events\Subscriptions\V1\UpdateSubscriptionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'subscription.name', + 'fieldAccessors' => [ + 'getSubscription', + 'getName', + ], + ], + ], + ], + 'GetSubscription' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Apps\Events\Subscriptions\V1\Subscription', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListSubscriptions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSubscriptions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Apps\Events\Subscriptions\V1\ListSubscriptionsResponse', + ], + 'templateMap' => [ + 'subscription' => 'subscriptions/{subscription}', + 'topic' => 'projects/{project}/topics/{topic}', + 'user' => 'users/{user}', + ], + ], + ], +]; diff --git a/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_rest_client_config.php b/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_rest_client_config.php new file mode 100644 index 000000000000..b30502cfd272 --- /dev/null +++ b/AppsEventsSubscriptions/src/V1/resources/subscriptions_service_rest_client_config.php @@ -0,0 +1,81 @@ + [ + 'google.apps.events.subscriptions.v1.SubscriptionsService' => [ + 'CreateSubscription' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/subscriptions', + 'body' => 'subscription', + ], + 'DeleteSubscription' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=subscriptions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSubscription' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=subscriptions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListSubscriptions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/subscriptions', + 'queryParams' => [ + 'filter', + ], + ], + 'ReactivateSubscription' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=subscriptions/*}:reactivate', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateSubscription' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{subscription.name=subscriptions/*}', + 'body' => 'subscription', + 'placeholders' => [ + 'subscription.name' => [ + 'getters' => [ + 'getSubscription', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/**}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/AppsEventsSubscriptions/tests/Unit/V1/Client/SubscriptionsServiceClientTest.php b/AppsEventsSubscriptions/tests/Unit/V1/Client/SubscriptionsServiceClientTest.php new file mode 100644 index 000000000000..7098b977aeb0 --- /dev/null +++ b/AppsEventsSubscriptions/tests/Unit/V1/Client/SubscriptionsServiceClientTest.php @@ -0,0 +1,869 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return SubscriptionsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SubscriptionsServiceClient($options); + } + + /** @test */ + public function createSubscriptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $targetResource = 'targetResource-69552388'; + $authority = 'authority1475610435'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setTargetResource($targetResource); + $expectedResponse->setAuthority($authority); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSubscriptionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $subscription = new Subscription(); + $subscriptionTargetResource = 'subscriptionTargetResource-1934694596'; + $subscription->setTargetResource($subscriptionTargetResource); + $subscriptionEventTypes = []; + $subscription->setEventTypes($subscriptionEventTypes); + $subscriptionNotificationEndpoint = new NotificationEndpoint(); + $subscription->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new CreateSubscriptionRequest())->setSubscription($subscription); + $response = $gapicClient->createSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame( + '/google.apps.events.subscriptions.v1.SubscriptionsService/CreateSubscription', + $actualApiFuncCall + ); + $actualValue = $actualApiRequestObject->getSubscription(); + $this->assertProtobufEquals($subscription, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSubscriptionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createSubscriptionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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 + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $subscription = new Subscription(); + $subscriptionTargetResource = 'subscriptionTargetResource-1934694596'; + $subscription->setTargetResource($subscriptionTargetResource); + $subscriptionEventTypes = []; + $subscription->setEventTypes($subscriptionEventTypes); + $subscriptionNotificationEndpoint = new NotificationEndpoint(); + $subscription->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new CreateSubscriptionRequest())->setSubscription($subscription); + $response = $gapicClient->createSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSubscriptionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteSubscriptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteSubscriptionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->subscriptionName('[SUBSCRIPTION]'); + $request = (new DeleteSubscriptionRequest())->setName($formattedName); + $response = $gapicClient->deleteSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame( + '/google.apps.events.subscriptions.v1.SubscriptionsService/DeleteSubscription', + $actualApiFuncCall + ); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSubscriptionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteSubscriptionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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 + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->subscriptionName('[SUBSCRIPTION]'); + $request = (new DeleteSubscriptionRequest())->setName($formattedName); + $response = $gapicClient->deleteSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSubscriptionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getSubscriptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $targetResource = 'targetResource-69552388'; + $authority = 'authority1475610435'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setTargetResource($targetResource); + $expectedResponse->setAuthority($authority); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->subscriptionName('[SUBSCRIPTION]'); + $request = (new GetSubscriptionRequest())->setName($formattedName); + $response = $gapicClient->getSubscription($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.apps.events.subscriptions.v1.SubscriptionsService/GetSubscription', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubscriptionExceptionTest() + { + $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->subscriptionName('[SUBSCRIPTION]'); + $request = (new GetSubscriptionRequest())->setName($formattedName); + try { + $gapicClient->getSubscription($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 listSubscriptionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subscriptionsElement = new Subscription(); + $subscriptions = [$subscriptionsElement]; + $expectedResponse = new ListSubscriptionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubscriptions($subscriptions); + $transport->addResponse($expectedResponse); + // Mock request + $filter = 'filter-1274492040'; + $request = (new ListSubscriptionsRequest())->setFilter($filter); + $response = $gapicClient->listSubscriptions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubscriptions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.apps.events.subscriptions.v1.SubscriptionsService/ListSubscriptions', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getFilter(); + $this->assertProtobufEquals($filter, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubscriptionsExceptionTest() + { + $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 + $filter = 'filter-1274492040'; + $request = (new ListSubscriptionsRequest())->setFilter($filter); + try { + $gapicClient->listSubscriptions($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 reactivateSubscriptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/reactivateSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $targetResource = 'targetResource-69552388'; + $authority = 'authority1475610435'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setTargetResource($targetResource); + $expectedResponse->setAuthority($authority); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/reactivateSubscriptionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->subscriptionName('[SUBSCRIPTION]'); + $request = (new ReactivateSubscriptionRequest())->setName($formattedName); + $response = $gapicClient->reactivateSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame( + '/google.apps.events.subscriptions.v1.SubscriptionsService/ReactivateSubscription', + $actualApiFuncCall + ); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reactivateSubscriptionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function reactivateSubscriptionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/reactivateSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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 + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->subscriptionName('[SUBSCRIPTION]'); + $request = (new ReactivateSubscriptionRequest())->setName($formattedName); + $response = $gapicClient->reactivateSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reactivateSubscriptionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateSubscriptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $targetResource = 'targetResource-69552388'; + $authority = 'authority1475610435'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setTargetResource($targetResource); + $expectedResponse->setAuthority($authority); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSubscriptionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $subscription = new Subscription(); + $subscriptionTargetResource = 'subscriptionTargetResource-1934694596'; + $subscription->setTargetResource($subscriptionTargetResource); + $subscriptionEventTypes = []; + $subscription->setEventTypes($subscriptionEventTypes); + $subscriptionNotificationEndpoint = new NotificationEndpoint(); + $subscription->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new UpdateSubscriptionRequest())->setSubscription($subscription); + $response = $gapicClient->updateSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame( + '/google.apps.events.subscriptions.v1.SubscriptionsService/UpdateSubscription', + $actualApiFuncCall + ); + $actualValue = $actualApiRequestObject->getSubscription(); + $this->assertProtobufEquals($subscription, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSubscriptionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateSubscriptionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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 + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $subscription = new Subscription(); + $subscriptionTargetResource = 'subscriptionTargetResource-1934694596'; + $subscription->setTargetResource($subscriptionTargetResource); + $subscriptionEventTypes = []; + $subscription->setEventTypes($subscriptionEventTypes); + $subscriptionNotificationEndpoint = new NotificationEndpoint(); + $subscription->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new UpdateSubscriptionRequest())->setSubscription($subscription); + $response = $gapicClient->updateSubscription($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSubscriptionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createSubscriptionAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createSubscriptionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $targetResource = 'targetResource-69552388'; + $authority = 'authority1475610435'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Subscription(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setTargetResource($targetResource); + $expectedResponse->setAuthority($authority); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSubscriptionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $subscription = new Subscription(); + $subscriptionTargetResource = 'subscriptionTargetResource-1934694596'; + $subscription->setTargetResource($subscriptionTargetResource); + $subscriptionEventTypes = []; + $subscription->setEventTypes($subscriptionEventTypes); + $subscriptionNotificationEndpoint = new NotificationEndpoint(); + $subscription->setNotificationEndpoint($subscriptionNotificationEndpoint); + $request = (new CreateSubscriptionRequest())->setSubscription($subscription); + $response = $gapicClient->createSubscriptionAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame( + '/google.apps.events.subscriptions.v1.SubscriptionsService/CreateSubscription', + $actualApiFuncCall + ); + $actualValue = $actualApiRequestObject->getSubscription(); + $this->assertProtobufEquals($subscription, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSubscriptionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index ca9daa0bb7fa..e7777d04a842 100644 --- a/composer.json +++ b/composer.json @@ -73,6 +73,7 @@ "google/access-context-manager": "0.5.2", "google/analytics-admin": "0.22.2", "google/analytics-data": "0.16.2", + "google/apps-events-subscriptions": "0.0.0", "google/apps-meet": "0.2.0", "google/cloud-access-approval": "1.2.2", "google/cloud-advisorynotifications": "0.7.2", @@ -255,6 +256,7 @@ "GPBMetadata\\Google\\Api\\Servicemanagement\\": "ServiceManagement/metadata", "GPBMetadata\\Google\\Api\\Serviceusage\\": "ServiceUsage/metadata", "GPBMetadata\\Google\\Appengine\\": "AppEngineAdmin/metadata", + "GPBMetadata\\Google\\Apps\\Events\\Subscriptions\\": "AppsEventsSubscriptions/metadata", "GPBMetadata\\Google\\Apps\\Meet\\": "AppsMeet/metadata", "GPBMetadata\\Google\\Apps\\Script\\Type\\": "GSuiteAddOns/external/metadata", "GPBMetadata\\Google\\Bigtable\\": "Bigtable/metadata", @@ -426,6 +428,7 @@ "Google\\Analytics\\Admin\\": "AnalyticsAdmin/src", "Google\\Analytics\\Data\\": "AnalyticsData/src", "Google\\ApiCore\\LongRunning\\": "LongRunning/src/ApiCore/LongRunning", + "Google\\Apps\\Events\\Subscriptions\\": "AppsEventsSubscriptions/src", "Google\\Apps\\Meet\\": "AppsMeet/src", "Google\\Apps\\Script\\Type\\": "GSuiteAddOns/external/protos", "Google\\Cloud\\": [