uploadMedia method
Uploads a media file
to the API.
Returns the uploaded media object if the API call is successful.
Implementation
Future<Media> uploadMedia(File file) async {
var response = await callApi(endpoint: 'media', method: 'post', file: file);
if (response.statusCode == 200) {
final responseData = json.decode(response.body);
final media = Media.fromJson(responseData);
return media;
} else {
throw Exception(response);
}
}