Class SpacesServiceClient (0.45.0)

Service Description: REST API for services dealing with spaces.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
Spacespace=Space.newBuilder().build();
Spaceresponse=spacesServiceClient.createSpace(space);
}

Note: close() needs to be called on the SpacesServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

CreateSpace

Creates a space.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createSpace(CreateSpaceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createSpace(Space space)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createSpaceCallable()

GetSpace

Gets details about a meeting space.

For an example, see Get a meeting space.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getSpace(GetSpaceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getSpace(SpaceName name)

  • getSpace(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getSpaceCallable()

UpdateSpace

Updates details about a meeting space.

For an example, see Update a meeting space.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateSpace(UpdateSpaceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateSpace(Space space, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateSpaceCallable()

EndActiveConference

Ends an active conference (if there's one).

For an example, see End active conference.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • endActiveConference(EndActiveConferenceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • endActiveConference(SpaceName name)

  • endActiveConference(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • endActiveConferenceCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of SpacesServiceSettings to create(). For example:

To customize credentials:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SpacesServiceSettingsspacesServiceSettings=
SpacesServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SpacesServiceClientspacesServiceClient=SpacesServiceClient.create(spacesServiceSettings);

To customize the endpoint:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SpacesServiceSettingsspacesServiceSettings=
SpacesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
SpacesServiceClientspacesServiceClient=SpacesServiceClient.create(spacesServiceSettings);

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SpacesServiceSettingsspacesServiceSettings=
SpacesServiceSettings.newHttpJsonBuilder().build();
SpacesServiceClientspacesServiceClient=SpacesServiceClient.create(spacesServiceSettings);

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > SpacesServiceClient

Static Methods

create()

publicstaticfinalSpacesServiceClientcreate()

Constructs an instance of SpacesServiceClient with default settings.

Returns
Type Description
SpacesServiceClient
Exceptions
Type Description
IOException

create(SpacesServiceSettings settings)

publicstaticfinalSpacesServiceClientcreate(SpacesServiceSettingssettings)

Constructs an instance of SpacesServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings SpacesServiceSettings
Returns
Type Description
SpacesServiceClient
Exceptions
Type Description
IOException

create(SpacesServiceStub stub)

publicstaticfinalSpacesServiceClientcreate(SpacesServiceStubstub)

Constructs an instance of SpacesServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SpacesServiceSettings).

Parameter
Name Description
stub SpacesServiceStub
Returns
Type Description
SpacesServiceClient

Constructors

SpacesServiceClient(SpacesServiceSettings settings)

protectedSpacesServiceClient(SpacesServiceSettingssettings)

Constructs an instance of SpacesServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings SpacesServiceSettings

SpacesServiceClient(SpacesServiceStub stub)

protectedSpacesServiceClient(SpacesServiceStubstub)
Parameter
Name Description
stub SpacesServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

publicbooleanawaitTermination(longduration,TimeUnitunit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

publicfinalvoidclose()

createSpace(CreateSpaceRequest request)

publicfinalSpacecreateSpace(CreateSpaceRequestrequest)

Creates a space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
CreateSpaceRequestrequest=
CreateSpaceRequest.newBuilder().setSpace(Space.newBuilder().build()).build();
Spaceresponse=spacesServiceClient.createSpace(request);
}
Parameter
Name Description
request CreateSpaceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Space

createSpace(Space space)

publicfinalSpacecreateSpace(Spacespace)

Creates a space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
Spacespace=Space.newBuilder().build();
Spaceresponse=spacesServiceClient.createSpace(space);
}
Parameter
Name Description
space Space

Space to be created. As of May 2023, the input space can be empty. Later on the input space can be non-empty when space configuration is introduced.

Returns
Type Description
Space

createSpaceCallable()

publicfinalUnaryCallable<CreateSpaceRequest,Space>createSpaceCallable()

Creates a space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
CreateSpaceRequestrequest=
CreateSpaceRequest.newBuilder().setSpace(Space.newBuilder().build()).build();
ApiFuture<Space>future=spacesServiceClient.createSpaceCallable().futureCall(request);
// Do something.
Spaceresponse=future.get();
}
Returns
Type Description
UnaryCallable<CreateSpaceRequest,Space>

endActiveConference(EndActiveConferenceRequest request)

publicfinalvoidendActiveConference(EndActiveConferenceRequestrequest)

Ends an active conference (if there's one).

For an example, see End active conference.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
EndActiveConferenceRequestrequest=
EndActiveConferenceRequest.newBuilder()
.setName(SpaceName.of("[SPACE]").toString())
.build();
spacesServiceClient.endActiveConference(request);
}
Parameter
Name Description
request EndActiveConferenceRequest

The request object containing all of the parameters for the API call.

endActiveConference(SpaceName name)

publicfinalvoidendActiveConference(SpaceNamename)

Ends an active conference (if there's one).

For an example, see End active conference.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
SpaceNamename=SpaceName.of("[SPACE]");
spacesServiceClient.endActiveConference(name);
}
Parameter
Name Description
name SpaceName

Required. Resource name of the space.

Format: spaces/{space}.

{space} is the resource identifier for the space. It's a unique, server-generated ID and is case sensitive. For example, jQCFfuBOdN5z.

For more information, see How Meet identifies a meeting space.

endActiveConference(String name)

publicfinalvoidendActiveConference(Stringname)

Ends an active conference (if there's one).

For an example, see End active conference.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
Stringname=SpaceName.of("[SPACE]").toString();
spacesServiceClient.endActiveConference(name);
}
Parameter
Name Description
name String

Required. Resource name of the space.

Format: spaces/{space}.

{space} is the resource identifier for the space. It's a unique, server-generated ID and is case sensitive. For example, jQCFfuBOdN5z.

For more information, see How Meet identifies a meeting space.

endActiveConferenceCallable()

publicfinalUnaryCallable<EndActiveConferenceRequest,Empty>endActiveConferenceCallable()

Ends an active conference (if there's one).

For an example, see End active conference.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
EndActiveConferenceRequestrequest=
EndActiveConferenceRequest.newBuilder()
.setName(SpaceName.of("[SPACE]").toString())
.build();
ApiFuture<Empty>future=
spacesServiceClient.endActiveConferenceCallable().futureCall(request);
// Do something.
future.get();
}
Returns
Type Description
UnaryCallable<EndActiveConferenceRequest,Empty>

getSettings()

publicfinalSpacesServiceSettingsgetSettings()
Returns
Type Description
SpacesServiceSettings

getSpace(GetSpaceRequest request)

publicfinalSpacegetSpace(GetSpaceRequestrequest)

Gets details about a meeting space.

For an example, see Get a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
GetSpaceRequestrequest=
GetSpaceRequest.newBuilder().setName(SpaceName.of("[SPACE]").toString()).build();
Spaceresponse=spacesServiceClient.getSpace(request);
}
Parameter
Name Description
request GetSpaceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Space

getSpace(SpaceName name)

publicfinalSpacegetSpace(SpaceNamename)

Gets details about a meeting space.

For an example, see Get a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
SpaceNamename=SpaceName.of("[SPACE]");
Spaceresponse=spacesServiceClient.getSpace(name);
}
Parameter
Name Description
name SpaceName

Required. Resource name of the space.

Format: spaces/{space} or spaces/{meetingCode}.

{space} is the resource identifier for the space. It's a unique, server-generated ID and is case sensitive. For example, jQCFfuBOdN5z.

{meetingCode} is an alias for the space. It's a typeable, unique character string and is non-case sensitive. For example, abc-mnop-xyz. The maximum length is 128 characters.

A meetingCode shouldn't be stored long term as it can become dissociated from a meeting space and can be reused for different meeting spaces in the future. Generally, a meetingCode expires 365 days after last use. For more information, see Learn about meeting codes in Google Meet.

For more information, see How Meet identifies a meeting space.

Returns
Type Description
Space

getSpace(String name)

publicfinalSpacegetSpace(Stringname)

Gets details about a meeting space.

For an example, see Get a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
Stringname=SpaceName.of("[SPACE]").toString();
Spaceresponse=spacesServiceClient.getSpace(name);
}
Parameter
Name Description
name String

Required. Resource name of the space.

Format: spaces/{space} or spaces/{meetingCode}.

{space} is the resource identifier for the space. It's a unique, server-generated ID and is case sensitive. For example, jQCFfuBOdN5z.

{meetingCode} is an alias for the space. It's a typeable, unique character string and is non-case sensitive. For example, abc-mnop-xyz. The maximum length is 128 characters.

A meetingCode shouldn't be stored long term as it can become dissociated from a meeting space and can be reused for different meeting spaces in the future. Generally, a meetingCode expires 365 days after last use. For more information, see Learn about meeting codes in Google Meet.

For more information, see How Meet identifies a meeting space.

Returns
Type Description
Space

getSpaceCallable()

publicfinalUnaryCallable<GetSpaceRequest,Space>getSpaceCallable()

Gets details about a meeting space.

For an example, see Get a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
GetSpaceRequestrequest=
GetSpaceRequest.newBuilder().setName(SpaceName.of("[SPACE]").toString()).build();
ApiFuture<Space>future=spacesServiceClient.getSpaceCallable().futureCall(request);
// Do something.
Spaceresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetSpaceRequest,Space>

getStub()

publicSpacesServiceStubgetStub()
Returns
Type Description
SpacesServiceStub

isShutdown()

publicbooleanisShutdown()
Returns
Type Description
boolean

isTerminated()

publicbooleanisTerminated()
Returns
Type Description
boolean

shutdown()

publicvoidshutdown()

shutdownNow()

publicvoidshutdownNow()

updateSpace(Space space, FieldMask updateMask)

publicfinalSpaceupdateSpace(Spacespace,FieldMaskupdateMask)

Updates details about a meeting space.

For an example, see Update a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
Spacespace=Space.newBuilder().build();
FieldMaskupdateMask=FieldMask.newBuilder().build();
Spaceresponse=spacesServiceClient.updateSpace(space,updateMask);
}
Parameters
Name Description
space Space

Required. Space to be updated.

updateMask FieldMask

Optional. Field mask used to specify the fields to be updated in the space. If update_mask isn't provided(not set, set with empty paths, or only has "" as paths), it defaults to update all fields provided with values in the request. Using "*" as update_mask will update all fields, including deleting fields not set in the request.

Returns
Type Description
Space

updateSpace(UpdateSpaceRequest request)

publicfinalSpaceupdateSpace(UpdateSpaceRequestrequest)

Updates details about a meeting space.

For an example, see Update a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
UpdateSpaceRequestrequest=
UpdateSpaceRequest.newBuilder()
.setSpace(Space.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Spaceresponse=spacesServiceClient.updateSpace(request);
}
Parameter
Name Description
request UpdateSpaceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Space

updateSpaceCallable()

publicfinalUnaryCallable<UpdateSpaceRequest,Space>updateSpaceCallable()

Updates details about a meeting space.

For an example, see Update a meeting space.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(SpacesServiceClientspacesServiceClient=SpacesServiceClient.create()){
UpdateSpaceRequestrequest=
UpdateSpaceRequest.newBuilder()
.setSpace(Space.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Space>future=spacesServiceClient.updateSpaceCallable().futureCall(request);
// Do something.
Spaceresponse=future.get();
}
Returns
Type Description
UnaryCallable<UpdateSpaceRequest,Space>

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.