Skip to content

Commit

Permalink
fix: fixed for the issue (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
myConsciousness committed Feb 19, 2023
1 parent 0149fcc commit f2669d8
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 35 deletions.
6 changes: 3 additions & 3 deletions lib/src/core/service_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ServiceHelper implements Service {
),
files: files,
body: Map<String, String>.from(
_removeNullValues(body),
_removeNullValues(body) ?? {},
),
);

Expand All @@ -209,7 +209,7 @@ class ServiceHelper implements Service {
),
files: files,
body: Map<String, String>.from(
_removeNullValues(body),
_removeNullValues(body) ?? {},
),
);

Expand Down Expand Up @@ -282,7 +282,7 @@ class ServiceHelper implements Service {
),
files: files,
body: Map<String, String>.from(
_removeNullValues(body),
_removeNullValues(body) ?? {},
),
);

Expand Down
5 changes: 4 additions & 1 deletion lib/src/service/base_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ abstract class BaseService implements _Service {
}

if (HttpStatus.tooManyRequests.equalsByCode(response.statusCode)) {
throw RateLimitExceededException('Rate limit exceeded.', response);
throw RateLimitExceededException(
'Rate limit exceeded.',
response,
);
}

if (400 <= response.statusCode && response.statusCode < 500) {
Expand Down
7 changes: 5 additions & 2 deletions lib/src/service/entities/media_variants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ class MediaVariants with _$MediaVariants {
const factory MediaVariants({
required int width,
required int height,
required String size,
required double aspect,
String? size,
double? aspect,
String? frameRate,
double? duration,
int? bitrate,
}) = _MediaVariants;

factory MediaVariants.fromJson(Map<String, Object?> json) =>
Expand Down
125 changes: 98 additions & 27 deletions lib/src/service/entities/media_variants.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ MediaVariants _$MediaVariantsFromJson(Map<String, dynamic> json) {
mixin _$MediaVariants {
int get width => throw _privateConstructorUsedError;
int get height => throw _privateConstructorUsedError;
String get size => throw _privateConstructorUsedError;
double get aspect => throw _privateConstructorUsedError;
String? get size => throw _privateConstructorUsedError;
double? get aspect => throw _privateConstructorUsedError;
String? get frameRate => throw _privateConstructorUsedError;
double? get duration => throw _privateConstructorUsedError;
int? get bitrate => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
Expand All @@ -37,7 +40,14 @@ abstract class $MediaVariantsCopyWith<$Res> {
MediaVariants value, $Res Function(MediaVariants) then) =
_$MediaVariantsCopyWithImpl<$Res, MediaVariants>;
@useResult
$Res call({int width, int height, String size, double aspect});
$Res call(
{int width,
int height,
String? size,
double? aspect,
String? frameRate,
double? duration,
int? bitrate});
}

/// @nodoc
Expand All @@ -55,8 +65,11 @@ class _$MediaVariantsCopyWithImpl<$Res, $Val extends MediaVariants>
$Res call({
Object? width = null,
Object? height = null,
Object? size = null,
Object? aspect = null,
Object? size = freezed,
Object? aspect = freezed,
Object? frameRate = freezed,
Object? duration = freezed,
Object? bitrate = freezed,
}) {
return _then(_value.copyWith(
width: null == width
Expand All @@ -67,14 +80,26 @@ class _$MediaVariantsCopyWithImpl<$Res, $Val extends MediaVariants>
? _value.height
: height // ignore: cast_nullable_to_non_nullable
as int,
size: null == size
size: freezed == size
? _value.size
: size // ignore: cast_nullable_to_non_nullable
as String,
aspect: null == aspect
as String?,
aspect: freezed == aspect
? _value.aspect
: aspect // ignore: cast_nullable_to_non_nullable
as double,
as double?,
frameRate: freezed == frameRate
? _value.frameRate
: frameRate // ignore: cast_nullable_to_non_nullable
as String?,
duration: freezed == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as double?,
bitrate: freezed == bitrate
? _value.bitrate
: bitrate // ignore: cast_nullable_to_non_nullable
as int?,
) as $Val);
}
}
Expand All @@ -87,7 +112,14 @@ abstract class _$$_MediaVariantsCopyWith<$Res>
__$$_MediaVariantsCopyWithImpl<$Res>;
@override
@useResult
$Res call({int width, int height, String size, double aspect});
$Res call(
{int width,
int height,
String? size,
double? aspect,
String? frameRate,
double? duration,
int? bitrate});
}

/// @nodoc
Expand All @@ -103,8 +135,11 @@ class __$$_MediaVariantsCopyWithImpl<$Res>
$Res call({
Object? width = null,
Object? height = null,
Object? size = null,
Object? aspect = null,
Object? size = freezed,
Object? aspect = freezed,
Object? frameRate = freezed,
Object? duration = freezed,
Object? bitrate = freezed,
}) {
return _then(_$_MediaVariants(
width: null == width
Expand All @@ -115,14 +150,26 @@ class __$$_MediaVariantsCopyWithImpl<$Res>
? _value.height
: height // ignore: cast_nullable_to_non_nullable
as int,
size: null == size
size: freezed == size
? _value.size
: size // ignore: cast_nullable_to_non_nullable
as String,
aspect: null == aspect
as String?,
aspect: freezed == aspect
? _value.aspect
: aspect // ignore: cast_nullable_to_non_nullable
as double,
as double?,
frameRate: freezed == frameRate
? _value.frameRate
: frameRate // ignore: cast_nullable_to_non_nullable
as String?,
duration: freezed == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as double?,
bitrate: freezed == bitrate
? _value.bitrate
: bitrate // ignore: cast_nullable_to_non_nullable
as int?,
));
}
}
Expand All @@ -133,8 +180,11 @@ class _$_MediaVariants implements _MediaVariants {
const _$_MediaVariants(
{required this.width,
required this.height,
required this.size,
required this.aspect});
this.size,
this.aspect,
this.frameRate,
this.duration,
this.bitrate});

factory _$_MediaVariants.fromJson(Map<String, dynamic> json) =>
_$$_MediaVariantsFromJson(json);
Expand All @@ -144,13 +194,19 @@ class _$_MediaVariants implements _MediaVariants {
@override
final int height;
@override
final String size;
final String? size;
@override
final double aspect;
final double? aspect;
@override
final String? frameRate;
@override
final double? duration;
@override
final int? bitrate;

@override
String toString() {
return 'MediaVariants(width: $width, height: $height, size: $size, aspect: $aspect)';
return 'MediaVariants(width: $width, height: $height, size: $size, aspect: $aspect, frameRate: $frameRate, duration: $duration, bitrate: $bitrate)';
}

@override
Expand All @@ -161,12 +217,18 @@ class _$_MediaVariants implements _MediaVariants {
(identical(other.width, width) || other.width == width) &&
(identical(other.height, height) || other.height == height) &&
(identical(other.size, size) || other.size == size) &&
(identical(other.aspect, aspect) || other.aspect == aspect));
(identical(other.aspect, aspect) || other.aspect == aspect) &&
(identical(other.frameRate, frameRate) ||
other.frameRate == frameRate) &&
(identical(other.duration, duration) ||
other.duration == duration) &&
(identical(other.bitrate, bitrate) || other.bitrate == bitrate));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, width, height, size, aspect);
int get hashCode => Object.hash(
runtimeType, width, height, size, aspect, frameRate, duration, bitrate);

@JsonKey(ignore: true)
@override
Expand All @@ -186,8 +248,11 @@ abstract class _MediaVariants implements MediaVariants {
const factory _MediaVariants(
{required final int width,
required final int height,
required final String size,
required final double aspect}) = _$_MediaVariants;
final String? size,
final double? aspect,
final String? frameRate,
final double? duration,
final int? bitrate}) = _$_MediaVariants;

factory _MediaVariants.fromJson(Map<String, dynamic> json) =
_$_MediaVariants.fromJson;
Expand All @@ -197,9 +262,15 @@ abstract class _MediaVariants implements MediaVariants {
@override
int get height;
@override
String get size;
String? get size;
@override
double? get aspect;
@override
String? get frameRate;
@override
double? get duration;
@override
double get aspect;
int? get bitrate;
@override
@JsonKey(ignore: true)
_$$_MediaVariantsCopyWith<_$_MediaVariants> get copyWith =>
Expand Down
11 changes: 9 additions & 2 deletions lib/src/service/entities/media_variants.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f2669d8

Please sign in to comment.