Skip to content

Commit

Permalink
fix: Fix issue with generated client.
Browse files Browse the repository at this point in the history
  • Loading branch information
just-seba committed Oct 2, 2024
1 parent 1886d2f commit 12d0edd
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class BatteryStatusDto {
)
final enums.BatteryChargeStatus chargeStatus;
@JsonKey(name: 'charge')
final double charge;
final num charge;
static const fromJsonFactory = _$BatteryStatusDtoFromJson;

@override
Expand Down Expand Up @@ -353,7 +353,7 @@ extension $BatteryStatusDtoExtension on BatteryStatusDto {
BatteryStatusDto copyWith(
{bool? isAvailable,
enums.BatteryChargeStatus? chargeStatus,
double? charge}) {
num? charge}) {
return BatteryStatusDto(
isAvailable: isAvailable ?? this.isAvailable,
chargeStatus: chargeStatus ?? this.chargeStatus,
Expand All @@ -363,7 +363,7 @@ extension $BatteryStatusDtoExtension on BatteryStatusDto {
BatteryStatusDto copyWithWrapped(
{Wrapped<bool?>? isAvailable,
Wrapped<enums.BatteryChargeStatus>? chargeStatus,
Wrapped<double>? charge}) {
Wrapped<num>? charge}) {
return BatteryStatusDto(
isAvailable:
(isAvailable != null ? isAvailable.value : this.isAvailable),
Expand All @@ -390,9 +390,9 @@ class ConsumerStatusDto {
@JsonKey(name: 'isAvailable')
final bool? isAvailable;
@JsonKey(name: 'currentPowerConsumption')
final double currentPowerConsumption;
final num currentPowerConsumption;
@JsonKey(name: 'maximumPowerConsumption')
final double maximumPowerConsumption;
final num maximumPowerConsumption;
static const fromJsonFactory = _$ConsumerStatusDtoFromJson;

@override
Expand Down Expand Up @@ -426,8 +426,8 @@ class ConsumerStatusDto {
extension $ConsumerStatusDtoExtension on ConsumerStatusDto {
ConsumerStatusDto copyWith(
{bool? isAvailable,
double? currentPowerConsumption,
double? maximumPowerConsumption}) {
num? currentPowerConsumption,
num? maximumPowerConsumption}) {
return ConsumerStatusDto(
isAvailable: isAvailable ?? this.isAvailable,
currentPowerConsumption:
Expand All @@ -438,8 +438,8 @@ extension $ConsumerStatusDtoExtension on ConsumerStatusDto {

ConsumerStatusDto copyWithWrapped(
{Wrapped<bool?>? isAvailable,
Wrapped<double>? currentPowerConsumption,
Wrapped<double>? maximumPowerConsumption}) {
Wrapped<num>? currentPowerConsumption,
Wrapped<num>? maximumPowerConsumption}) {
return ConsumerStatusDto(
isAvailable:
(isAvailable != null ? isAvailable.value : this.isAvailable),
Expand Down Expand Up @@ -807,11 +807,11 @@ class GridStatusDto {
)
final enums.GridPowerDirection currentPowerDirection;
@JsonKey(name: 'currentPower')
final double currentPower;
final num currentPower;
@JsonKey(name: 'maximumPowerConsumption')
final double maximumPowerConsumption;
final num maximumPowerConsumption;
@JsonKey(name: 'maximumPowerFeedIn')
final double maximumPowerFeedIn;
final num maximumPowerFeedIn;
static const fromJsonFactory = _$GridStatusDtoFromJson;

@override
Expand Down Expand Up @@ -853,9 +853,9 @@ extension $GridStatusDtoExtension on GridStatusDto {
GridStatusDto copyWith(
{bool? isAvailable,
enums.GridPowerDirection? currentPowerDirection,
double? currentPower,
double? maximumPowerConsumption,
double? maximumPowerFeedIn}) {
num? currentPower,
num? maximumPowerConsumption,
num? maximumPowerFeedIn}) {
return GridStatusDto(
isAvailable: isAvailable ?? this.isAvailable,
currentPowerDirection:
Expand All @@ -869,9 +869,9 @@ extension $GridStatusDtoExtension on GridStatusDto {
GridStatusDto copyWithWrapped(
{Wrapped<bool?>? isAvailable,
Wrapped<enums.GridPowerDirection>? currentPowerDirection,
Wrapped<double>? currentPower,
Wrapped<double>? maximumPowerConsumption,
Wrapped<double>? maximumPowerFeedIn}) {
Wrapped<num>? currentPower,
Wrapped<num>? maximumPowerConsumption,
Wrapped<num>? maximumPowerFeedIn}) {
return GridStatusDto(
isAvailable:
(isAvailable != null ? isAvailable.value : this.isAvailable),
Expand Down Expand Up @@ -1389,9 +1389,9 @@ class ProducerStatusDto {
@JsonKey(name: 'isAvailable')
final bool? isAvailable;
@JsonKey(name: 'currentPowerProduction')
final double currentPowerProduction;
final num currentPowerProduction;
@JsonKey(name: 'maximumPowerProduction')
final double maximumPowerProduction;
final num maximumPowerProduction;
static const fromJsonFactory = _$ProducerStatusDtoFromJson;

@override
Expand Down Expand Up @@ -1423,8 +1423,8 @@ class ProducerStatusDto {
extension $ProducerStatusDtoExtension on ProducerStatusDto {
ProducerStatusDto copyWith(
{bool? isAvailable,
double? currentPowerProduction,
double? maximumPowerProduction}) {
num? currentPowerProduction,
num? maximumPowerProduction}) {
return ProducerStatusDto(
isAvailable: isAvailable ?? this.isAvailable,
currentPowerProduction:
Expand All @@ -1435,8 +1435,8 @@ extension $ProducerStatusDtoExtension on ProducerStatusDto {

ProducerStatusDto copyWithWrapped(
{Wrapped<bool?>? isAvailable,
Wrapped<double>? currentPowerProduction,
Wrapped<double>? maximumPowerProduction}) {
Wrapped<num>? currentPowerProduction,
Wrapped<num>? maximumPowerProduction}) {
return ProducerStatusDto(
isAvailable:
(isAvailable != null ? isAvailable.value : this.isAvailable),
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class _$BackendApi extends BackendApi {
@override
Future<Response<List<AddableDevelopmentDeviceDto>>>
_Development_AddableDevelopmentDevicesQuery(
{required Object? deviceCategory}) {
{required String? deviceCategory}) {
final Uri $url = Uri.parse('/integrations/development/v1/addable-devices');
final Map<String, dynamic> $params = <String, dynamic>{
'DeviceCategory': deviceCategory
Expand Down Expand Up @@ -239,7 +239,7 @@ final class _$BackendApi extends BackendApi {

@override
Future<Response<List<IntegrationDescriptionDto>>>
_Integrations_IntegrationsQuery({required Object? deviceCategory}) {
_Integrations_IntegrationsQuery({required String? deviceCategory}) {
final Uri $url = Uri.parse('/v1/integrations');
final Map<String, dynamic> $params = <String, dynamic>{
'DeviceCategory': deviceCategory
Expand Down Expand Up @@ -269,7 +269,7 @@ final class _$BackendApi extends BackendApi {

@override
Future<Response<List<AddableShellyDeviceDto>>>
_Shelly_AddableShellyDevicesQuery({required Object? deviceCategory}) {
_Shelly_AddableShellyDevicesQuery({required String? deviceCategory}) {
final Uri $url = Uri.parse('/integrations/shelly/v1/addable-devices');
final Map<String, dynamic> $params = <String, dynamic>{
'DeviceCategory': deviceCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'client_mapping.dart';
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:chopper/chopper.dart' as chopper;
import 'backend_api.enums.swagger.dart' as enums;
export 'backend_api.enums.swagger.dart';
export 'backend_api.models.swagger.dart';

Expand Down Expand Up @@ -46,20 +47,20 @@ abstract class BackendApi extends ChopperService {
///@param DeviceCategory
Future<chopper.Response<List<AddableDevelopmentDeviceDto>>>
Development_AddableDevelopmentDevicesQuery(
{required Object? deviceCategory}) {
{required enums.DeviceCategory? deviceCategory}) {
generatedMapping.putIfAbsent(AddableDevelopmentDeviceDto,
() => AddableDevelopmentDeviceDto.fromJsonFactory);

return _Development_AddableDevelopmentDevicesQuery(
deviceCategory: deviceCategory);
deviceCategory: deviceCategory?.value?.toString());
}

///
///@param DeviceCategory
@Get(path: '/integrations/development/v1/addable-devices')
Future<chopper.Response<List<AddableDevelopmentDeviceDto>>>
_Development_AddableDevelopmentDevicesQuery(
{@Query('DeviceCategory') required Object? deviceCategory});
{@Query('DeviceCategory') required String? deviceCategory});

///
Future<chopper.Response<DevicesDto>> Devices_DevicesQuery() {
Expand Down Expand Up @@ -272,19 +273,21 @@ abstract class BackendApi extends ChopperService {
///
///@param DeviceCategory
Future<chopper.Response<List<IntegrationDescriptionDto>>>
Integrations_IntegrationsQuery({required Object? deviceCategory}) {
Integrations_IntegrationsQuery(
{required enums.DeviceCategory? deviceCategory}) {
generatedMapping.putIfAbsent(IntegrationDescriptionDto,
() => IntegrationDescriptionDto.fromJsonFactory);

return _Integrations_IntegrationsQuery(deviceCategory: deviceCategory);
return _Integrations_IntegrationsQuery(
deviceCategory: deviceCategory?.value?.toString());
}

///
///@param DeviceCategory
@Get(path: '/v1/integrations')
Future<chopper.Response<List<IntegrationDescriptionDto>>>
_Integrations_IntegrationsQuery(
{@Query('DeviceCategory') required Object? deviceCategory});
{@Query('DeviceCategory') required String? deviceCategory});

///
Future<chopper.Response<ShellyPermissionGrantUriResponse>>
Expand All @@ -303,19 +306,21 @@ abstract class BackendApi extends ChopperService {
///
///@param DeviceCategory
Future<chopper.Response<List<AddableShellyDeviceDto>>>
Shelly_AddableShellyDevicesQuery({required Object? deviceCategory}) {
Shelly_AddableShellyDevicesQuery(
{required enums.DeviceCategory? deviceCategory}) {
generatedMapping.putIfAbsent(
AddableShellyDeviceDto, () => AddableShellyDeviceDto.fromJsonFactory);

return _Shelly_AddableShellyDevicesQuery(deviceCategory: deviceCategory);
return _Shelly_AddableShellyDevicesQuery(
deviceCategory: deviceCategory?.value?.toString());
}

///
///@param DeviceCategory
@Get(path: '/integrations/shelly/v1/addable-devices')
Future<chopper.Response<List<AddableShellyDeviceDto>>>
_Shelly_AddableShellyDevicesQuery(
{@Query('DeviceCategory') required Object? deviceCategory});
{@Query('DeviceCategory') required String? deviceCategory});
}

typedef $JsonFactory<T> = T Function(Map<String, dynamic> json);
Expand Down
Loading

0 comments on commit 12d0edd

Please sign in to comment.