delete method

Future<void> delete(
  1. PictrsUploadFile pictrsFile
)

Implementation

Future<void> delete(PictrsUploadFile pictrsFile) async {
  final res = await http.get(
    Uri.https(
      host,
      '$extraPath/delete/${pictrsFile.deleteToken}/${pictrsFile.file}',
    ),
  );

  if (!res.ok) {
    switch (res.statusCode) {
      case 403:
        throw const LemmyApiException('pictrs_wrong_delete_token');
      case 404:
        throw const LemmyApiException('pictrs_not_found');
      default:
        throw const LemmyApiException('pictrs_unknown_error');
    }
  }
}