0.31.0 (latest) 0.30.0 0.29.0 0.28.0 0.27.0 0.23.0 0.20.0 0.19.0 0.18.0 0.17.1 0.16.1 0.15.0 0.14.0 0.13.1 0.12.1 0.11.2 0.10.0 0.9.0 0.8.1 0.7.2 0.6.1 0.5.0 0.4.0 0.3.0 0.2.0 0.1.4 Reference documentation and code samples for the Google Apps Chat V1 Client class 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.

Generated from protobuf message `google.chat.v1.Space`

## Namespace

Google \\ Apps \\ Chat \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ 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`. |
| `↳ type` | `int` Output only. Deprecated: Use `space_type` instead. The type of a space. |
| `↳ space_type` | `int` Optional. The type of space. Required when creating a space or updating the space type of a space. Output only for other usage. |
| `↳ single_user_bot_dm` | `bool` Optional. Whether the space is a DM between a Chat app and a single human. |
| `↳ threaded` | `bool` Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages are threaded in this space. |
| `↳ display_name` | `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. |
| `↳ external_user_allowed` | `bool` 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. |
| `↳ space_threading_state` | `int` Output only. The threading state in the Chat space. |
| `↳ space_details` | `Space\SpaceDetails` Optional. Details about the space including description and rules. |
| `↳ space_history_state` | `int` Optional. The message history state for messages and threads in this space. |
| `↳ import_mode` | `bool` 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). |
| `↳ create_time` | `Google\Protobuf\Timestamp` 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`. |
| `↳ last_active_time` | `Google\Protobuf\Timestamp` Output only. Timestamp of the last message in the space. |
| `↳ admin_installed` | `bool` 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. |
| `↳ membership_count` | `Space\MembershipCount` Output only. The count of joined memberships grouped by member type. Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or `GROUP_CHAT`. |
| `↳ access_settings` | `Space\AccessSettings` Optional. Specifies the [access setting](https://support.google.com/chat/answer/11971020) of the space. Only populated when the `space_type` is `SPACE`. |
| `↳ customer` | `string` Optional. Immutable. The customer id of the domain of the space. Required only when creating a space with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and `SpaceType` is `SPACE`, otherwise should not be set. In the format `customers/{customer}`, where `customer` is the `id` from the [Admin SDK customer resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers). Private apps can also use the `customers/my_customer` alias to create the space in the same Google Workspace organization as the app. This field isn't populated for direct messages (DMs) or when the space is created by non-Google Workspace users. |
| `↳ space_uri` | `string` Output only. The URI for a user to access the space. |
| `↳ predefined_permission_settings` | `int` 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. Setting predefined permission settings supports: - [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` or `chat.app.spaces.create` scopes. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) |
| `↳ permission_settings` | `Space\PermissionSettings` 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. Reading and updating permission settings supports: - [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. Only populated and settable when the Chat app created the space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) |
| `↳ import_mode_expire_time` | `Google\Protobuf\Timestamp` Output only. The time when the space will be automatically deleted by the system if it remains in import mode. Each space created in import mode must exit this mode before this expire time using `spaces.completeImport`. This field is only populated for spaces that were created with import mode. |

### getName

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`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

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`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getType

Output only. Deprecated: Use `space_type` instead.

The type of a space.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [Type](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.Type.md.txt). |

### setType

Output only. Deprecated: Use `space_type` instead.

The type of a space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [Type](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.Type.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpaceType

Optional. The type of space. Required when creating a space or updating the
space type of a space. Output only for other usage.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SpaceType](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.SpaceType.md.txt). |

### setSpaceType

Optional. The type of space. Required when creating a space or updating the
space type of a space. Output only for other usage.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [SpaceType](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.SpaceType.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSingleUserBotDm

Optional. Whether the space is a DM between a Chat app and a single
human.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setSingleUserBotDm

Optional. Whether the space is a DM between a Chat app and a single
human.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getThreaded

Output only. Deprecated: Use `spaceThreadingState` instead.

Whether messages are threaded in this space.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setThreaded

Output only. Deprecated: Use `spaceThreadingState` instead.

Whether messages are threaded in this space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayName

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDisplayName

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExternalUserAllowed

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setExternalUserAllowed

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpaceThreadingState

Output only. The threading state in the Chat space.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SpaceThreadingState](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.SpaceThreadingState.md.txt). |

### setSpaceThreadingState

Output only. The threading state in the Chat space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [SpaceThreadingState](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.SpaceThreadingState.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpaceDetails

Optional. Details about the space including description and rules.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Space\SpaceDetails|null` |   |

### hasSpaceDetails

### clearSpaceDetails

### setSpaceDetails

Optional. Details about the space including description and rules.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Space\SpaceDetails` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpaceHistoryState

Optional. The message history state for messages and threads in this space.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [HistoryState](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.HistoryState.md.txt). |

### setSpaceHistoryState

Optional. The message history state for messages and threads in this space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [HistoryState](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.HistoryState.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getImportMode

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).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setImportMode

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).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

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`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

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`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLastActiveTime

Output only. Timestamp of the last message in the space.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasLastActiveTime

### clearLastActiveTime

### setLastActiveTime

Output only. Timestamp of the last message in the space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAdminInstalled

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setAdminInstalled

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMembershipCount

Output only. The count of joined memberships grouped by member type.

Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or
`GROUP_CHAT`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Space\MembershipCount|null` |   |

### hasMembershipCount

### clearMembershipCount

### setMembershipCount

Output only. The count of joined memberships grouped by member type.

Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or
`GROUP_CHAT`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Space\MembershipCount` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAccessSettings

Optional. Specifies the [access
setting](https://support.google.com/chat/answer/11971020) of the space.

Only populated when the `space_type` is `SPACE`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Space\AccessSettings|null` |   |

### hasAccessSettings

### clearAccessSettings

### setAccessSettings

Optional. Specifies the [access
setting](https://support.google.com/chat/answer/11971020) of the space.

Only populated when the `space_type` is `SPACE`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Space\AccessSettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCustomer

Optional. Immutable. The customer id of the domain of the space.

Required only when creating a space with [app
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
and `SpaceType` is `SPACE`, otherwise should not be set.
In the format `customers/{customer}`, where `customer` is the `id` from the
[Admin SDK customer
resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers).
Private apps can also use the `customers/my_customer` alias to create
the space in the same Google Workspace organization as the app.
This field isn't populated for direct messages (DMs) or when the space is
created by non-Google Workspace users.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasCustomer

### clearCustomer

### setCustomer

Optional. Immutable. The customer id of the domain of the space.

Required only when creating a space with [app
authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
and `SpaceType` is `SPACE`, otherwise should not be set.
In the format `customers/{customer}`, where `customer` is the `id` from the
[Admin SDK customer
resource](https://developers.google.com/admin-sdk/directory/reference/rest/v1/customers).
Private apps can also use the `customers/my_customer` alias to create
the space in the same Google Workspace organization as the app.
This field isn't populated for direct messages (DMs) or when the space is
created by non-Google Workspace users.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpaceUri

Output only. The URI for a user to access the space.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSpaceUri

Output only. The URI for a user to access the space.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPredefinedPermissionSettings

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.

Setting predefined permission settings supports:

- [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` or `chat.app.spaces.create` scopes.
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [PredefinedPermissionSettings](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.PredefinedPermissionSettings.md.txt). |

### hasPredefinedPermissionSettings

### setPredefinedPermissionSettings

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.

Setting predefined permission settings supports:

- [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` or `chat.app.spaces.create` scopes.
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [PredefinedPermissionSettings](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.Space.PredefinedPermissionSettings.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPermissionSettings

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.

Reading and updating permission settings supports:

- [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. Only populated and settable when the Chat app created the space.
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Space\PermissionSettings|null` |   |

### hasPermissionSettings

### setPermissionSettings

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.

Reading and updating permission settings supports:

- [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. Only populated and settable when the Chat app created the space.
- [User
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Space\PermissionSettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getImportModeExpireTime

Output only. The time when the space will be automatically deleted by the
system if it remains in import mode.

Each space created in import mode must exit this mode before this expire
time using `spaces.completeImport`.
This field is only populated for spaces that were created with import mode.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasImportModeExpireTime

### clearImportModeExpireTime

### setImportModeExpireTime

Output only. The time when the space will be automatically deleted by the
system if it remains in import mode.

Each space created in import mode must exit this mode before this expire
time using `spaces.completeImport`.
This field is only populated for spaces that were created with import mode.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSpacePermissionSettings

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |