You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemm-flutter-app/lib/models/chat/call.dart

173 lines
3.9 KiB
Dart

// To parse this JSON data, do
//
// final callDataModel = callDataModelFromJson(jsonString);
import 'dart:convert';
class CallDataModel {
CallDataModel({
this.callerId,
this.callerName,
this.callerEmail,
this.callerTitle,
this.callerPhone,
this.receiverId,
this.receiverName,
this.receiverEmail,
this.receiverTitle,
this.receiverPhone,
this.title,
this.callType,
});
int? callerId;
String? callerName;
String? callerEmail;
String? callerTitle;
dynamic callerPhone;
int? receiverId;
String? receiverName;
String? receiverEmail;
dynamic receiverTitle;
dynamic receiverPhone;
String? title;
String? callType;
factory CallDataModel.fromRawJson(String str) => CallDataModel.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory CallDataModel.fromJson(Map<String, dynamic> json) => CallDataModel(
callerId: json["callerID"],
callerName: json["callerName"],
callerEmail: json["callerEmail"],
callerTitle: json["callerTitle"],
callerPhone: json["callerPhone"],
receiverId: json["receiverID"],
receiverName: json["receiverName"],
receiverEmail: json["receiverEmail"],
receiverTitle: json["receiverTitle"],
receiverPhone: json["receiverPhone"],
title: json["title"],
callType: json["callType"],
);
Map<String, dynamic> toJson() => {
"callerID": callerId,
"callerName": callerName,
"callerEmail": callerEmail,
"callerTitle": callerTitle,
"callerPhone": callerPhone,
"receiverID": receiverId,
"receiverName": receiverName,
"receiverEmail": receiverEmail,
"receiverTitle": receiverTitle,
"receiverPhone": receiverPhone,
"title": title,
"callType": callType,
};
}
// To parse this JSON data, do
//
// final callSessionPayLoad = callSessionPayLoadFromJson(jsonString);
class CallSessionPayLoad {
CallSessionPayLoad({
this.target,
this.caller,
this.sdp,
});
int? target;
int? caller;
Sdp? sdp;
factory CallSessionPayLoad.fromRawJson(String str) => CallSessionPayLoad.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory CallSessionPayLoad.fromJson(Map<String, dynamic> json) => CallSessionPayLoad(
target: json["target"],
caller: json["caller"],
sdp: json["sdp"] == null ? null : Sdp.fromJson(json["sdp"]),
);
Map<String, dynamic> toJson() => {
"target": target,
"caller": caller,
"sdp": sdp?.toJson(),
};
}
class Sdp {
Sdp({
this.type,
this.sdp,
});
String? type;
String? sdp;
factory Sdp.fromRawJson(String str) => Sdp.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Sdp.fromJson(Map<String, dynamic> json) => Sdp(
type: json["type"],
sdp: json["sdp"],
);
Map<String, dynamic> toJson() => {
"type": type,
"sdp": sdp,
};
}
// final iosCallPayload = iosCallPayloadFromJson(jsonString);
class IosCallPayload {
String? incomingCallType;
String? incomingCallerId;
String? incomingCallerName;
String? callData;
String? uuid;
IosCallPayload({
this.incomingCallType,
this.incomingCallerId,
this.incomingCallerName,
this.callData,
this.uuid,
});
factory IosCallPayload.fromRawJson(String str) => IosCallPayload.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory IosCallPayload.fromJson(Map<String, dynamic> json) => IosCallPayload(
incomingCallType: json["incoming_call_type"],
incomingCallerId: json["incoming_caller_id"],
incomingCallerName: json["incoming_caller_name"],
callData: json["call_data"],
uuid: json["uuid"],
);
Map<String, dynamic> toJson() => {
"incoming_call_type": incomingCallType,
"incoming_caller_id": incomingCallerId,
"incoming_caller_name": incomingCallerName,
"call_data": callData,
"uuid": uuid,
};
}