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

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.

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

## 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 membership, assigned by the server. Format: `spaces/{space}/members/{member}` |
| `↳ state` | `int` Output only. State of the membership. |
| `↳ role` | `int` 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`. |
| `↳ member` | `User` 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 only populates the [user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User) `name` and `type` fields for both internal and external users, unless they are members of the space or have a prior affinity, like a direct message (DM) conversation, with the calling user. |
| `↳ group_member` | `Group` 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). |
| `↳ create_time` | `Google\Protobuf\Timestamp` 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. |
| `↳ delete_time` | `Google\Protobuf\Timestamp` 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. |
| `↳ affiliation` | `int` Output only. A user's relationship to the Workspace organization that owns the space. In spaces owned by consumer accounts, the affiliation of all members is `EXTERNAL`. |

### getName

Identifier. Resource name of the membership, assigned by the server.

Format: `spaces/{space}/members/{member}`

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

### setName

Identifier. Resource name of the membership, assigned by the server.

Format: `spaces/{space}/members/{member}`

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

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

### getState

Output only. State of the membership.

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

### setState

Output only. State of the membership.

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

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

### getRole

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

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

### setRole

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

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

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

### getMember

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 only populates the
[user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
`name` and `type` fields for both internal and external users, unless
they are members of the space or have a prior affinity, like a direct
message (DM) conversation, with the calling user.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `User|null` |   |

### hasMember

### setMember

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 only populates the
[user](https://developers.google.com/workspace/chat/api/reference/rest/v1/User)
`name` and `type` fields for both internal and external users, unless
they are members of the space or have a prior affinity, like a direct
message (DM) conversation, with the calling user.

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

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

### getGroupMember

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Group|null` |   |

### hasGroupMember

### setGroupMember

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

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

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

### getCreateTime

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.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

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.

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

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

### getDeleteTime

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.

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

### hasDeleteTime

### clearDeleteTime

### setDeleteTime

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.

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

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

### getAffiliation

Output only. A user's relationship to the Workspace organization that owns
the space. In spaces owned by consumer accounts, the affiliation of all
members is `EXTERNAL`.

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

### setAffiliation

Output only. A user's relationship to the Workspace organization that owns
the space. In spaces owned by consumer accounts, the affiliation of all
members is `EXTERNAL`.

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

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

### getMemberType

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