uploadAttachment method

Future<Attachment> uploadAttachment(
  1. String file, {
  2. String? description,
  3. Object? focus,
})
inherited

POST /api/v2/media

  • authenticated (requires user)
  • write write:media

Implementation

Future<Attachment> uploadAttachment(String file,
    {String? description, Object? focus}) async {
  final response = await request(
    Method.post,
    "/api/v2/media",
    authenticated: true,
    payload: {
      "description": description,
      "focus": focus,
    },
    files: {
      "file": file,
    },
  );

  return Attachment.fromJson(json.decode(response.body));
}