124 lines
3.1 KiB
Dart
124 lines
3.1 KiB
Dart
import 'dart:convert';
|
|
|
|
PollSubmitResponseModel pollSubmitResponseModelFromJson(String str) =>
|
|
PollSubmitResponseModel.fromJson(json.decode(str));
|
|
|
|
String pollSubmitResponseModelToJson(PollSubmitResponseModel data) =>
|
|
json.encode(data.toJson());
|
|
|
|
class PollSubmitResponseModel {
|
|
bool? isSuccess;
|
|
int? statusCode;
|
|
String? message;
|
|
Data? data;
|
|
dynamic errors;
|
|
|
|
PollSubmitResponseModel({
|
|
this.isSuccess,
|
|
this.statusCode,
|
|
this.message,
|
|
this.data,
|
|
this.errors,
|
|
});
|
|
|
|
factory PollSubmitResponseModel.fromJson(Map<String, dynamic> json) =>
|
|
PollSubmitResponseModel(
|
|
isSuccess: json["isSuccess"],
|
|
statusCode: json["statusCode"],
|
|
message: json["message"],
|
|
data: json["data"] == null ? null : Data.fromJson(json["data"]),
|
|
errors: json["errors"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"isSuccess": isSuccess,
|
|
"statusCode": statusCode,
|
|
"message": message,
|
|
"data": data?.toJson(),
|
|
"errors": errors,
|
|
};
|
|
}
|
|
|
|
class Data {
|
|
int? pollPostId;
|
|
String? question;
|
|
DateTime? expiryDate;
|
|
List<PollSubmitResponseOptions>? options;
|
|
int? totalPollVotes;
|
|
|
|
Data({
|
|
this.pollPostId,
|
|
this.question,
|
|
this.expiryDate,
|
|
this.options,
|
|
this.totalPollVotes,
|
|
});
|
|
|
|
factory Data.fromJson(Map<String, dynamic> json) => Data(
|
|
pollPostId: json["pollPostID"],
|
|
question: json["question"],
|
|
expiryDate:
|
|
json["expiryDate"] == null ? null : DateTime.parse(json["expiryDate"]),
|
|
options:
|
|
json["options"] == null
|
|
? []
|
|
: List<PollSubmitResponseOptions>.from(
|
|
json["options"]!.map(
|
|
(x) => PollSubmitResponseOptions.fromJson(x),
|
|
),
|
|
),
|
|
totalPollVotes: json["totalPollVotes"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"pollPostID": pollPostId,
|
|
"question": question,
|
|
"expiryDate": expiryDate?.toIso8601String(),
|
|
"options":
|
|
options == null
|
|
? []
|
|
: List<dynamic>.from(options!.map((x) => x.toJson())),
|
|
"totalPollVotes": totalPollVotes,
|
|
};
|
|
}
|
|
|
|
class PollSubmitResponseOptions {
|
|
int? optionId;
|
|
int? pollId;
|
|
String? userId;
|
|
String? optionLabel;
|
|
int? totalOptionPollVotes;
|
|
int? percentageOptionPollVotes;
|
|
bool? hasUserVoted;
|
|
PollSubmitResponseOptions({
|
|
this.optionId,
|
|
this.pollId,
|
|
this.userId,
|
|
this.optionLabel,
|
|
this.totalOptionPollVotes,
|
|
this.percentageOptionPollVotes,
|
|
this.hasUserVoted,
|
|
});
|
|
|
|
factory PollSubmitResponseOptions.fromJson(Map<String, dynamic> json) =>
|
|
PollSubmitResponseOptions(
|
|
optionId: json["optionID"],
|
|
pollId: json["pollID"],
|
|
userId: json["userID"],
|
|
optionLabel: json["optionLabel"],
|
|
totalOptionPollVotes: json["totalOptionPollVotes"],
|
|
percentageOptionPollVotes: json["percentageOptionPollVotes"],
|
|
hasUserVoted: json["hasUserVoted"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"optionID": optionId,
|
|
"pollID": pollId,
|
|
"userID": userId,
|
|
"optionLabel": optionLabel,
|
|
"totalOptionPollVotes": totalOptionPollVotes,
|
|
"percentageOptionPollVotes": percentageOptionPollVotes,
|
|
"hasUserVoted": hasUserVoted,
|
|
};
|
|
}
|