Skip to content

Commit bbe4abc

Browse files
feat: [AppsChat] Addition of app auth support for chat api (#8479)
* feat: Addition of app auth support for chat api docs: Update reference documentation for createSpace,updateSpace,deleteSpace,createMembership,updateMembership,deleteMembership and the newly added field -customer- in space.proto PiperOrigin-RevId: 788882030 Source-Link: googleapis/googleapis@f6801ce Source-Link: googleapis/googleapis-gen@34024b5 Copy-Tag: eyJwIjoiQXBwc0NoYXQvLk93bEJvdC55YW1sIiwiaCI6IjM0MDI0YjU5NGMzNzE0ZWQ2YTQxMTgwNTAwN2ZjNGQ2MjQ0ZWE2MzIifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent d6b162b commit bbe4abc

47 files changed

Lines changed: 893 additions & 166 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
204 Bytes
Binary file not shown.
44 Bytes
Binary file not shown.

AppsChat/metadata/Chat/V1/User.php

-81 Bytes
Binary file not shown.

AppsChat/samples/V1/ChatServiceClient/complete_import_space.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@
3333
* [import process](https://developers.google.com/workspace/chat/import-data)
3434
* for the specified space and makes it visible to users.
3535
*
36-
* Requires [app
37-
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
38-
* and domain-wide delegation. For more information, see [Authorize Google
36+
* Requires [user
37+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
38+
* and domain-wide delegation with the [authorization
39+
* scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
40+
*
41+
* - `https://www.googleapis.com/auth/chat.import`
42+
*
43+
* For more information, see [Authorize Google
3944
* Chat apps to import
4045
* data](https://developers.google.com/workspace/chat/authorize-import).
4146
*

AppsChat/samples/V1/ChatServiceClient/create_custom_emoji.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
* permissions](https://support.google.com/a/answer/12850085).
4040
*
4141
* Requires [user
42-
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
42+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
43+
* with the [authorization
44+
* scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
45+
*
46+
* - `https://www.googleapis.com/auth/chat.customemojis`
4347
*
4448
* This sample has been automatically generated and should be regarded as a code
4549
* template only. It will require modifications to work:

AppsChat/samples/V1/ChatServiceClient/create_membership.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,35 @@
4242
* - [App
4343
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
4444
* with [administrator approval](https://support.google.com/a?p=chat-app-auth)
45-
* in [Developer Preview](https://developers.google.com/workspace/preview)
45+
* and the authorization scope:
46+
* - `https://www.googleapis.com/auth/chat.app.memberships`
4647
*
4748
* - [User
4849
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
49-
* You can authenticate and authorize this method with administrator
50-
* privileges by setting the `use_admin_access` field in the request.
50+
* with one of the following authorization scopes:
51+
* - `https://www.googleapis.com/auth/chat.memberships`
52+
* - `https://www.googleapis.com/auth/chat.memberships.app` (to add the
53+
* calling app to the space)
54+
* - `https://www.googleapis.com/auth/chat.import` (import mode spaces
55+
* only)
56+
* - User authentication grants administrator privileges when an
57+
* administrator account authenticates, `use_admin_access` is `true`, and
58+
* the following authorization scope is used:
59+
* - `https://www.googleapis.com/auth/chat.admin.memberships`
60+
*
61+
* App authentication is not supported for the following use cases:
62+
*
63+
* - Inviting users external to the Workspace organization that owns the
64+
* space.
65+
* - Adding a Google Group to a space.
66+
* - Adding a Chat app to a space.
5167
*
5268
* For example usage, see:
5369
*
5470
* - [Invite or add a user to a
5571
* space](https://developers.google.com/workspace/chat/create-members#create-user-membership).
56-
*
5772
* - [Invite or add a Google Group to a
5873
* space](https://developers.google.com/workspace/chat/create-members#create-group-membership).
59-
*
6074
* - [Add the Chat app to a
6175
* space](https://developers.google.com/workspace/chat/create-members#create-membership-calling-api).
6276
*

AppsChat/samples/V1/ChatServiceClient/create_message.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,21 @@
3232
* Creates a message in a Google Chat space. For an example, see [Send a
3333
* message](https://developers.google.com/workspace/chat/create-messages).
3434
*
35-
* The `create()` method requires either [user
35+
* Supports the following types of
36+
* [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):
37+
*
38+
* - [App
39+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
40+
* with the authorization scope:
41+
* - `https://www.googleapis.com/auth/chat.bot`
42+
* - [User
3643
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
37-
* or [app
38-
* authentication](https://developers.google.com/workspace/chat/authorize-import).
44+
* with one of the following authorization scopes:
45+
* - `https://www.googleapis.com/auth/chat.messages.create`
46+
* - `https://www.googleapis.com/auth/chat.messages`
47+
* - `https://www.googleapis.com/auth/chat.import` (import mode spaces
48+
* only)
49+
*
3950
* Chat attributes the message sender differently depending on the type of
4051
* authentication that you use in your request.
4152
*

AppsChat/samples/V1/ChatServiceClient/create_reaction.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@
3535
* message](https://developers.google.com/workspace/chat/create-reactions).
3636
*
3737
* Requires [user
38-
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
38+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
39+
* with one of the following [authorization
40+
* scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
41+
*
42+
* - `https://www.googleapis.com/auth/chat.messages.reactions.create`
43+
* - `https://www.googleapis.com/auth/chat.messages.reactions`
44+
* - `https://www.googleapis.com/auth/chat.messages`
45+
* - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)
3946
*
4047
* @param string $formattedParent The message where the reaction is created.
4148
*

AppsChat/samples/V1/ChatServiceClient/create_space.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,49 @@
2929
use Google\Apps\Chat\V1\Space;
3030

3131
/**
32-
* Creates a space with no members. Can be used to create a named space, or a
32+
* Creates a space. Can be used to create a named space, or a
3333
* group chat in `Import mode`. For an example, see [Create a
3434
* space](https://developers.google.com/workspace/chat/create-spaces).
3535
*
36-
* If you receive the error message `ALREADY_EXISTS` when creating
37-
* a space, try a different `displayName`. An existing space within
38-
* the Google Workspace organization might already use this display name.
39-
*
4036
* Supports the following types of
4137
* [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):
4238
*
4339
* - [App
4440
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
4541
* with [administrator approval](https://support.google.com/a?p=chat-app-auth)
46-
* in [Developer Preview](https://developers.google.com/workspace/preview)
42+
* and one of the following authorization scopes:
43+
* - `https://www.googleapis.com/auth/chat.app.spaces.create`
44+
* - `https://www.googleapis.com/auth/chat.app.spaces`
4745
*
4846
* - [User
4947
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
48+
* with one of the following authorization scopes:
49+
* - `https://www.googleapis.com/auth/chat.spaces.create`
50+
* - `https://www.googleapis.com/auth/chat.spaces`
51+
* - `https://www.googleapis.com/auth/chat.import` (import mode spaces
52+
* only)
5053
*
5154
* When authenticating as an app, the `space.customer` field must be set in
5255
* the request.
5356
*
57+
* When authenticating as an app, the Chat app is added as a member of the
58+
* space. However, unlike human authentication, the Chat app is not added as a
59+
* space manager. By default, the Chat app can be removed from the space by
60+
* all space members. To allow only space managers to remove the app from a
61+
* space, set `space.permission_settings.manage_apps` to `managers_allowed`.
62+
*
63+
* Space membership upon creation depends on whether the space is created in
64+
* `Import mode`:
65+
*
66+
* * **Import mode:** No members are created.
67+
* * **All other modes:** The calling user is added as a member. This is:
68+
* * The app itself when using app authentication.
69+
* * The human user when using user authentication.
70+
*
71+
* If you receive the error message `ALREADY_EXISTS` when creating
72+
* a space, try a different `displayName`. An existing space within
73+
* the Google Workspace organization might already use this display name.
74+
*
5475
* This sample has been automatically generated and should be regarded as a code
5576
* template only. It will require modifications to work:
5677
* - It may require correct/in-range values for request initialization.

AppsChat/samples/V1/ChatServiceClient/delete_custom_emoji.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
* permissions](https://support.google.com/a/answer/12850085).
4343
*
4444
* Requires [user
45-
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
45+
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
46+
* with the [authorization
47+
* scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
48+
*
49+
* - `https://www.googleapis.com/auth/chat.customemojis`
4650
*
4751
* @param string $formattedName Resource name of the custom emoji to delete.
4852
*

0 commit comments

Comments
 (0)