Skip to content

Commit

Permalink
bumped to version 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhil-merito committed Jun 11, 2023
1 parent 9bcc893 commit abe3ac2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ body:
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/nixrajput/flutter_carousel_widget/CODE_OF_CONDUCT.md).
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/nixrajput/cloudinary-dart/CODE_OF_CONDUCT.md).
options:
- label: I agree to follow this project's Code of Conduct
required: true
Expand Down
18 changes: 12 additions & 6 deletions lib/src/api_client/cloudinary_api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ class CloudinaryApiClient extends CloudinaryApi {
params['file'] = fileBytes != null
? MultipartFile.fromBytes(
fileBytes,
filename: fileName ?? DateTime.now().millisecondsSinceEpoch.toString(),
filename:
fileName ?? DateTime.now().millisecondsSinceEpoch.toString(),
)
: (file!.startsWith('http://') || file.startsWith('https://'))
? file
: await MultipartFile.fromFile(file, filename: fileName);
params['timestamp'] = timeStamp;
params['signature'] = getSignature(secret: apiSecret, timeStamp: timeStamp, params: params);
params['signature'] =
getSignature(secret: apiSecret, timeStamp: timeStamp, params: params);

var formData = FormData.fromMap(params);

Expand Down Expand Up @@ -154,7 +156,8 @@ class CloudinaryApiClient extends CloudinaryApi {

final params = <String, dynamic>{
'upload_preset': uploadPreset,
if (publicId != null || fileName != null) 'public_id': publicId ?? fileName,
if (publicId != null || fileName != null)
'public_id': publicId ?? fileName,
if (folder != null) 'folder': folder,

/// Setting the optParams... this would override the public_id and folder
Expand All @@ -164,7 +167,8 @@ class CloudinaryApiClient extends CloudinaryApi {

params['file'] = fileBytes != null
? MultipartFile.fromBytes(fileBytes,
filename: fileName ?? DateTime.now().millisecondsSinceEpoch.toString())
filename:
fileName ?? DateTime.now().millisecondsSinceEpoch.toString())
: (file!.startsWith('http://') || file.startsWith('https://'))
? file
: await MultipartFile.fromFile(file, filename: fileName);
Expand Down Expand Up @@ -223,15 +227,17 @@ class CloudinaryApiClient extends CloudinaryApi {
params['public_id'] = publicId;
params['api_key'] = apiKey;
params['timestamp'] = timeStamp;
params['signature'] = getSignature(secret: apiSecret, timeStamp: timeStamp, params: params);
params['signature'] =
getSignature(secret: apiSecret, timeStamp: timeStamp, params: params);

var formData = FormData.fromMap(params);

Response<dynamic> response;
CloudinaryResponse cloudinaryResponse;
int? statusCode;
try {
response = await post('$cloudName/${resourceType.name}/destroy', data: formData);
response =
await post('$cloudName/${resourceType.name}/destroy', data: formData);
statusCode = response.statusCode;
cloudinaryResponse = CloudinaryResponse.fromJsonMap(response.data);
} catch (error, stacktrace) {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/cloudinary_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class Cloudinary {
Cloudinary._(cloudName: cloudName);

String get apiKey => _client.apiKey;

String get apiSecret => _client.apiSecret;

String get cloudName => _client.cloudName;

/// Uploads a file of [resourceType] with [fileName] to a [folder]
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cloudinary
description: A dart package to integrate Cloudinary API in Dart and Flutter.

version: 1.1.2
version: 1.1.3

homepage: https://github.com/nixrajput
repository: https://github.com/nixrajput/cloudinary-dart
Expand Down

0 comments on commit abe3ac2

Please sign in to comment.