send method

Future<Message> send(
  1. SendMessageRequest request,
  2. String parent, {
  3. String? $fields,
})

Send a message to specified target (a registration token, topic or condition).

request - The metadata request object.

Request parameters:

parent - Required. It contains the Firebase project id (i.e. the unique identifier for your Firebase project), in the format of projects/{project_id}. For legacy support, the numeric project number with no padding is also supported in the format of projects/{project_number}. Value must have pattern ^projects/\[^/\]+$.

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

Completes with a Message.

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<Message> send(
  SendMessageRequest 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') + '/messages:send';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return Message.fromJson(_response as core.Map<core.String, core.dynamic>);
}