create method
Creates a named space.
Spaces grouped by topics aren't supported. For an example, see
Create a space.
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. Requires
user authentication.
request
- The metadata request object.
Request parameters:
requestId
- 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.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Space.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Space> create(
Space request, {
core.String? requestId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (requestId != null) 'requestId': [requestId],
if ($fields != null) 'fields': [$fields],
};
const url_ = 'v1/spaces';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Space.fromJson(response_ as core.Map<core.String, core.dynamic>);
}