create method

Future<ModmailConversation> create(
  1. String subject,
  2. String body,
  3. dynamic recipient, {
  4. dynamic authorHidden = false,
})

Create a new conversation.

subject: The message subject. body: The markdown formatted body of the message. recipient: The recipient of the conversation. Can be either a String or a RedditorRef. authorHidden: When true, the author is hidden from non-moderators. This is the same as replying as a subreddit.

Returns a ModmailConversation for the newly created conversation.

Implementation

Future<ModmailConversation> create(
    String subject, String body, /* String, RedditorRef */ recipient,
    {authorHidden = false}) async {
  final data = <String, String>{
    'body': body,
    'isAuthorHidden': authorHidden.toString(),
    'srName': _subreddit.displayName,
    'subject': subject,
    'to': _redditorNameHelper(recipient),
  };
  return ModmailConversation.parse(
      _subreddit.reddit,
      (await _subreddit.reddit.post(apiPath['modmail_conversations'], data,
          objectify: false)) as Map<String, dynamic>);
}