post method

void post(
  1. String content,
  2. String? inReplyTo
)

Implementation

void post(String content, String? inReplyTo) async {
  Map<String, dynamic> body = {
    "to": ["as:Public"],
    "type": "Create",
    "object": {
      "to": ["as:Public"],
      "type": "Note",
      "content": content,
      "published": DateTime.now().toUtc().toIso8601String(),
    }
  };

  if (inReplyTo != null) {
    body["object"]["inReplyTo"] = inReplyTo;
  }

  String json = jsonEncode(body);

  await AuthBaseApi.post(
    url:
        Uri.parse("https://${Config.domainName}/outbox/${Config.ownActorId}"),
    headers: <String, String>{
      "content-type": "application/json",
    },
    body: json,
  );
}