create method

Future<Reaction> create(
  1. Reaction request,
  2. String parent, {
  3. String? $fields,
})

Creates a reaction and adds it to a message.

Only unicode emojis are supported. For an example, see Add a reaction to a message. Requires user authentication.

request - The metadata request object.

Request parameters:

parent - Required. The message where the reaction is created. Format: spaces/{space}/messages/{message} Value must have pattern ^spaces/\[^/\]+/messages/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Reaction.

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<Reaction> create(
  Reaction request,
  core.String parent, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/reactions';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return Reaction.fromJson(response_ as core.Map<core.String, core.dynamic>);
}