Google Chat API . spaces

Instance Methods

members()

Returns the members Resource.

messages()

Returns the messages Resource.

spaceEvents()

Returns the spaceEvents Resource.

close()

Close httplib2 connections.

completeImport(name, body=None, x__xgafv=None)

Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and domain-wide delegation. For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).

create(body=None, requestId=None, x__xgafv=None)

Creates a space with no members. Can be used to create a named space, or a group chat in `Import mode`. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces). If you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) When authenticating as an app, the `space.customer` field must be set in the request.

delete(name, useAdminAccess=None, x__xgafv=None)

Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) You can authenticate and authorize this method with administrator privileges by setting the `use_admin_access` field in the request.

findDirectMessage(name=None, x__xgafv=None)

Returns the existing direct message with the specified user. If no direct message space is found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app. With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user. // Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)

get(name, useAdminAccess=None, x__xgafv=None)

Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) You can authenticate and authorize this method with administrator privileges by setting the `use_admin_access` field in the request.

list(filter=None, pageSize=None, pageToken=None, x__xgafv=None)

Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) To list all named spaces by Google Workspace organization, use the [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.

list_next()

Retrieves the next page of results.

patch(name, body=None, updateMask=None, useAdminAccess=None, x__xgafv=None)

Updates a space. For an example, see [Update a space](https://developers.google.com/workspace/chat/update-spaces). If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, try a different display name.. An existing space within the Google Workspace organization might already use this display name. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) You can authenticate and authorize this method with administrator privileges by setting the `use_admin_access` field in the request.

search(orderBy=None, pageSize=None, pageToken=None, query=None, useAdminAccess=None, x__xgafv=None)

Returns a list of spaces in a Google Workspace organization based on an administrator's search. Requires [user authentication with administrator privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). In the request, set `use_admin_access` to `true`.

search_next()

Retrieves the next page of results.

setup(body=None, x__xgafv=None)

Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see [Set up a space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). To specify the human members to add, add memberships with the appropriate `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user@example.com` or `users/123456789`. To specify the Google groups to add, add memberships with the appropriate `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud Identity Groups lookup API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID `123456789` for group email `group@example.com`, then you can add the group to the space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not supported, and Google groups can only be added as members in named spaces. For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn't have permission to add some members, then those members aren't added to the created space. To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created. To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to `true` and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](https://developers.google.com/workspace/chat/create-members). If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned. Spaces with threaded replies aren't supported. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

Method Details

close()
Close httplib2 connections.
completeImport(name, body=None, x__xgafv=None)
Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and domain-wide delegation. For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).

Args:
  name: string, Required. Resource name of the import mode space. Format: `spaces/{space}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for completing the import process for a space.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for completing the import process for a space.
  "space": { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app. # The import mode space.
    "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
      "accessState": "A String", # Output only. Indicates the access state of the space.
      "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
    },
    "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
    "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
    "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
    "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
    "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
    "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
    "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
      "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
      "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
    },
    "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
    "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
      "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
    },
    "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
    "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
    "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
      "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
      "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
    },
    "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
    "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
    "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
    "spaceUri": "A String", # Output only. The URI for a user to access the space.
    "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
    "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
  },
}
create(body=None, requestId=None, x__xgafv=None)
Creates a space with no members. Can be used to create a named space, or a group chat in `Import mode`. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces). If you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) When authenticating as an app, the `space.customer` field must be set in the request.

Args:
  body: object, The request body.
    The object takes the form of:

{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}

  requestId: string, Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}
delete(name, useAdminAccess=None, x__xgafv=None)
Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) You can authenticate and authorize this method with administrator privileges by setting the `use_admin_access` field in the request.

Args:
  name: string, Required. Resource name of the space to delete. Format: `spaces/{space}` (required)
  useAdminAccess: boolean, Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.delete` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
}
findDirectMessage(name=None, x__xgafv=None)
Returns the existing direct message with the specified user. If no direct message space is found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message). With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app. With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user. // Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)

Args:
  name: string, Required. Resource name of the user to find direct message with. Format: `users/{user}`, where `{user}` is either the `id` for the [person](https://developers.google.com/people/api/rest/v1/people) from the People API, or the `id` for the [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Directory API. For example, if the People API profile ID is `123456789`, you can find a direct message with that person by using `users/123456789` as the `name`. When [authenticated as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), you can use the email as an alias for `{user}`. For example, `users/example@gmail.com` where `example@gmail.com` is the email of the Google Chat user.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}
get(name, useAdminAccess=None, x__xgafv=None)
Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) You can authenticate and authorize this method with administrator privileges by setting the `use_admin_access` field in the request.

Args:
  name: string, Required. Resource name of the space, in the form `spaces/{space}`. Format: `spaces/{space}` (required)
  useAdminAccess: boolean, Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.spaces` or `chat.admin.spaces.readonly` [OAuth 2.0 scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}
list(filter=None, pageSize=None, pageToken=None, x__xgafv=None)
Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) To list all named spaces by Google Workspace organization, use the [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.

Args:
  filter: string, Optional. A query filter. You can filter spaces by the space type ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). To filter by space type, you must specify valid enum value, such as `SPACE` or `GROUP_CHAT` (the `space_type` can't be `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` operator. For example, the following queries are valid: ``` space_type = "SPACE" spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" ``` Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error.
  pageSize: integer, Optional. The maximum number of spaces to return. The service might return fewer than this value. If unspecified, at most 100 spaces are returned. The maximum value is 1000. If you use a value more than 1000, it's automatically changed to 1000. Negative values return an `INVALID_ARGUMENT` error.
  pageToken: string, Optional. A page token, received from a previous list spaces call. Provide this parameter to retrieve the subsequent page. When paginating, the filter value should match the call that provided the page token. Passing a different value may lead to unexpected results.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response for a list spaces request.
  "nextPageToken": "A String", # You can send a token as `pageToken` to retrieve the next page of results. If empty, there are no subsequent pages.
  "spaces": [ # List of spaces in the requested (or first) page. Note: The `permissionSettings` field is not returned in the Space object for list requests.
    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
      "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
        "accessState": "A String", # Output only. Indicates the access state of the space.
        "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
      },
      "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
      "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
      "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
      "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
      "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
      "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
      "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
        "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
        "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
      },
      "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
      "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
        "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
      },
      "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
      "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
      "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
        "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
        "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
      },
      "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
      "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
      "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
      "spaceUri": "A String", # Output only. The URI for a user to access the space.
      "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
      "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
    },
  ],
}
list_next()
Retrieves the next page of results.

        Args:
          previous_request: The request for the previous page. (required)
          previous_response: The response from the request for the previous page. (required)

        Returns:
          A request object that you can call 'execute()' on to request the next
          page. Returns None if there are no more items in the collection.
        
patch(name, body=None, updateMask=None, useAdminAccess=None, x__xgafv=None)
Updates a space. For an example, see [Update a space](https://developers.google.com/workspace/chat/update-spaces). If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, try a different display name.. An existing space within the Google Workspace organization might already use this display name. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) You can authenticate and authorize this method with administrator privileges by setting the `use_admin_access` field in the request.

Args:
  name: string, Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`. (required)
  body: object, The request body.
    The object takes the form of:

{ # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}

  updateMask: string, Required. The updated field paths, comma separated if there are multiple. You can update the following fields for a space: `space_details`: Updates the space's description. Supports up to 150 characters. `display_name`: Only supports updating the display name for spaces where `spaceType` field is `SPACE`. If you receive the error message `ALREADY_EXISTS`, try a different value. An existing space within the Google Workspace organization might already use this display name. `space_type`: Only supports changing a `GROUP_CHAT` space type to `SPACE`. Include `display_name` together with `space_type` in the update mask and ensure that the specified space has a non-empty display name and the `SPACE` space type. Including the `space_type` mask and the `SPACE` type in the specified space when updating the display name is optional if the existing space already has the `SPACE` type. Trying to update the space type in other ways results in an invalid argument error. `space_type` is not supported with `useAdminAccess`. `space_history_state`: Updates [space history settings](https://support.google.com/chat/answer/7664687) by turning history on or off for the space. Only supported if history settings are enabled for the Google Workspace organization. To update the space history state, you must omit all other field masks in your request. `space_history_state` is not supported with `useAdminAccess`. `access_settings.audience`: Updates the [access setting](https://support.google.com/chat/answer/11971020) of who can discover the space, join the space, and preview the messages in named space where `spaceType` field is `SPACE`. If the existing space has a target audience, you can remove the audience and restrict space access by omitting a value for this field mask. To update access settings for a space, the authenticating user must be a space manager and omit all other field masks in your request. You can't update this field if the space is in [import mode](https://developers.google.com/workspace/chat/import-data-overview). To learn more, see [Make a space discoverable to specific users](https://developers.google.com/workspace/chat/space-target-audience). `access_settings.audience` is not supported with `useAdminAccess`. `permission_settings`: Supports changing the [permission settings](https://support.google.com/chat/answer/13340792) of a space. When updating permission settings, you can only specify `permissionSettings` field masks; you cannot update other field masks at the same time. `permissionSettings` is not supported with `useAdminAccess`. The supported field masks include: - `permission_settings.manageMembersAndGroups` - `permission_settings.modifySpaceDetails` - `permission_settings.toggleHistory` - `permission_settings.useAtMentionAll` - `permission_settings.manageApps` - `permission_settings.manageWebhooks` - `permission_settings.replyMessages`
  useAdminAccess: boolean, Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.spaces` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). Some `FieldMask` values are not supported using admin access. For details, see the description of `update_mask`.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}
search(orderBy=None, pageSize=None, pageToken=None, query=None, useAdminAccess=None, x__xgafv=None)
Returns a list of spaces in a Google Workspace organization based on an administrator's search. Requires [user authentication with administrator privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). In the request, set `use_admin_access` to `true`.

Args:
  orderBy: string, Optional. How the list of spaces is ordered. Supported attributes to order by are: - `membership_count.joined_direct_human_user_count` — Denotes the count of human users that have directly joined a space. - `last_active_time` — Denotes the time when last eligible item is added to any topic of this space. - `create_time` — Denotes the time of the space creation. Valid ordering operation values are: - `ASC` for ascending. Default value. - `DESC` for descending. The supported syntax are: - `membership_count.joined_direct_human_user_count DESC` - `membership_count.joined_direct_human_user_count ASC` - `last_active_time DESC` - `last_active_time ASC` - `create_time DESC` - `create_time ASC`
  pageSize: integer, The maximum number of spaces to return. The service may return fewer than this value. If unspecified, at most 100 spaces are returned. The maximum value is 1000. If you use a value more than 1000, it's automatically changed to 1000.
  pageToken: string, A token, received from the previous search spaces call. Provide this parameter to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results.
  query: string, Required. A search query. You can search by using the following parameters: - `create_time` - `customer` - `display_name` - `external_user_allowed` - `last_active_time` - `space_history_state` - `space_type` `create_time` and `last_active_time` accept a timestamp in [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported comparison operators are: `=`, `<`, `>`, `<=`, `>=`. `customer` is required and is used to indicate which customer to fetch spaces from. `customers/my_customer` is the only supported value. `display_name` only accepts the `HAS` (`:`) operator. The text to match is first tokenized into tokens and each token is prefix-matched case-insensitively and independently as a substring anywhere in the space's `display_name`. For example, `Fun Eve` matches `Fun event` or `The evening was fun`, but not `notFun event` or `even`. `external_user_allowed` accepts either `true` or `false`. `space_history_state` only accepts values from the [`historyState`] (https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.HistoryState) field of a `space` resource. `space_type` is required and the only valid value is `SPACE`. Across different fields, only `AND` operators are supported. A valid example is `space_type = "SPACE" AND display_name:"Hello"` and an invalid example is `space_type = "SPACE" OR display_name:"Hello"`. Among the same field, `space_type` doesn't support `AND` or `OR` operators. `display_name`, 'space_history_state', and 'external_user_allowed' only support `OR` operators. `last_active_time` and `create_time` support both `AND` and `OR` operators. `AND` can only be used to represent an interval, such as `last_active_time < "2022-01-01T00:00:00+00:00" AND last_active_time > "2023-01-01T00:00:00+00:00"`. The following example queries are valid: ``` customer = "customers/my_customer" AND space_type = "SPACE" customer = "customers/my_customer" AND space_type = "SPACE" AND display_name:"Hello World" customer = "customers/my_customer" AND space_type = "SPACE" AND (last_active_time < "2020-01-01T00:00:00+00:00" OR last_active_time > "2022-01-01T00:00:00+00:00") customer = "customers/my_customer" AND space_type = "SPACE" AND (display_name:"Hello World" OR display_name:"Fun event") AND (last_active_time > "2020-01-01T00:00:00+00:00" AND last_active_time < "2022-01-01T00:00:00+00:00") customer = "customers/my_customer" AND space_type = "SPACE" AND (create_time > "2019-01-01T00:00:00+00:00" AND create_time < "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF") ```
  useAdminAccess: boolean, When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). This method currently only supports admin access, thus only `true` is accepted for this field.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response with a list of spaces corresponding to the search spaces request.
  "nextPageToken": "A String", # A token that can be used to retrieve the next page. If this field is empty, there are no subsequent pages.
  "spaces": [ # A page of the requested spaces.
    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
      "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
        "accessState": "A String", # Output only. Indicates the access state of the space.
        "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
      },
      "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
      "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
      "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
      "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
      "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
      "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
      "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
        "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
        "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
      },
      "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
      "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
        "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
        "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
          "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
          "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
        },
      },
      "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
      "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
      "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
        "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
        "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
      },
      "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
      "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
      "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
      "spaceUri": "A String", # Output only. The URI for a user to access the space.
      "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
      "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
    },
  ],
  "totalSize": 42, # The total number of spaces that match the query, across all pages. If the result is over 10,000 spaces, this value is an estimate.
}
search_next()
Retrieves the next page of results.

        Args:
          previous_request: The request for the previous page. (required)
          previous_response: The response from the request for the previous page. (required)

        Returns:
          A request object that you can call 'execute()' on to request the next
          page. Returns None if there are no more items in the collection.
        
setup(body=None, x__xgafv=None)
Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see [Set up a space with initial members](https://developers.google.com/workspace/chat/set-up-spaces). To specify the human members to add, add memberships with the appropriate `membership.member.name`. To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user@example.com` or `users/123456789`. To specify the Google groups to add, add memberships with the appropriate `membership.group_member.name`. To add or invite a Google group, use `groups/{group}`, where `{group}` is the `id` for the group from the Cloud Identity Groups API. For example, you can use [Cloud Identity Groups lookup API](https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID `123456789` for group email `group@example.com`, then you can add the group to the space by setting the `membership.group_member.name` to `groups/123456789`. Group email is not supported, and Google groups can only be added as members in named spaces. For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn't have permission to add some members, then those members aren't added to the created space. To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created. To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to `true` and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](https://developers.google.com/workspace/chat/create-members). If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned. Spaces with threaded replies aren't supported. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

Args:
  body: object, The request body.
    The object takes the form of:

{ # Request to create a space and add specified users to it.
  "memberships": [ # Optional. The Google Chat users or groups to invite to join the space. Omit the calling user, as they are added automatically. The set currently allows up to 20 memberships (in addition to the caller). For human membership, the `Membership.member` field must contain a `user` with `name` populated (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only add human users when setting up a space (adding Chat apps is only supported for direct message setup with the calling app). You can also add members using the user's email as an alias for {user}. For example, the `user.name` can be `users/example@gmail.com`. To invite Gmail users or users from external Google Workspace domains, user's email must be used for `{user}`. For Google group membership, the `Membership.group_member` field must contain a `group` with `name` populated (format `groups/{group}`). You can only add Google groups when setting `Space.spaceType` to `SPACE`. Optional when setting `Space.spaceType` to `SPACE`. Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at least two memberships. Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human user, along with exactly one membership. Must be empty when creating a 1:1 conversation between a human and the calling Chat app (when setting `Space.spaceType` to `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`).
    { # Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
      "createTime": "A String", # Optional. Immutable. The creation time of the membership, such as when a member joined or was invited to join a space. This field is output only, except when used to import historical memberships in import mode spaces.
      "deleteTime": "A String", # Optional. Immutable. The deletion time of the membership, such as when a member left or was removed from a space. This field is output only, except when used to import historical memberships in import mode spaces.
      "groupMember": { # A Google Group in Google Chat. # Optional. The Google Group the membership corresponds to. Reading or mutating memberships for Google Groups requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
        "name": "A String", # Resource name for a Google Group. Represents a [group](https://cloud.google.com/identity/docs/reference/rest/v1/groups) in Cloud Identity Groups API. Format: groups/{group}
      },
      "member": { # A user in Google Chat. When returned as an output from a request, if your Chat app [authenticates as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), the output for a `User` resource only populates the user's `name` and `type`. # Optional. The Google Chat user or app the membership corresponds to. If your Chat app [authenticates as a user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), the output populates the [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) `name` and `type`.
        "displayName": "A String", # Output only. The user's display name.
        "domainId": "A String", # Unique identifier of the user's Google Workspace domain.
        "isAnonymous": True or False, # Output only. When `true`, the user is deleted or their profile is not visible.
        "name": "A String", # Resource name for a Google Chat user. Format: `users/{user}`. `users/app` can be used as an alias for the calling app bot user. For human users, `{user}` is the same user identifier as: - the `id` for the [Person](https://developers.google.com/people/api/rest/v1/people) in the People API. For example, `users/123456789` in Chat API represents the same person as the `123456789` Person profile ID in People API. - the `id` for a [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users) in the Admin SDK Directory API. - the user's email address can be used as an alias for `{user}` in API requests. For example, if the People API Person profile ID for `user@example.com` is `123456789`, you can use `users/user@example.com` as an alias to reference `users/123456789`. Only the canonical resource name (for example `users/123456789`) will be returned from the API.
        "type": "A String", # User type.
      },
      "name": "A String", # Identifier. Resource name of the membership, assigned by the server. Format: `spaces/{space}/members/{member}`
      "role": "A String", # Optional. User's role within a Chat space, which determines their permitted actions in the space. This field can only be used as input in `UpdateMembership`.
      "state": "A String", # Output only. State of the membership.
    },
  ],
  "requestId": "A String", # Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error.
  "space": { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app. # Required. The `Space.spaceType` field is required. To create a space, set `Space.spaceType` to `SPACE` and set `Space.displayName`. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. To create a group chat, set `Space.spaceType` to `GROUP_CHAT`. Don't set `Space.displayName`. To create a 1:1 conversation between humans, set `Space.spaceType` to `DIRECT_MESSAGE` and set `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or `Space.spaceDetails`. To create an 1:1 conversation between a human and the calling Chat app, set `Space.spaceType` to `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or `Space.spaceDetails`. If a `DIRECT_MESSAGE` space already exists, that space is returned instead of creating a new space.
    "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
      "accessState": "A String", # Output only. Indicates the access state of the space.
      "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
    },
    "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
    "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
    "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
    "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
    "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
    "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
    "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
      "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
      "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
    },
    "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
    "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
      "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
      "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
        "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
        "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
      },
    },
    "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
    "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
    "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
      "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
      "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
    },
    "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
    "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
    "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
    "spaceUri": "A String", # Output only. The URI for a user to access the space.
    "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
    "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
  },
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
  "accessSettings": { # Represents the [access setting](https://support.google.com/chat/answer/11971020) of the space. # Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`.
    "accessState": "A String", # Output only. Indicates the access state of the space.
    "audience": "A String", # Optional. The resource name of the [target audience](https://support.google.com/a/answer/9934697) who can discover the space, join the space, and preview the messages in the space. If unset, only users or Google Groups who have been individually invited or added to the space can access it. For details, see [Make a space discoverable to a target audience](https://developers.google.com/workspace/chat/space-target-audience). Format: `audiences/{audience}` To use the default target audience for the Google Workspace organization, set to `audiences/default`. Reading the target audience supports: - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the `chat.app.spaces` scope in [Developer Preview](https://developers.google.com/workspace/preview). This field is not populated when using the `chat.bot` scope with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app). Setting the target audience requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  },
  "adminInstalled": True or False, # Output only. For direct message (DM) spaces with a Chat app, whether the space was created by a Google Workspace administrator. Administrators can install and set up a direct message with a Chat app on behalf of users in their organization. To support admin install, your Chat app must feature direct messaging.
  "createTime": "A String", # Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except when used in import mode spaces. For import mode spaces, set this field to the historical timestamp at which the space was created in the source in order to preserve the original creation time. Only populated in the output when `spaceType` is `GROUP_CHAT` or `SPACE`.
  "displayName": "A String", # Optional. The space's display name. Required when [creating a space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/create) with a `spaceType` of `SPACE`. If you receive the error message `ALREADY_EXISTS` when creating a space or updating the `displayName`, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name. For direct messages, this field might be empty. Supports up to 128 characters.
  "externalUserAllowed": True or False, # Optional. Immutable. Whether this space permits any Google Chat user as a member. Input when creating a space in a Google Workspace organization. Omit this field when creating spaces in the following conditions: * The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer account permits any Google Chat user. For existing spaces, this field is output only.
  "importMode": True or False, # Optional. Whether this space is created in `Import Mode` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. Creating a space in `Import Mode`requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
  "lastActiveTime": "A String", # Output only. Timestamp of the last message in the space.
  "membershipCount": { # Represents the count of memberships of a space, grouped into categories. # Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`.
    "joinedDirectHumanUserCount": 42, # Output only. Count of human users that have directly joined the space, not counting users joined by having membership in a joined group.
    "joinedGroupCount": 42, # Output only. Count of all groups that have directly joined the space.
  },
  "name": "A String", # Identifier. Resource name of the space. Format: `spaces/{space}` Where `{space}` represents the system-assigned ID for the space. You can obtain the space ID by calling the [`spaces.list()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/list) method or from the space URL. For example, if the space URL is `https://mail.google.com/mail/u/0/#chat/space/AAAAAAAAA`, the space ID is `AAAAAAAAA`.
  "permissionSettings": { # [Permission settings](https://support.google.com/chat/answer/13340792) that you can specify when updating an existing named space. To set permission settings when creating a space, specify the `PredefinedPermissionSettings` field in your request. # Optional. Space permission settings for existing spaces. Input for updating exact space permission settings, where existing permission settings are replaced. Output lists current permission settings.
    "manageApps": { # Represents a space permission setting. # Optional. Setting for managing apps in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageMembersAndGroups": { # Represents a space permission setting. # Optional. Setting for managing members and groups in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "manageWebhooks": { # Represents a space permission setting. # Optional. Setting for managing webhooks in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "modifySpaceDetails": { # Represents a space permission setting. # Optional. Setting for updating space name, avatar, description and guidelines.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "postMessages": { # Represents a space permission setting. # Output only. Setting for posting messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "replyMessages": { # Represents a space permission setting. # Optional. Setting for replying to messages in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "toggleHistory": { # Represents a space permission setting. # Optional. Setting for toggling space history on and off.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
    "useAtMentionAll": { # Represents a space permission setting. # Optional. Setting for using @all in a space.
      "managersAllowed": True or False, # Optional. Whether spaces managers have this permission.
      "membersAllowed": True or False, # Optional. Whether non-manager members have this permission.
    },
  },
  "predefinedPermissionSettings": "A String", # Optional. Input only. Predefined space permission settings, input only when creating a space. If the field is not set, a collaboration space is created. After you create the space, settings are populated in the `PermissionSettings` field.
  "singleUserBotDm": True or False, # Optional. Whether the space is a DM between a Chat app and a single human.
  "spaceDetails": { # Details about the space including description and rules. # Optional. Details about the space including description and rules.
    "description": "A String", # Optional. A description of the space. For example, describe the space's discussion topic, functional purpose, or participants. Supports up to 150 characters.
    "guidelines": "A String", # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 characters.
  },
  "spaceHistoryState": "A String", # Optional. The message history state for messages and threads in this space.
  "spaceThreadingState": "A String", # Output only. The threading state in the Chat space.
  "spaceType": "A String", # Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage.
  "spaceUri": "A String", # Output only. The URI for a user to access the space.
  "threaded": True or False, # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space.
  "type": "A String", # Output only. Deprecated: Use `space_type` instead. The type of a space.
}