KonectarApp/lib/model/api_constants_model.dart

63 lines
1.4 KiB
Dart
Raw Permalink Normal View History

2024-12-10 09:36:43 +00:00
// To parse this JSON data, do
//
// final apiConstantsResponse = apiConstantsResponseFromJson(jsonString);
import 'dart:convert';
List<ApiConstantsResponse> apiConstantsResponseFromJson(List<dynamic> json) =>
List<ApiConstantsResponse>.from(
json.map((x) => ApiConstantsResponse.fromJson(x)));
String apiConstantsResponseToJson(List<ApiConstantsResponse> data) =>
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class ApiConstantsResponse {
String? api;
int? interval;
String? method;
String? module;
ApiConstantsResponse({
this.api,
this.interval,
this.method,
this.module,
});
factory ApiConstantsResponse.fromJson(Map<String, dynamic> json) =>
ApiConstantsResponse(
api: json["api"],
interval: json["interval"],
method: json["method"],
module: json["module"],
);
Map<String, dynamic> toJson() => {
"api": api,
"interval": interval,
"method": method,
"module": module,
};
}
enum Method { POST }
final methodValues = EnumValues({"POST": Method.POST});
enum Module { CONTACTSAPI, EVENTAPIS }
final moduleValues = EnumValues(
{"contactsapi": Module.CONTACTSAPI, "eventapis": Module.EVENTAPIS});
class EnumValues<T> {
Map<String, T> map;
late Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
reverseMap = map.map((k, v) => MapEntry(v, k));
return reverseMap;
}
}