createThumbnail method

  1. @override
Future<bool> createThumbnail(
  1. String sourceFileId,
  2. String sourceFileName,
  3. String sourceFileType,
  4. String sourceBucketId,
)
override

Implementation

@override
Future<bool> createThumbnail(String sourceFileId, String sourceFileName, String sourceFileType,
    String sourceBucketId) async {
  try {
    http.Client client = http.Client();
    if (client is BrowserClient) {
      client.withCredentials = true;
    }

    var response = await client.post(Uri.parse("${myConfig!.config.apiServerUrl}/createThumbnail"),
        headers: {"Content-type": "application/json"},
        body: jsonEncode({
          "bucketId": sourceBucketId,
          "folderName": sourceFileId.replaceAll("/", "%2F"),
          "fileName": sourceFileName,
          "fileType": sourceFileType,
          "cloudType": "firebase"
        }));

    if (response.statusCode == 200) return true;
  } catch (error) {
    logger.info(error);
  }
  return false;
}