createTextNoteForUser function

Future<Map<String, dynamic>> createTextNoteForUser(
  1. String apiBase,
  2. String baseUrl,
  3. String apiToken,
  4. String visibility,
  5. bool localOnly,
  6. String reactionAcceptance,
  7. bool noExtractMentions,
  8. bool noExtractHashtags,
  9. bool noExtractEmojis,
  10. String note,
)

Attempts to create a text note on the supplied instance. The visibility can be set to "public", "home", "followers" or "direct". The "reactionAcceptance" parameter allows you to set which reactions can be sent. For the other parameters, when in doubt, please read the API documentation here: https://misskey.io/api-doc If the operation succeeds, a success map is returned. If the operation fails, an error map is returned.

Implementation

Future<Map<String,dynamic>> createTextNoteForUser(
  String apiBase,
  String baseUrl,
  String apiToken,
  String visibility,
  bool localOnly,
  String reactionAcceptance,
  bool noExtractMentions,
  bool noExtractHashtags,
  bool noExtractEmojis,
  String note
) async {
  String reqUrl = '$baseUrl$apiBase/notes/create';
  Map<String,dynamic> headers = new Map();
  headers['Content-Type'] = 'application/json';
  Map<String,dynamic> payload = new Map();
  payload['visibility'] = visibility;
  payload['localOnly'] = localOnly;
  payload['reactionAcceptance'] = reactionAcceptance;
  payload['noExtractMentions'] = noExtractMentions;
  payload['noExtractHashtags'] = noExtractHashtags;
  payload['noExtractEmojis'] = noExtractEmojis;
  payload['text'] = note;
  payload['i'] = apiToken;
  Map<String,dynamic> postRequest = await fetchJSON(
    'POST',
    headers,
    payload,
    reqUrl
  );
  return postRequest;
}