# Interface CreateMembershipRequestOrBuilder (0.57.0)

0.57.0 (latest) 0.55.0 0.52.0 0.51.0 0.49.0 0.47.0 0.46.0 0.45.0 0.44.0 0.42.0 0.40.0 0.39.0 0.38.0 0.37.0 0.36.0 0.34.0 0.32.0 0.31.0 0.28.0 0.27.0 0.26.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.0 0.16.0 0.15.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.4.0 0.3.0 0.1.0

    public interface CreateMembershipRequestOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### getMembership()

    public abstract Membership getMembership()

Required. The membership relation to create.

The `memberType` field must contain a user with the `user.name` and
`user.type` fields populated. The server will assign a resource name
and overwrite anything specified.

When a Chat app creates a membership relation for a human user, it must use
certain authorization scopes and set specific values for certain fields:

- When [authenticating as a
  user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
  the `chat.memberships` authorization scope is required.

- When [authenticating as an
  app](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app),
  the `chat.app.memberships` authorization scope is required.

- Set `user.type` to `HUMAN`, and set `user.name` with format
  `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` of
  the [person](https://developers.google.com/people/api/rest/v1/people) 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`.

  Inviting users external to the Workspace organization that owns the space
  requires [user
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

  When a Chat app creates a membership relation for itself, it must
  [authenticate as a
  user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
  and use the `chat.memberships.app` scope, set `user.type` to `BOT`, and set
  `user.name` to `users/app`.

`.google.chat.v1.Membership membership = 2 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.Membership` | The membership. |

### getMembershipOrBuilder()

    public abstract MembershipOrBuilder getMembershipOrBuilder()

Required. The membership relation to create.

The `memberType` field must contain a user with the `user.name` and
`user.type` fields populated. The server will assign a resource name
and overwrite anything specified.

When a Chat app creates a membership relation for a human user, it must use
certain authorization scopes and set specific values for certain fields:

- When [authenticating as a
  user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
  the `chat.memberships` authorization scope is required.

- When [authenticating as an
  app](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app),
  the `chat.app.memberships` authorization scope is required.

- Set `user.type` to `HUMAN`, and set `user.name` with format
  `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` of
  the [person](https://developers.google.com/people/api/rest/v1/people) 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`.

  Inviting users external to the Workspace organization that owns the space
  requires [user
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

  When a Chat app creates a membership relation for itself, it must
  [authenticate as a
  user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
  and use the `chat.memberships.app` scope, set `user.type` to `BOT`, and set
  `user.name` to `users/app`.

`.google.chat.v1.Membership membership = 2 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-chat/latest/com.google.chat.v1.MembershipOrBuilder` |   |

### getParent()

    public abstract String getParent()

Required. The resource name of the space for which to create the
membership.

Format: spaces/{space}

`
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The parent. |

### getParentBytes()

    public abstract ByteString getParentBytes()

Required. The resource name of the space for which to create the
membership.

Format: spaces/{space}

`
string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for parent. |

### getUseAdminAccess()

    public abstract boolean getUseAdminAccess()

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.memberships` [OAuth 2.0
scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).

Creating app memberships or creating memberships for users outside the
administrator's Google Workspace organization isn't supported using admin
access.

`bool use_admin_access = 5 [(.google.api.field_behavior) = OPTIONAL];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The useAdminAccess. |

### hasMembership()

    public abstract boolean hasMembership()

Required. The membership relation to create.

The `memberType` field must contain a user with the `user.name` and
`user.type` fields populated. The server will assign a resource name
and overwrite anything specified.

When a Chat app creates a membership relation for a human user, it must use
certain authorization scopes and set specific values for certain fields:

- When [authenticating as a
  user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
  the `chat.memberships` authorization scope is required.

- When [authenticating as an
  app](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app),
  the `chat.app.memberships` authorization scope is required.

- Set `user.type` to `HUMAN`, and set `user.name` with format
  `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` of
  the [person](https://developers.google.com/people/api/rest/v1/people) 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`.

  Inviting users external to the Workspace organization that owns the space
  requires [user
  authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).

  When a Chat app creates a membership relation for itself, it must
  [authenticate as a
  user](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
  and use the `chat.memberships.app` scope, set `user.type` to `BOT`, and set
  `user.name` to `users/app`.

`.google.chat.v1.Membership membership = 2 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the membership field is set. |