Skip to content

Commit

Permalink
fix: update cat-gateway code gen
Browse files Browse the repository at this point in the history
  • Loading branch information
bkioshn committed May 31, 2024
1 parent 7347e56 commit 68fdc08
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:collection/collection.dart';

enum DeepQueryInspection {
enum DeepQueryInspectionFlag {
@JsonValue(null)
swaggerGeneratedUnknown(null),

Expand All @@ -12,7 +12,7 @@ enum DeepQueryInspection {

final String? value;

const DeepQueryInspection(this.value);
const DeepQueryInspectionFlag(this.value);
}

enum LogLevel {
Expand Down Expand Up @@ -82,3 +82,27 @@ enum VoterGroupId {

const VoterGroupId(this.value);
}

enum VotingInfoDelegationsType {
@JsonValue(null)
swaggerGeneratedUnknown(null),

@JsonValue('Delegated')
delegated('Delegated');

final String? value;

const VotingInfoDelegationsType(this.value);
}

enum VotingInfoDirectVoterType {
@JsonValue(null)
swaggerGeneratedUnknown(null),

@JsonValue('Direct')
direct('Direct');

final String? value;

const VotingInfoDirectVoterType(this.value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,12 @@ class VotingInfoDelegations {
static const toJsonFactory = _$VotingInfoDelegationsToJson;
Map<String, dynamic> toJson() => _$VotingInfoDelegationsToJson(this);

@JsonKey(name: 'type')
final String type;
@JsonKey(
name: 'type',
toJson: votingInfoDelegationsTypeToJson,
fromJson: votingInfoDelegationsTypeFromJson,
)
final enums.VotingInfoDelegationsType type;
@JsonKey(name: 'delegations', defaultValue: <Delegation>[])
final List<Delegation> delegations;
static const fromJsonFactory = _$VotingInfoDelegationsFromJson;
Expand Down Expand Up @@ -1400,13 +1404,14 @@ class VotingInfoDelegations {

extension $VotingInfoDelegationsExtension on VotingInfoDelegations {
VotingInfoDelegations copyWith(
{String? type, List<Delegation>? delegations}) {
{enums.VotingInfoDelegationsType? type, List<Delegation>? delegations}) {
return VotingInfoDelegations(
type: type ?? this.type, delegations: delegations ?? this.delegations);
}

VotingInfoDelegations copyWithWrapped(
{Wrapped<String>? type, Wrapped<List<Delegation>>? delegations}) {
{Wrapped<enums.VotingInfoDelegationsType>? type,
Wrapped<List<Delegation>>? delegations}) {
return VotingInfoDelegations(
type: (type != null ? type.value : this.type),
delegations:
Expand All @@ -1427,8 +1432,12 @@ class VotingInfoDirectVoter {
static const toJsonFactory = _$VotingInfoDirectVoterToJson;
Map<String, dynamic> toJson() => _$VotingInfoDirectVoterToJson(this);

@JsonKey(name: 'type')
final String type;
@JsonKey(
name: 'type',
toJson: votingInfoDirectVoterTypeToJson,
fromJson: votingInfoDirectVoterTypeFromJson,
)
final enums.VotingInfoDirectVoterType type;
@JsonKey(name: 'voting_key')
final String votingKey;
static const fromJsonFactory = _$VotingInfoDirectVoterFromJson;
Expand All @@ -1455,88 +1464,91 @@ class VotingInfoDirectVoter {
}

extension $VotingInfoDirectVoterExtension on VotingInfoDirectVoter {
VotingInfoDirectVoter copyWith({String? type, String? votingKey}) {
VotingInfoDirectVoter copyWith(
{enums.VotingInfoDirectVoterType? type, String? votingKey}) {
return VotingInfoDirectVoter(
type: type ?? this.type, votingKey: votingKey ?? this.votingKey);
}

VotingInfoDirectVoter copyWithWrapped(
{Wrapped<String>? type, Wrapped<String>? votingKey}) {
{Wrapped<enums.VotingInfoDirectVoterType>? type,
Wrapped<String>? votingKey}) {
return VotingInfoDirectVoter(
type: (type != null ? type.value : this.type),
votingKey: (votingKey != null ? votingKey.value : this.votingKey));
}
}

String? deepQueryInspectionNullableToJson(
enums.DeepQueryInspection? deepQueryInspection) {
return deepQueryInspection?.value;
String? deepQueryInspectionFlagNullableToJson(
enums.DeepQueryInspectionFlag? deepQueryInspectionFlag) {
return deepQueryInspectionFlag?.value;
}

String? deepQueryInspectionToJson(
enums.DeepQueryInspection deepQueryInspection) {
return deepQueryInspection.value;
String? deepQueryInspectionFlagToJson(
enums.DeepQueryInspectionFlag deepQueryInspectionFlag) {
return deepQueryInspectionFlag.value;
}

enums.DeepQueryInspection deepQueryInspectionFromJson(
Object? deepQueryInspection, [
enums.DeepQueryInspection? defaultValue,
enums.DeepQueryInspectionFlag deepQueryInspectionFlagFromJson(
Object? deepQueryInspectionFlag, [
enums.DeepQueryInspectionFlag? defaultValue,
]) {
return enums.DeepQueryInspection.values
.firstWhereOrNull((e) => e.value == deepQueryInspection) ??
return enums.DeepQueryInspectionFlag.values
.firstWhereOrNull((e) => e.value == deepQueryInspectionFlag) ??
defaultValue ??
enums.DeepQueryInspection.swaggerGeneratedUnknown;
enums.DeepQueryInspectionFlag.swaggerGeneratedUnknown;
}

enums.DeepQueryInspection? deepQueryInspectionNullableFromJson(
Object? deepQueryInspection, [
enums.DeepQueryInspection? defaultValue,
enums.DeepQueryInspectionFlag? deepQueryInspectionFlagNullableFromJson(
Object? deepQueryInspectionFlag, [
enums.DeepQueryInspectionFlag? defaultValue,
]) {
if (deepQueryInspection == null) {
if (deepQueryInspectionFlag == null) {
return null;
}
return enums.DeepQueryInspection.values
.firstWhereOrNull((e) => e.value == deepQueryInspection) ??
return enums.DeepQueryInspectionFlag.values
.firstWhereOrNull((e) => e.value == deepQueryInspectionFlag) ??
defaultValue;
}

String deepQueryInspectionExplodedListToJson(
List<enums.DeepQueryInspection>? deepQueryInspection) {
return deepQueryInspection?.map((e) => e.value!).join(',') ?? '';
String deepQueryInspectionFlagExplodedListToJson(
List<enums.DeepQueryInspectionFlag>? deepQueryInspectionFlag) {
return deepQueryInspectionFlag?.map((e) => e.value!).join(',') ?? '';
}

List<String> deepQueryInspectionListToJson(
List<enums.DeepQueryInspection>? deepQueryInspection) {
if (deepQueryInspection == null) {
List<String> deepQueryInspectionFlagListToJson(
List<enums.DeepQueryInspectionFlag>? deepQueryInspectionFlag) {
if (deepQueryInspectionFlag == null) {
return [];
}

return deepQueryInspection.map((e) => e.value!).toList();
return deepQueryInspectionFlag.map((e) => e.value!).toList();
}

List<enums.DeepQueryInspection> deepQueryInspectionListFromJson(
List? deepQueryInspection, [
List<enums.DeepQueryInspection>? defaultValue,
List<enums.DeepQueryInspectionFlag> deepQueryInspectionFlagListFromJson(
List? deepQueryInspectionFlag, [
List<enums.DeepQueryInspectionFlag>? defaultValue,
]) {
if (deepQueryInspection == null) {
if (deepQueryInspectionFlag == null) {
return defaultValue ?? [];
}

return deepQueryInspection
.map((e) => deepQueryInspectionFromJson(e.toString()))
return deepQueryInspectionFlag
.map((e) => deepQueryInspectionFlagFromJson(e.toString()))
.toList();
}

List<enums.DeepQueryInspection>? deepQueryInspectionNullableListFromJson(
List? deepQueryInspection, [
List<enums.DeepQueryInspection>? defaultValue,
List<enums.DeepQueryInspectionFlag>?
deepQueryInspectionFlagNullableListFromJson(
List? deepQueryInspectionFlag, [
List<enums.DeepQueryInspectionFlag>? defaultValue,
]) {
if (deepQueryInspection == null) {
if (deepQueryInspectionFlag == null) {
return defaultValue;
}

return deepQueryInspection
.map((e) => deepQueryInspectionFromJson(e.toString()))
return deepQueryInspectionFlag
.map((e) => deepQueryInspectionFlagFromJson(e.toString()))
.toList();
}

Expand Down Expand Up @@ -1798,6 +1810,152 @@ List<enums.VoterGroupId>? voterGroupIdNullableListFromJson(
return voterGroupId.map((e) => voterGroupIdFromJson(e.toString())).toList();
}

String? votingInfoDelegationsTypeNullableToJson(
enums.VotingInfoDelegationsType? votingInfoDelegationsType) {
return votingInfoDelegationsType?.value;
}

String? votingInfoDelegationsTypeToJson(
enums.VotingInfoDelegationsType votingInfoDelegationsType) {
return votingInfoDelegationsType.value;
}

enums.VotingInfoDelegationsType votingInfoDelegationsTypeFromJson(
Object? votingInfoDelegationsType, [
enums.VotingInfoDelegationsType? defaultValue,
]) {
return enums.VotingInfoDelegationsType.values
.firstWhereOrNull((e) => e.value == votingInfoDelegationsType) ??
defaultValue ??
enums.VotingInfoDelegationsType.swaggerGeneratedUnknown;
}

enums.VotingInfoDelegationsType? votingInfoDelegationsTypeNullableFromJson(
Object? votingInfoDelegationsType, [
enums.VotingInfoDelegationsType? defaultValue,
]) {
if (votingInfoDelegationsType == null) {
return null;
}
return enums.VotingInfoDelegationsType.values
.firstWhereOrNull((e) => e.value == votingInfoDelegationsType) ??
defaultValue;
}

String votingInfoDelegationsTypeExplodedListToJson(
List<enums.VotingInfoDelegationsType>? votingInfoDelegationsType) {
return votingInfoDelegationsType?.map((e) => e.value!).join(',') ?? '';
}

List<String> votingInfoDelegationsTypeListToJson(
List<enums.VotingInfoDelegationsType>? votingInfoDelegationsType) {
if (votingInfoDelegationsType == null) {
return [];
}

return votingInfoDelegationsType.map((e) => e.value!).toList();
}

List<enums.VotingInfoDelegationsType> votingInfoDelegationsTypeListFromJson(
List? votingInfoDelegationsType, [
List<enums.VotingInfoDelegationsType>? defaultValue,
]) {
if (votingInfoDelegationsType == null) {
return defaultValue ?? [];
}

return votingInfoDelegationsType
.map((e) => votingInfoDelegationsTypeFromJson(e.toString()))
.toList();
}

List<enums.VotingInfoDelegationsType>?
votingInfoDelegationsTypeNullableListFromJson(
List? votingInfoDelegationsType, [
List<enums.VotingInfoDelegationsType>? defaultValue,
]) {
if (votingInfoDelegationsType == null) {
return defaultValue;
}

return votingInfoDelegationsType
.map((e) => votingInfoDelegationsTypeFromJson(e.toString()))
.toList();
}

String? votingInfoDirectVoterTypeNullableToJson(
enums.VotingInfoDirectVoterType? votingInfoDirectVoterType) {
return votingInfoDirectVoterType?.value;
}

String? votingInfoDirectVoterTypeToJson(
enums.VotingInfoDirectVoterType votingInfoDirectVoterType) {
return votingInfoDirectVoterType.value;
}

enums.VotingInfoDirectVoterType votingInfoDirectVoterTypeFromJson(
Object? votingInfoDirectVoterType, [
enums.VotingInfoDirectVoterType? defaultValue,
]) {
return enums.VotingInfoDirectVoterType.values
.firstWhereOrNull((e) => e.value == votingInfoDirectVoterType) ??
defaultValue ??
enums.VotingInfoDirectVoterType.swaggerGeneratedUnknown;
}

enums.VotingInfoDirectVoterType? votingInfoDirectVoterTypeNullableFromJson(
Object? votingInfoDirectVoterType, [
enums.VotingInfoDirectVoterType? defaultValue,
]) {
if (votingInfoDirectVoterType == null) {
return null;
}
return enums.VotingInfoDirectVoterType.values
.firstWhereOrNull((e) => e.value == votingInfoDirectVoterType) ??
defaultValue;
}

String votingInfoDirectVoterTypeExplodedListToJson(
List<enums.VotingInfoDirectVoterType>? votingInfoDirectVoterType) {
return votingInfoDirectVoterType?.map((e) => e.value!).join(',') ?? '';
}

List<String> votingInfoDirectVoterTypeListToJson(
List<enums.VotingInfoDirectVoterType>? votingInfoDirectVoterType) {
if (votingInfoDirectVoterType == null) {
return [];
}

return votingInfoDirectVoterType.map((e) => e.value!).toList();
}

List<enums.VotingInfoDirectVoterType> votingInfoDirectVoterTypeListFromJson(
List? votingInfoDirectVoterType, [
List<enums.VotingInfoDirectVoterType>? defaultValue,
]) {
if (votingInfoDirectVoterType == null) {
return defaultValue ?? [];
}

return votingInfoDirectVoterType
.map((e) => votingInfoDirectVoterTypeFromJson(e.toString()))
.toList();
}

List<enums.VotingInfoDirectVoterType>?
votingInfoDirectVoterTypeNullableListFromJson(
List? votingInfoDirectVoterType, [
List<enums.VotingInfoDirectVoterType>? defaultValue,
]) {
if (votingInfoDirectVoterType == null) {
return defaultValue;
}

return votingInfoDirectVoterType
.map((e) => votingInfoDirectVoterTypeFromJson(e.toString()))
.toList();
}

// ignore: unused_element
String? _dateToJson(DateTime? date) {
if (date == null) {
Expand Down
Loading

0 comments on commit 68fdc08

Please sign in to comment.