insert method

Future<Groups> insert (
  1. String groupId,
  2. {String $fields,
  3. UploadOptions uploadOptions: commons.UploadOptions.Default,
  4. Media uploadMedia}
)

Inserts a new mail into the archive of the Google group.

Request parameters:

groupId - The group ID

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

uploadMedia - The media to upload.

uploadOptions - Options for the media upload. Streaming Media without the length being known ahead of time is only supported via resumable uploads.

Completes with a Groups.

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<Groups> insert(core.String groupId,
    {core.String $fields,
    commons.UploadOptions uploadOptions = commons.UploadOptions.Default,
    commons.Media uploadMedia}) {
  var _url;
  var _queryParams = new core.Map<core.String, core.List<core.String>>();
  var _uploadMedia;
  var _uploadOptions;
  var _downloadOptions = commons.DownloadOptions.Metadata;
  var _body;

  if (groupId == null) {
    throw new core.ArgumentError("Parameter groupId is required.");
  }
  if ($fields != null) {
    _queryParams["fields"] = [$fields];
  }

  _uploadMedia = uploadMedia;
  _uploadOptions = uploadOptions;

  if (_uploadMedia == null) {
    _url = commons.Escaper.ecapeVariable('$groupId') + '/archive';
  } else if (_uploadOptions is commons.ResumableUploadOptions) {
    _url = '/resumable/upload/groups/v1/groups/' +
        commons.Escaper.ecapeVariable('$groupId') +
        '/archive';
  } else {
    _url = '/upload/groups/v1/groups/' +
        commons.Escaper.ecapeVariable('$groupId') +
        '/archive';
  }

  var _response = _requester.request(_url, "POST",
      body: _body,
      queryParams: _queryParams,
      uploadOptions: _uploadOptions,
      uploadMedia: _uploadMedia,
      downloadOptions: _downloadOptions);
  return _response.then((data) => new Groups.fromJson(data));
}