home screen stocks api, subscription

This commit is contained in:
jayesh
2024-05-24 18:48:09 +05:30
parent 83404f9768
commit 1e2e1ddece
12 changed files with 1049 additions and 608 deletions

View File

@@ -10,14 +10,14 @@ class HomeModel {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
data = json['data'] != null ? Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['status_code'] = this.statusCode;
data['message'] = this.message;
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
data['status_code'] = statusCode;
data['message'] = message;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
@@ -28,65 +28,203 @@ class HomeModel {
class Data {
List<ExploreTheUnseenActiveCalls>? exploreTheUnseenActiveCalls;
List<ExploreTheUnseenExitedCalls>? exploreTheUnseenExitedCalls;
IndexLiveData? indexLiveData;
UserData? userData;
List<Products>? products;
ContentByteVideo? contentByteVideo;
bool? isUpstoxTokenRefreshed;
Data(
{this.exploreTheUnseenActiveCalls,
this.exploreTheUnseenExitedCalls,
this.userData,
this.products,
this.contentByteVideo});
this.contentByteVideo,
this.isUpstoxTokenRefreshed,
this.indexLiveData});
Data.fromJson(Map<String, dynamic> json) {
if (json['explore_the_unseen_active_calls'] != null) {
exploreTheUnseenActiveCalls = <ExploreTheUnseenActiveCalls>[];
json['explore_the_unseen_active_calls'].forEach((v) {
exploreTheUnseenActiveCalls!
.add(new ExploreTheUnseenActiveCalls.fromJson(v));
.add(ExploreTheUnseenActiveCalls.fromJson(v));
});
}
if (json['explore_the_unseen_exited_calls'] != null) {
exploreTheUnseenExitedCalls = <ExploreTheUnseenExitedCalls>[];
json['explore_the_unseen_exited_calls'].forEach((v) {
exploreTheUnseenExitedCalls!
.add(new ExploreTheUnseenExitedCalls.fromJson(v));
.add(ExploreTheUnseenExitedCalls.fromJson(v));
});
}
userData = json['user_data'] != null
? new UserData.fromJson(json['user_data'])
indexLiveData = json['index_live_data'] != null
? IndexLiveData.fromJson(json['index_live_data'])
: null;
userData =
json['user_data'] != null ? UserData.fromJson(json['user_data']) : null;
if (json['products'] != null) {
products = <Products>[];
json['products'].forEach((v) {
products!.add(new Products.fromJson(v));
products!.add(Products.fromJson(v));
});
}
contentByteVideo = json['content_byte_video'] != null
? new ContentByteVideo.fromJson(json['content_byte_video'])
? ContentByteVideo.fromJson(json['content_byte_video'])
: null;
isUpstoxTokenRefreshed = json['isUpstoxTokenRefreshed'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (exploreTheUnseenActiveCalls != null) {
data['explore_the_unseen_active_calls'] =
exploreTheUnseenActiveCalls!.map((v) => v.toJson()).toList();
}
if (exploreTheUnseenExitedCalls != null) {
data['explore_the_unseen_exited_calls'] =
exploreTheUnseenExitedCalls!.map((v) => v.toJson()).toList();
}
if (indexLiveData != null) {
data['index_live_data'] = indexLiveData!.toJson();
}
if (userData != null) {
data['user_data'] = userData!.toJson();
}
if (products != null) {
data['products'] = products!.map((v) => v.toJson()).toList();
}
if (contentByteVideo != null) {
data['content_byte_video'] = contentByteVideo!.toJson();
}
data['isUpstoxTokenRefreshed'] = isUpstoxTokenRefreshed;
return data;
}
}
class IndexLiveData {
String? status;
Data1? data;
IndexLiveData({this.status, this.data});
IndexLiveData.fromJson(Map<String, dynamic> json) {
status = json['status'];
data = json['data'] != null ? Data1.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data1 {
NSEINDEXNiftyBank? nSEINDEXNiftyBank;
NSEINDEXNiftyBank? nSEINDEXNifty50;
Data1({this.nSEINDEXNiftyBank, this.nSEINDEXNifty50});
Data1.fromJson(Map<String, dynamic> json) {
nSEINDEXNiftyBank = json['NSE_INDEX:Nifty Bank'] != null
? NSEINDEXNiftyBank.fromJson(json['NSE_INDEX:Nifty Bank'])
: null;
nSEINDEXNifty50 = json['NSE_INDEX:Nifty 50'] != null
? NSEINDEXNiftyBank.fromJson(json['NSE_INDEX:Nifty 50'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.exploreTheUnseenActiveCalls != null) {
data['explore_the_unseen_active_calls'] =
this.exploreTheUnseenActiveCalls!.map((v) => v.toJson()).toList();
final Map<String, dynamic> data = <String, dynamic>{};
if (nSEINDEXNiftyBank != null) {
data['NSE_INDEX:Nifty Bank'] = nSEINDEXNiftyBank!.toJson();
}
if (this.exploreTheUnseenExitedCalls != null) {
data['explore_the_unseen_exited_calls'] =
this.exploreTheUnseenExitedCalls!.map((v) => v.toJson()).toList();
if (nSEINDEXNifty50 != null) {
data['NSE_INDEX:Nifty 50'] = nSEINDEXNifty50!.toJson();
}
if (this.userData != null) {
data['user_data'] = this.userData!.toJson();
}
if (this.products != null) {
data['products'] = this.products!.map((v) => v.toJson()).toList();
}
if (this.contentByteVideo != null) {
data['content_byte_video'] = this.contentByteVideo!.toJson();
return data;
}
}
class NSEINDEXNiftyBank {
Ohlc? ohlc;
String? timestamp;
String? instrumentToken;
String? symbol;
double? lastPrice;
double? netChange;
String? lastTradeTime;
NSEINDEXNiftyBank({
this.ohlc,
this.timestamp,
this.instrumentToken,
this.symbol,
this.lastPrice,
this.netChange,
this.lastTradeTime,
});
NSEINDEXNiftyBank.fromJson(Map<String, dynamic> json) {
ohlc = json['ohlc'] != null ? Ohlc.fromJson(json['ohlc']) : null;
timestamp = json['timestamp'];
instrumentToken = json['instrument_token'];
symbol = json['symbol'];
lastPrice = json['last_price'];
netChange = json['net_change'];
lastTradeTime = json['last_trade_time'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (ohlc != null) {
data['ohlc'] = ohlc!.toJson();
}
data['timestamp'] = timestamp;
data['instrument_token'] = instrumentToken;
data['symbol'] = symbol;
data['last_price'] = lastPrice;
data['net_change'] = netChange;
data['last_trade_time'] = lastTradeTime;
return data;
}
}
class Ohlc {
double? open;
double? high;
double? low;
double? close;
Ohlc({this.open, this.high, this.low, this.close});
Ohlc.fromJson(Map<String, dynamic> json) {
open = json['open'].toDouble();
high = json['high'].toDouble();
low = json['low'].toDouble();
close = json['close'].toDouble();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['open'] = open;
data['high'] = high;
data['low'] = low;
data['close'] = close;
return data;
}
}
@@ -146,35 +284,35 @@ class ExploreTheUnseenActiveCalls {
scheduleDateTime = json['schedule_date_time'];
createdAt = json['created_at'];
productData = json['product_data'] != null
? new ProductData.fromJson(json['product_data'])
? ProductData.fromJson(json['product_data'])
: null;
actionData = json['action_data'] != null
? new ActionData.fromJson(json['action_data'])
? ActionData.fromJson(json['action_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['manage_product_xid'] = this.manageProductXid;
data['recommendation_actions_xid'] = this.recommendationActionsXid;
data['stock_name'] = this.stockName;
data['instrument_key'] = this.instrumentKey;
data['stock_image'] = this.stockImage;
data['qty'] = this.qty;
data['duration'] = this.duration;
data['current_price'] = this.currentPrice;
data['buy_price'] = this.buyPrice;
data['target_price'] = this.targetPrice;
data['stop_loss'] = this.stopLoss;
data['is_send_recommendation_now'] = this.isSendRecommendationNow;
data['schedule_date_time'] = this.scheduleDateTime;
data['created_at'] = this.createdAt;
if (this.productData != null) {
data['product_data'] = this.productData!.toJson();
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['manage_product_xid'] = manageProductXid;
data['recommendation_actions_xid'] = recommendationActionsXid;
data['stock_name'] = stockName;
data['instrument_key'] = instrumentKey;
data['stock_image'] = stockImage;
data['qty'] = qty;
data['duration'] = duration;
data['current_price'] = currentPrice;
data['buy_price'] = buyPrice;
data['target_price'] = targetPrice;
data['stop_loss'] = stopLoss;
data['is_send_recommendation_now'] = isSendRecommendationNow;
data['schedule_date_time'] = scheduleDateTime;
data['created_at'] = createdAt;
if (productData != null) {
data['product_data'] = productData!.toJson();
}
if (this.actionData != null) {
data['action_data'] = this.actionData!.toJson();
if (actionData != null) {
data['action_data'] = actionData!.toJson();
}
return data;
}
@@ -235,35 +373,35 @@ class ExploreTheUnseenExitedCalls {
scheduleDateTime = json['schedule_date_time'];
createdAt = json['created_at'];
productData = json['product_data'] != null
? new ProductData.fromJson(json['product_data'])
? ProductData.fromJson(json['product_data'])
: null;
actionData = json['action_data'] != null
? new ActionData.fromJson(json['action_data'])
? ActionData.fromJson(json['action_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['manage_product_xid'] = this.manageProductXid;
data['recommendation_actions_xid'] = this.recommendationActionsXid;
data['stock_name'] = this.stockName;
data['instrument_key'] = this.instrumentKey;
data['stock_image'] = this.stockImage;
data['qty'] = this.qty;
data['duration'] = this.duration;
data['current_price'] = this.currentPrice;
data['buy_price'] = this.buyPrice;
data['target_price'] = this.targetPrice;
data['stop_loss'] = this.stopLoss;
data['is_send_recommendation_now'] = this.isSendRecommendationNow;
data['schedule_date_time'] = this.scheduleDateTime;
data['created_at'] = this.createdAt;
if (this.productData != null) {
data['product_data'] = this.productData!.toJson();
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['manage_product_xid'] = manageProductXid;
data['recommendation_actions_xid'] = recommendationActionsXid;
data['stock_name'] = stockName;
data['instrument_key'] = instrumentKey;
data['stock_image'] = stockImage;
data['qty'] = qty;
data['duration'] = duration;
data['current_price'] = currentPrice;
data['buy_price'] = buyPrice;
data['target_price'] = targetPrice;
data['stop_loss'] = stopLoss;
data['is_send_recommendation_now'] = isSendRecommendationNow;
data['schedule_date_time'] = scheduleDateTime;
data['created_at'] = createdAt;
if (productData != null) {
data['product_data'] = productData!.toJson();
}
if (this.actionData != null) {
data['action_data'] = this.actionData!.toJson();
if (actionData != null) {
data['action_data'] = actionData!.toJson();
}
return data;
}
@@ -285,11 +423,11 @@ class ProductData {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['product_name'] = this.productName;
data['is_active'] = this.isActive;
data['created_at'] = this.createdAt;
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['product_name'] = productName;
data['is_active'] = isActive;
data['created_at'] = createdAt;
return data;
}
}
@@ -310,11 +448,11 @@ class ActionData {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['is_active'] = this.isActive;
data['created_at'] = this.createdAt;
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['name'] = name;
data['is_active'] = isActive;
data['created_at'] = createdAt;
return data;
}
}
@@ -348,14 +486,14 @@ class UserData {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['first_name'] = this.firstName;
data['last_name'] = this.lastName;
data['user_name'] = this.userName;
data['profile_photo'] = this.profilePhoto;
data['is_active'] = this.isActive;
data['created_at'] = this.createdAt;
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['first_name'] = firstName;
data['last_name'] = lastName;
data['user_name'] = userName;
data['profile_photo'] = profilePhoto;
data['is_active'] = isActive;
data['created_at'] = createdAt;
return data;
}
}
@@ -374,10 +512,10 @@ class Products {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['created_at'] = this.createdAt;
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
data['created_at'] = createdAt;
return data;
}
}
@@ -423,18 +561,18 @@ class ContentByteVideo {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['content_type'] = this.contentType;
data['title'] = this.title;
data['description'] = this.description;
data['tags'] = this.tags;
data['file'] = this.file;
data['category_id'] = this.categoryId;
data['image'] = this.image;
data['is_active'] = this.isActive;
data['created_at'] = this.createdAt;
data['link'] = this.link;
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['content_type'] = contentType;
data['title'] = title;
data['description'] = description;
data['tags'] = tags;
data['file'] = file;
data['category_id'] = categoryId;
data['image'] = image;
data['is_active'] = isActive;
data['created_at'] = createdAt;
data['link'] = link;
return data;
}
}