2024-09-06 06:30:31 +00:00
import ' dart:convert ' ;
import ' dart:io ' ;
import ' package:dio/dio.dart ' ;
import ' package:dio/io.dart ' ;
import ' package:flutter/services.dart ' ;
2024-10-07 12:45:45 +00:00
import ' package:konectar_events/model/affiliationsmodel.dart ' ;
2024-12-09 09:05:56 +00:00
import ' package:konectar_events/model/allsessionnotesmodel.dart ' ;
2024-12-10 09:36:43 +00:00
import ' package:konectar_events/model/api_constants_model.dart ' ;
2024-12-03 05:59:45 +00:00
import ' package:konectar_events/model/events_details.dart ' ;
2024-11-19 12:57:30 +00:00
import ' package:konectar_events/model/events_list_resp_2.dart ' ;
2024-12-03 05:59:45 +00:00
import ' package:konectar_events/model/events_speakers_k1.dart ' ;
2024-09-06 06:30:31 +00:00
import ' package:konectar_events/model/eventsdetailmodel.dart ' ;
import ' package:konectar_events/model/eventsmodel.dart ' ;
2024-10-07 12:45:45 +00:00
import ' package:konectar_events/model/eventsoverview.dart ' ;
2024-11-19 12:57:30 +00:00
import ' package:konectar_events/model/eventspeakers.dart ' ;
2024-12-10 09:36:43 +00:00
import ' package:konectar_events/model/hive_api_constants.dart ' ;
2024-09-06 06:30:31 +00:00
import ' package:konectar_events/model/keywords_model.dart ' ;
import ' package:konectar_events/model/neweventsmodel.dart ' ;
import ' package:konectar_events/model/scope_model.dart ' ;
import ' package:konectar_events/model/sessionnotesmodel.dart ' ;
2024-12-03 05:59:45 +00:00
import ' package:konectar_events/model/sessionstopics_model.dart ' ;
2024-10-07 12:45:45 +00:00
import ' package:konectar_events/model/specialtymodel.dart ' ;
2024-09-06 06:30:31 +00:00
import ' package:konectar_events/model/topics_cloud_model.dart ' ;
2024-12-16 11:26:32 +00:00
import ' package:konectar_events/model/verify_user_resp.dart ' ;
2024-09-06 06:30:31 +00:00
import ' package:konectar_events/utils/constants.dart ' ;
2024-12-10 09:36:43 +00:00
import ' package:konectar_events/viewmodel/hive_repository.dart ' ;
2024-12-16 11:26:32 +00:00
import ' package:shared_preferences/shared_preferences.dart ' ;
2024-12-18 04:39:20 +00:00
import ' package:http/http.dart ' as http ;
2024-09-06 06:30:31 +00:00
class ApiCall {
final dio = Dio ( ) ;
2024-12-16 11:26:32 +00:00
final Future < SharedPreferences > _prefs = SharedPreferences . getInstance ( ) ;
late Future < String > _token ;
2024-12-18 04:39:20 +00:00
String newtoken =
" eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZWNyZXRlVG9rZW4iOiJiYjNmOTZmYmI5Y2U3ZjA2ZTliOTlkMzRiMGM3YjZkZTBlNjBmYWYzYmM1NDFhZjY0MGQ5ZjAzMGRlNzMxOWM4ZTAwZWNkMCIsImlhdCI6MTczNDM0OTUwNywiZXhwIjoxNzM0MzUxMzA3fQ.nN5XtgmWHVGGdyLEdICY6jTmlg1070rGFwsdyOd4CYY " ;
2024-11-19 12:57:30 +00:00
//K1 API CALLS
2024-09-06 06:30:31 +00:00
Future < dynamic > parseInfo ( ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . putUri (
Uri . parse (
' https://cardio-staging.konectar.io/nested_logins/verify_key ' ) ,
data: {
" key " :
" \$ 2a \$ 08 \$ u5DKCL4ir88CPKUhGFqbnuoXcibLZnxs/qi/48miKAuNJM/5.WGWy " ,
" email " : " scheepu@tikamobile.com " ,
" name " : " Scheepu " ,
} ) ;
print ( " response here " ) ;
print ( response . data . toString ( ) ) ;
return response . data ;
}
Future < List < Therapeutic > > getscopes ( ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
} ) ;
response = await dio . post (
' https://cardio-staging.konectar.io/reports/get_therepeutic_name ' ,
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
} ,
data: formData ) ;
print ( " response user settings here############### " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
ScopeModel scopeModel = ScopeModel . fromJson ( jsondata ) ;
List < Therapeutic > therapeuticList = scopeModel . therapeutics ;
print ( therapeuticList ) ;
return therapeuticList ;
}
Future < List < Keyword > > getkeywords ( String keyword ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap (
{ " user_email " : " vinodh@aissel.com " , " keyword " : keyword } ) ;
response = await dio . post (
' https://cardio-staging.konectar.io/identifications/search_term ' ,
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
} ,
data: formData ) ;
print ( " response user keywords here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
KeywordsModel keywordsModel = KeywordsModel . fromJson ( jsondata ) ;
print ( keywordsModel ) ;
List < Keyword > keywordList = keywordsModel . keyword ;
print ( keywordList [ 0 ] . name ) ;
return keywordList ;
}
2024-12-09 09:05:56 +00:00
Future < List < EventsList > > getEventsFromK1 ( { int ? type } ) async {
2024-10-07 12:45:45 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
2024-12-18 04:39:20 +00:00
String date = " 2024-12-17 " ;
var formData =
FormData . fromMap ( { " start " : date , " order_by " : 7 , ' type ' : type ? ? 1 } ) ;
2024-12-09 09:05:56 +00:00
// "end": DateTime(2024, 12, 14).toIso8601String(),
2024-12-16 11:26:32 +00:00
_token = _prefs . then ( ( SharedPreferences prefs ) {
return prefs . getString ( ' token ' ) ? ? " " ;
} ) ;
print ( " SAVED TOKEN : ${ await _token } " ) ;
2024-12-18 04:39:20 +00:00
try {
// dio.options.contentType = Headers.multipartFormDataContentType;
// dio.options.baseUrl = "https://cardio-staging.konectar.io/";
// dio.options.headers["Authorization"] = "Bearer ${newtoken}";
response = await dio . post (
' https://cardio-staging.konectar.io/apis/v1/events/loadFutureEvents/ ' ,
options: Options (
contentType: " multipart/form-data " ,
followRedirects: false ,
// will not throw errors
validateStatus: ( status ) = > true ,
headers: {
' Authorization ' : ' Bearer ${ newtoken } ' ,
} ) ,
data: formData ) ;
print ( " RESPONSE " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
2024-10-07 12:45:45 +00:00
2024-12-18 04:39:20 +00:00
EventsData eventresponse = EventsData . fromJson ( jsondata ) ;
List < EventsList > ? eventdata = eventresponse . events ;
return eventdata ! ;
} catch ( e ) {
print ( " EXCEPTION: ${ e . toString ( ) } " ) ;
}
print ( " response user eventssssss here!!!!!!!!!!!!!!!!!!!!! " ) ;
return [ ] ;
2024-10-07 12:45:45 +00:00
}
2024-11-19 12:57:30 +00:00
Future < dynamic > followUnfollowEvent ( String flag , String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap (
{ " user_email " : " vinodh@aissel.com " , " eid " : eventid , " flag " : flag } ) ;
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . followUnfollowEvent } ' ,
2024-11-19 12:57:30 +00:00
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
" eid " : eventid ,
" flag " : flag ,
} ,
data: formData ) ;
print ( " response user FOLLOW UNFOLLOW here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
return response . data . toString ( ) ;
}
Future < dynamic > attendNotAttendEvent ( String flag , String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap (
{ " user_email " : " vinodh@aissel.com " , " eid " : eventid , " flag " : flag } ) ;
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . attendNotAttendEvent } ' ,
2024-11-19 12:57:30 +00:00
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
" eid " : eventid ,
" flag " : flag ,
} ,
data: formData ) ;
print ( " response user FOLLOW UNFOLLOW here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
return response . data . toString ( ) ;
}
Future < List < Specialty > > specialtyOfSpeakers ( {
required String eventid ,
required String startDate ,
required String endDate ,
2024-12-09 09:05:56 +00:00
required bool client ,
2024-11-19 12:57:30 +00:00
} ) async {
2024-12-09 09:05:56 +00:00
print (
" FORMAT_CHECK_DATE $ startDate $ endDate $ eventid ${ DateTime ( 2024 , 12 , 03 ) . toIso8601String ( ) } " ) ;
2024-10-07 12:45:45 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
2024-12-03 05:59:45 +00:00
//ventId=4937&type='1'&sd=2024-07-30&ed=2024-08-03&user_email=vinodh@aissel.com
2024-12-09 09:05:56 +00:00
var formData ;
if ( client ) {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" eventId " : eventid ,
" sd " : startDate ,
" ed " : endDate ,
" type " : 1 ,
" chart_type " : " client "
} ) ;
} else {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" eventId " : eventid ,
" sd " : startDate ,
" ed " : endDate ,
} ) ;
}
2024-11-19 12:57:30 +00:00
print ( " FORMDATA: ${ formData . toString ( ) } , $ startDate , $ endDate " ) ;
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . specialtyOfSpeakers } ' ,
2024-10-07 12:45:45 +00:00
options: Options ( ) ,
2024-11-19 12:57:30 +00:00
data: formData ) ;
print ( " response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! " ) ;
2024-12-09 09:05:56 +00:00
2024-11-19 12:57:30 +00:00
// Map<String, dynamic> jsondata = json.decode(response.data);
// Specialtyresp resp = Specialtyresp.fromJson(jsondata);
2024-12-09 09:05:56 +00:00
List < Specialty > sdata = [ ] ;
if ( response . data ! = " null " ) {
print ( response . data . toString ( ) ) ;
sdata = specialtyFromJson ( response . data . toString ( ) ) ;
}
return sdata ;
2024-11-19 12:57:30 +00:00
}
2024-12-09 09:05:56 +00:00
Future < List < TopicsCloudData > > insightsTopicsCloud (
{ required String eventid ,
required String startDate ,
required String endDate ,
required bool client } ) async {
2024-11-19 12:57:30 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
2024-12-09 09:05:56 +00:00
var formData ;
if ( client ) {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" eventId " : eventid ,
" sd " : startDate ,
" ed " : endDate ,
" type " : 1 ,
" chart_type " : " client "
} ) ;
} else {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" eventId " : eventid ,
" sd " : startDate ,
" ed " : endDate ,
} ) ;
}
2024-11-19 12:57:30 +00:00
print ( " FORMDATA: ${ formData . toString ( ) } , $ startDate , $ endDate " ) ;
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . insightsTopicsCloud } ' ,
2024-11-19 12:57:30 +00:00
options: Options ( ) ,
2024-10-07 12:45:45 +00:00
data: formData ) ;
2024-11-19 12:57:30 +00:00
print ( " response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! " ) ;
2024-12-09 09:05:56 +00:00
2024-11-19 12:57:30 +00:00
// Map<String, dynamic> jsondata = json.decode(response.data);
// Specialtyresp resp = Specialtyresp.fromJson(jsondata);
2024-12-09 09:05:56 +00:00
List < TopicsCloudData > data = [ ] ;
if ( response . data ! = " null " ) {
print ( response . data . toString ( ) ) ;
TopicCloudResponse topicCloudResponse =
topicCloudResponseFromJson ( response . data ) ;
data = topicCloudResponse . resultData ! ;
}
2024-11-19 12:57:30 +00:00
return data ;
}
2024-12-09 09:05:56 +00:00
Future < Affiliations > insightsBarChart (
{ required String eventid ,
required String startDate ,
required String endDate ,
required bool client } ) async {
2024-11-19 12:57:30 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
2024-12-09 09:05:56 +00:00
var formData ;
if ( client ) {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" eventId " : eventid ,
" sd " : startDate ,
" ed " : endDate ,
" type " : 1 ,
" chart_type " : " client "
} ) ;
} else {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" eventId " : eventid ,
" sd " : startDate ,
" ed " : endDate ,
} ) ;
}
2024-11-19 12:57:30 +00:00
print ( " FORMDATA: ${ formData . toString ( ) } , $ startDate , $ endDate " ) ;
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . insightsBarChart } ' ,
2024-11-19 12:57:30 +00:00
options: Options ( ) ,
data: formData ) ;
print ( " response SPECIALTY SPEAKERS here!!!!!!!!!!!!!!!!!!!!! " ) ;
2024-12-09 09:05:56 +00:00
2024-11-19 12:57:30 +00:00
// Map<String, dynamic> jsondata = json.decode(response.data);
// Specialtyresp resp = Specialtyresp.fromJson(jsondata);
2024-12-09 09:05:56 +00:00
Affiliations data =
Affiliations ( affiliationCount: [ ] , affiliationNames: [ ] ) ;
if ( response . data ! = " null " ) {
print ( response . data . toString ( ) ) ;
data = affiliationsResponseFromJson ( response . data ) ;
}
2024-11-19 12:57:30 +00:00
return data ;
}
2024-12-03 05:59:45 +00:00
Future < EventsOverviewData > getEventsOverview (
2024-11-19 12:57:30 +00:00
String eventid , String startDate , String endDate ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" event_id " : eventid ,
} ) ;
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . eventdetailsapi } ' ,
2024-11-19 12:57:30 +00:00
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
2024-12-03 05:59:45 +00:00
" event_id " : eventid ,
2024-11-19 12:57:30 +00:00
} ,
data: formData ) ;
print ( " response user eventssssss here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
2024-12-03 05:59:45 +00:00
EventsOverviewDetails ? eventdata = EventsOverviewDetails . fromJson ( jsondata ) ;
EventsOverviewData overviewData = eventdata . data ! ;
2024-11-19 12:57:30 +00:00
return overviewData ;
}
2024-12-03 05:59:45 +00:00
Future < List < EventSpeakersData > > getEventsSpeakersFromK1 (
String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" event_id " : eventid ,
2024-12-09 09:05:56 +00:00
" project_id " : 1 ,
2024-12-03 05:59:45 +00:00
} ) ;
2024-12-09 09:05:56 +00:00
// "sd": "2024-07-30",
// "ed": "2024-08-03",
2024-12-03 05:59:45 +00:00
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . speakerslistapi } ' ,
2024-12-03 05:59:45 +00:00
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
" event_id " : eventid ,
} ,
data: formData ) ;
print ( " response user eventssssss here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
EventSpeakersResponse ? eventdata = EventSpeakersResponse . fromJson ( jsondata ) ;
List < EventSpeakersData > data = eventdata . data ! ;
return data ;
}
Future < List < SessionsTopicsData > > getSessionsTopics (
String eventid , String kolid , String kid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
print ( " formdata : eventid: $ eventid kolid: $ kolid kid: $ kid " ) ;
var formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
2024-12-09 09:05:56 +00:00
" event_id " : eventid ,
2024-12-03 05:59:45 +00:00
" kol_id " : kolid ,
" k_id " : kid ,
} ) ;
2024-12-09 09:05:56 +00:00
// "proj_kol_id": 0,
2024-12-03 05:59:45 +00:00
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . showEventsTopicsAndSession } ' ,
2024-12-03 05:59:45 +00:00
options: Options ( ) ,
queryParameters: {
" user_email " : " vinodh@aissel.com " ,
" event_id " : eventid ,
} ,
data: formData ) ;
print ( " response user SESSIONTOPICS here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
2024-12-09 09:05:56 +00:00
// Map<String, dynamic> jsondata = json.decode(response.data)[0];
// SessionTopicsResponse sessionTopicsResponse =
// SessionTopicsResponse.fromJson(jsondata);
List < SessionsTopicsData > data =
SessionsTopicsDataFromJson ( response . data . toString ( ) ) ;
2024-12-03 05:59:45 +00:00
return data ;
}
2024-12-09 09:05:56 +00:00
Future < dynamic > addSessionNotes (
String eventid ,
String kolid ,
String event_attendees_id ,
String kid ,
String notes ,
String ? filepath ,
String ? filename ,
String ? noteId ) async {
2024-12-03 05:59:45 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
2024-12-09 09:05:56 +00:00
var formData ;
2024-12-03 05:59:45 +00:00
Response response ;
2024-12-09 09:05:56 +00:00
if ( filename ! = " " ) {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" kol_events_id " : eventid ,
" kol_id " : kolid ,
" event_attendees_id " : event_attendees_id ,
" note " : notes ,
" file " : MultipartFile . fromFileSync ( filepath ! , filename: filename ) ,
" id " : noteId ? ? " " ,
} ) ;
} else {
formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" kol_events_id " : eventid ,
" kol_id " : kolid ,
" event_attendees_id " : event_attendees_id ,
" note " : notes ,
" id " : noteId ? ? " " ,
} ) ;
}
// "/Users/aissel/Library/Developer/CoreSimulator/Devices/1E435121-7E65-45C6-9E0B-411C8B9915F5/data/Containers/Data/Application/3CBC1CFF-79AD-49FA-A6E0-13D0AA2959D2/tmp/Flutter Questionaire.pdf",
2024-12-03 05:59:45 +00:00
response = await dio . post (
2024-12-09 09:05:56 +00:00
' ${ EventsConstants . url } ${ EventsConstants . saveEventsTopicNote } ' ,
2024-12-03 05:59:45 +00:00
options: Options ( ) ,
data: formData ) ;
print ( " response user ADDSESSION here!!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
// SessionTopicsResponse sessionTopicsResponse =
// SessionTopicsResponse.fromJson(jsondata);
// List<SessionsTopicsData> data = sessionTopicsResponse.data!;
return jsondata ;
}
2024-12-09 09:05:56 +00:00
Future < List < AllSessionNotesResponse > > getAllSessionNotes (
String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap ( {
" user_email " : " vinodh@aissel.com " ,
" kol_events_id " : eventid ,
} ) ;
// "proj_kol_id": 0,
response = await dio . post (
' ${ EventsConstants . url } ${ EventsConstants . eventUserAnalytics } ' ,
options: Options ( ) ,
data: formData ) ;
print ( " response user ALLSESSIONNOTES here!!!!!!!!!!!!!!!!!!!!! " ) ;
List < AllSessionNotesResponse > data = [ ] ;
if ( response . data ! = " null " ) {
print ( response . data . toString ( ) ) ;
// Map<String, dynamic> jsondata = json.decode(response.data)[0];
// SessionTopicsResponse sessionTopicsResponse =
// SessionTopicsResponse.fromJson(jsondata);
data = AllSessionNotesResponseFromJson ( response . data . toString ( ) ) ;
}
return data ;
}
2024-12-10 09:36:43 +00:00
//LOCAL API CONSTANTS
Future < dynamic > fetchApiConstants ( ) async {
dynamic jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/api_constants.json " ) ) ;
//dynamic jsonResult = await MockApiCall().getConfigDataMedical();
List < ApiConstantsResponse > responseData =
apiConstantsResponseFromJson ( jsonResult ) ;
print ( ' Response_data_is: $ responseData ' ) ;
List < ApiConstantsResponse > eventslist = responseData
. where (
( element ) = > element . module = = EventsConstants . moduleName ,
)
. toList ( ) ;
List < HiveApiConstants > hiveApiConstantsList = [ ] ;
if ( eventslist . isNotEmpty ) {
for ( ApiConstantsResponse obj in eventslist ) {
HiveApiConstants hiveApiConstants = HiveApiConstants (
functionName: obj . api ,
interval: obj . interval ,
method: obj . method ,
module: obj . module ) ;
hiveApiConstantsList . add ( hiveApiConstants ) ;
}
}
print ( " APICONST LIST LENGTH: ${ hiveApiConstantsList . length } " ) ;
if ( hiveApiConstantsList . isNotEmpty ) {
HiveOperations . saveApiConstants ( hiveApiConstantsList ) ;
}
}
2024-12-16 11:26:32 +00:00
//VERIFY EMAIL K1
Future < dynamic > verifyEmail (
2024-12-18 04:39:20 +00:00
String url , String email , String deviceid , String platform ) async {
2024-12-16 11:26:32 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap ( {
" email_id " : email ,
" device_id " : deviceid ,
} ) ;
2024-12-18 04:39:20 +00:00
try {
response = await dio . post (
' ${ url } ${ EventsConstants . loginmodule } / ${ EventsConstants . getVerificationCode } ' ,
options: Options ( ) ,
data: formData ) ;
if ( response . statusCode = = 200 ) {
print ( " response user login!!!!!!!!!!!!!!!!!!!!! \n ${ response . data } " ) ;
//Map<String, dynamic> jsondata = json.decode(response.data);
VerificationResponse verificationResponse =
verificationResponseFromJson ( response . data ) ;
return verificationResponse ;
} else {
print ( " isEmpty " ) ;
return null ;
}
} catch ( e ) {
2024-12-16 11:26:32 +00:00
VerificationResponse verificationResponse =
2024-12-18 04:39:20 +00:00
VerificationResponse ( status: 1401 , message: " Invalid Domain " ) ;
2024-12-16 11:26:32 +00:00
return verificationResponse ;
}
}
//VERIFY CODE OR LOGIN
Future < dynamic > verifyCode ( String email , String code ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = FormData . fromMap ( {
" verification_code " : code ,
" email_id " : email ,
} ) ;
response = await dio . post (
' ${ EventsConstants . loginUrl } ${ EventsConstants . login } ' ,
options: Options ( ) ,
data: formData ) ;
if ( response . statusCode = = 200 ) {
print ( " response user login!!!!!!!!!!!!!!!!!!!!! \n ${ response . data } " ) ;
Map < String , dynamic > jsondata = json . decode ( response . data ) ;
VerificationResponse verificationResponse =
verificationResponseFromJson ( response . data ) ;
return verificationResponse ;
} else {
print ( " isEmpty " ) ;
return null ;
}
}
//LOGOUT
Future < dynamic > logout ( String email , String deviceid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
2024-12-18 04:39:20 +00:00
print ( " email : $ email ,device : $ deviceid " ) ;
_token = _prefs . then ( ( SharedPreferences prefs ) {
return prefs . getString ( ' token ' ) ? ? " " ;
} ) ;
2024-12-16 11:26:32 +00:00
Response response ;
2024-12-18 04:39:20 +00:00
print ( " url : ${ EventsConstants . loginUrl } ${ EventsConstants . logout } / " ) ;
2024-12-16 11:26:32 +00:00
var formData = FormData . fromMap ( {
" email_id " : email ,
" device_id " : deviceid ,
} ) ;
response = await dio . post (
' ${ EventsConstants . loginUrl } ${ EventsConstants . logout } ' ,
2024-12-18 04:39:20 +00:00
options: Options (
contentType: " application/x-www-form-urlencoded " ,
followRedirects: false ,
// will not throw errors
validateStatus: ( status ) = > true ,
headers: { " Authorization " : " Bearer $ _token " } ) ,
2024-12-16 11:26:32 +00:00
data: formData ,
// queryParameters: {
// "token": token,
// },
) ;
if ( response . statusCode = = 200 ) {
print ( " response user LoGOUT!!!!!!!!!!!!!!!!!!!!! \n ${ response . data } " ) ;
}
print ( response . data . toString ( ) ) ;
return response . data ;
}
2024-11-19 12:57:30 +00:00
//************ K2 API CALLS ***********************************************************************************************************************************
Future < List < EventsList > > getEventsFromK2 ( int page , String search ,
{ String ? startdate , String ? enddate } ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData ;
if ( startdate ! = " " ) {
formData = {
" page " : page ,
" limit " : 20 ,
" start_date " : startdate ,
" end_date " : enddate ,
} ;
} else {
formData = {
" page " : page ,
" limit " : 20 ,
" conditions " : [
{ " field " : " event_name " , " type " : " like " , " value " : search }
]
} ;
}
response = await dio . post ( ' ${ EventsConstants . eventslistapifromk2 } ' ,
options: Options ( headers: {
" Authorization " :
" Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a " ,
HttpHeaders . contentTypeHeader: " application/json " ,
} ) ,
// queryParameters: {
// "page": page,
// "limit": 20,
// // "id": "11c39192480587d2d6213bfef6744571",
// "conditions": jsonEncode([
// {"field": eventfield, "type": "like", "value": searchkey}
// ])
// },
data: formData ) ;
2024-10-07 12:45:45 +00:00
if ( response . statusCode = = 200 ) {
2024-11-19 12:57:30 +00:00
print ( " response EVENTS!!!!!!!!!!!!!!!!!!!! " ) ;
2024-10-07 12:45:45 +00:00
print ( response . data . toString ( ) ) ;
2024-11-19 12:57:30 +00:00
Map < String , dynamic > jsondata = response . data ;
EventsListRespK2 eventresponse = EventsListRespK2 . fromJson ( jsondata ) ;
List < EventsList > ? eventdata = eventresponse . data ;
return eventdata ! ;
2024-10-07 12:45:45 +00:00
} else {
2024-11-19 12:57:30 +00:00
print ( " isEmpty " ) ;
return [ ] ;
}
}
Future < List < EventsList > > getMyEventsFromK2 ( int page , String search ,
{ String ? startdate , String ? enddate } ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData ;
if ( startdate ! = " " ) {
formData = {
" page " : page ,
" limit " : 20 ,
" id " : " 11c39192480587d2d6213bfef6744571 " ,
" start_date " : startdate ,
" end_date " : enddate ,
} ;
} else {
formData = {
" page " : page ,
" limit " : 20 ,
" id " : " 11c39192480587d2d6213bfef6744571 " ,
" conditions " : [
{ " field " : " event_name " , " type " : " like " , " value " : search }
]
} ;
}
response = await dio . post ( ' ${ EventsConstants . eventslistapifromk2 } ' ,
options: Options ( headers: {
" Authorization " :
" Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a " ,
HttpHeaders . contentTypeHeader: " application/json " ,
} ) ,
// queryParameters: {
// "page": page,
// "limit": 20,
// // "id": "11c39192480587d2d6213bfef6744571",
// "conditions": jsonEncode([
// {"field": eventfield, "type": "like", "value": searchkey}
// ])
// },
data: formData ) ;
if ( response . statusCode = = 200 ) {
print ( " response MY EVENTS!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = response . data ;
EventsListRespK2 eventresponse = EventsListRespK2 . fromJson ( jsondata ) ;
List < EventsList > ? eventdata = eventresponse . data ;
return eventdata ! ;
} else {
print ( " isEmpty " ) ;
return [ ] ;
2024-10-07 12:45:45 +00:00
}
}
2024-11-19 12:57:30 +00:00
//ADD TO FAVS
Future < String > addEventsToFav ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
' ${ EventsConstants . addToMyEventsApi } ' ,
options: Options ( headers: {
" Authorization " :
" Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a "
} ) ,
queryParameters: {
" event_id " : eventid ,
" user_id " : " 11c39192480587d2d6213bfef6744571 " ,
} ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . toString ( ) ) ;
String message = jsondata [ " message " ] ;
print ( " *** $ message " ) ;
return message ;
}
//REMOVE FROM FAVS
Future < String > removeEventsFromFav ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
' ${ EventsConstants . removeFromMyEventsApi } ' ,
options: Options ( headers: {
" Authorization " :
" Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a " ,
} ) ,
queryParameters: {
" event_id " : eventid ,
" user_id " : " 11c39192480587d2d6213bfef6744571 " ,
} ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . toString ( ) ) ;
String message = jsondata [ " message " ] ;
print ( " *** $ message " ) ;
return message ;
}
//GET MY EVENTS
//SEARCH EVENTS API FROM K2
Future < List < EventsList > > getSearchedEventsFromK2 (
int page , String eventfield , String searchkey ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = {
" page " : page ,
" limit " : 20 ,
" conditions " : [
{ " field " : eventfield , " type " : " like " , " value " : searchkey }
]
} ;
response = await dio . post ( ' ${ EventsConstants . eventslistapifromk2 } ' ,
options: Options ( headers: {
" Authorization " :
" Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a " ,
HttpHeaders . contentTypeHeader: " application/json " ,
} ) ,
// queryParameters: {
// "page": page,
// "limit": 20,
// // "id": "11c39192480587d2d6213bfef6744571",
// "conditions": jsonEncode([
// {"field": eventfield, "type": "like", "value": searchkey}
// ])
// },
data: formData ) ;
if ( response . statusCode = = 200 ) {
print ( " response SEARCH EVENTS!!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = response . data ;
EventsListRespK2 eventresponse = EventsListRespK2 . fromJson ( jsondata ) ;
List < EventsList > ? eventdata = eventresponse . data ;
return eventdata ! ;
} else {
print ( " isEmpty " ) ;
return [ ] ;
}
}
//SPEAKERS LIST FROM K2
Future < Map < String , Object ? > > getSpeakersFromK2 (
int page , String eventid , String event_unique_id ,
{ String ? searchkey } ) async {
Dio dio = Dio ( ) ;
print ( " see pages^^^^^^^ : $ page " ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = {
" page " : page ,
" limit " : 40 ,
2024-12-03 05:59:45 +00:00
" id " : " da8cb02cdeddd174bf0fd0ae08247ca1 " ,
" event_id " : " 1a0029ea72bf4adc5e6bbfd91ace364a " ,
2024-11-19 12:57:30 +00:00
" hcp_full_name " : searchkey
// "conditions": [
// {"field": eventfield, "type": "like", "value": searchkey}
// ]
} ;
response = await dio . post ( ' ${ EventsConstants . speakerslistapifromk2 } ' ,
options: Options ( headers: {
" Authorization " :
" Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a " ,
HttpHeaders . contentTypeHeader: " application/json " ,
} ) ,
// queryParameters: {
// "page": page,
// "limit": 20,
// // "id": "11c39192480587d2d6213bfef6744571",
// "conditions": jsonEncode([
// {"field": eventfield, "type": "like", "value": searchkey}
// ])
// },
data: formData ) ;
if ( response . statusCode = = 200 ) {
print ( " respons Speakers !!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = response . data ;
SpeakersResponse resp = SpeakersResponse . fromJson ( jsondata ) ;
List < SpeakersList > ? data = resp . data ;
var respdata = { " count " : resp . count , " list " : data ? ? [ ] } ;
return respdata ;
} else {
print ( " isEmpty " ) ;
return { } ;
}
}
//************ OTHER API CALLS ***********************************************************************************************************************************
Future < dynamic > dummyapi ( ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . get ( ' http://203.129.219.14:3043/weather?city=London ' ,
options: Options ( ) ) ;
print ( " response PLATFORMATIC here " ) ;
print ( response . data . toString ( ) ) ;
return response . data ;
}
//https://cardio-staging.konectar.io/notifications/list_all_notifications
Future < dynamic > listnotifications ( ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
' https://cardio-staging.konectar.io/requested_kols/list_my_pending_approvals/ ' ,
options: Options (
followRedirects: false ,
validateStatus: ( status ) {
return status ! < 500 ;
} ,
headers: { ' Content-type ' : ' application/json; charset=UTF-8 ' } ) ,
data: { " rows " : " 10 " , " page " : " 1 " , " sidx " : " name " , " sord " : " desc " } ) ;
print ( " response user settings here " ) ;
print ( response . data . toString ( ) ) ;
return response . data ;
}
2024-09-06 06:30:31 +00:00
Future < List < EventsList > ? > getEvents ( ) async {
2024-10-07 12:45:45 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
2024-09-06 06:30:31 +00:00
2024-10-07 12:45:45 +00:00
response = await dio . post (
' http://192.168.2.109:8007/api/method/events_list_api ' ,
//'${Constants.domainUrl}eventsapi.api.getEventsList',
options: Options ( ) ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
// dynamic jsonResult =
// jsonDecode(await rootBundle.loadString("assets/eventsnew.json"));
2024-09-06 06:30:31 +00:00
// Map<String, dynamic> jsondata = json.decode(jsonResult.toString());
2024-10-07 12:45:45 +00:00
//dynamic json = jsonDecode(response.data.toString());
Map < String , dynamic > jsondata = response . data ;
2024-09-06 06:30:31 +00:00
EventsResp eventresponse = EventsResp . fromJson ( jsondata ) ;
EventsData ? eventdata = eventresponse . data ;
List < EventsList > ? eventList = eventdata ! . events ;
return eventList ;
}
Future < List < Eventsdetail > ? > getEventsDetail ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
2024-10-08 12:01:59 +00:00
' ${ EventsConstants . domainUrl } eventsdetail?eventid= $ eventid ' ,
2024-09-06 06:30:31 +00:00
options: Options ( ) ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . toString ( ) ) ;
EventsDetailResp eventresponse = EventsDetailResp . fromJson ( jsondata ) ;
EventsDetailData ? eventdata = eventresponse . data ;
List < Eventsdetail > ? eventsdetailList = eventdata ! . eventsdetail ;
return eventsdetailList ;
}
Future < String > attendEvents ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
2024-10-08 12:01:59 +00:00
' ${ EventsConstants . domainUrl } eventsapi.api.attendingEvents?eventid= $ eventid ' ,
2024-09-06 06:30:31 +00:00
options: Options ( ) ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . toString ( ) ) ;
String message = jsondata [ " message " ] ;
print ( " *** $ message " ) ;
return message ;
}
Future < List < EventsList > ? > getLocalEvents ( ) async {
// Dio dio = Dio();
// (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
// (HttpClient client) {
// client.badCertificateCallback =
// (X509Certificate cert, String host, int port) => true;
// return client;
// };
// Response response;
// response = await dio.post(
// //'http://192.168.2.109:8007/api/method/events_list_api',
// '${Constants.domainUrl}eventsapi.api.getEventsList',
// options: Options(),
// );
// print("response user keywords here########## ");
// print(response.data.toString());
dynamic jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/eventsnew.json " ) ) ;
// Map<String, dynamic> jsondata = json.decode(jsonResult.toString());
Map < String , dynamic > jsondata = jsonResult ;
EventsResp eventresponse = EventsResp . fromJson ( jsondata ) ;
EventsData ? eventdata = eventresponse . data ;
List < EventsList > ? eventList = eventdata ! . events ;
return eventList ;
}
Future < List < Eventsdetail > ? > getLocalEventsDetail ( String eventid ) async {
2024-10-07 12:45:45 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
2024-09-06 06:30:31 +00:00
2024-10-07 12:45:45 +00:00
response = await dio . post (
' http://192.168.2.109:8007/api/method/eventsmethod?eventid= $ eventid ' ,
options: Options ( ) ,
) ;
print ( " response user detailssssss here########## " ) ;
print ( response . data . toString ( ) ) ;
2024-09-06 06:30:31 +00:00
dynamic jsonResult ;
print ( " eventid: ${ eventid } " ) ;
// if (eventid == "140846") {
try {
jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/ed ${ eventid } .json " ) ) ;
} catch ( e ) {
jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/eventsdetail2.json " ) ) ;
}
// }
// else {
// jsonResult =
// jsonDecode(await rootBundle.loadString("assets/eventsdetail2.json"));
// }
//Map<String, dynamic> jsondata = json.decode(response.toString());
2024-10-07 12:45:45 +00:00
Map < String , dynamic > jsondata = response . data ;
2024-09-06 06:30:31 +00:00
EventsDetailResp eventresponse = EventsDetailResp . fromJson ( jsondata ) ;
EventsDetailData ? eventdata = eventresponse . data ;
List < Eventsdetail > ? eventsdetailList = eventdata ! . eventsdetail ;
return eventsdetailList ;
}
Future < String > addLocalEventsToFav ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
2024-10-08 12:01:59 +00:00
' ${ EventsConstants . domainUrl } eventsapi.api.addEventsToFav?eventid= $ eventid ' ,
2024-09-06 06:30:31 +00:00
options: Options ( ) ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . toString ( ) ) ;
String message = jsondata [ " message " ] ;
print ( " *** $ message " ) ;
return message ;
}
Future < String > attendLocalEvents ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
response = await dio . post (
2024-10-08 12:01:59 +00:00
' ${ EventsConstants . domainUrl } eventsapi.api.attendingEvents?eventid= $ eventid ' ,
2024-09-06 06:30:31 +00:00
options: Options ( ) ,
) ;
print ( " response user keywords here########## " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = json . decode ( response . toString ( ) ) ;
String message = jsondata [ " message " ] ;
print ( " *** $ message " ) ;
return message ;
}
//GET SESSION NOTES ADDED
Future < List < SessionNotesModel > ? > getSessionNotes ( ) async {
// Dio dio = Dio();
// (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate =
// (HttpClient client) {
// client.badCertificateCallback =
// (X509Certificate cert, String host, int port) => true;
// return client;
// };
2024-10-07 12:45:45 +00:00
// Response response3;
2024-09-06 06:30:31 +00:00
2024-10-07 12:45:45 +00:00
// response3 = await dio.post(
// 'http://192.168.2.109:8007/api/method/tagclouds?message=129934',
// // '${Constants.domainUrl}eventsapi.api.getEventsList',
2024-09-06 06:30:31 +00:00
// options: Options(),
// );
// print("response user keywords here########## ");
2024-10-07 12:45:45 +00:00
// print(response3.data.toString());
2024-09-06 06:30:31 +00:00
dynamic jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/topicnotes.json " ) ) ;
// Map<String, dynamic> jsondata = json.decode(jsonResult.toString());
Map < String , dynamic > jsondata = jsonResult ;
2024-10-07 12:45:45 +00:00
NotesResp response2 = NotesResp . fromJson ( jsondata ) ;
NotesData ? data = response2 . data ;
2024-09-06 06:30:31 +00:00
List < SessionNotesModel > ? eventList = data ! . events ;
return eventList ;
}
//TOPICS CLOUD
Future < List < TopicsCloudData > ? > getTopicsCloudData ( String eventid ) async {
2024-10-07 12:45:45 +00:00
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response3 ;
response3 = await dio . post (
' http://192.168.2.109:8007/api/method/tagclouds?message= $ eventid ' ,
// '${Constants.domainUrl}eventsapi.api.getEventsList',
options: Options ( ) ,
) ;
print ( " response user cloudsssss here########## " ) ;
print ( response3 . data . toString ( ) ) ;
2024-09-06 06:30:31 +00:00
dynamic jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/tagclouds.json " ) ) ;
// Map<String, dynamic> jsondata = json.decode(jsonResult.toString());
2024-10-07 12:45:45 +00:00
Map < String , dynamic > jsondata = response3 . data ;
// TopicsCloudResp response = TopicsCloudResp.fromJson(jsondata);
Topicsresp resp = Topicsresp . fromJson ( jsondata ) ;
List < TopicsCloudData > data = resp . data ;
// for (var obj in response.data!) {
// if (obj.keys.contains(eventid)) {
// data = obj[eventid]!;
// }
// }
return data ;
}
Future < List < Specialty > ? > getSpecialty ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response3 ;
response3 = await dio . post (
' http://192.168.2.109:8007/api/method/specialtyapi?eventid= $ eventid ' ,
// '${Constants.domainUrl}eventsapi.api.getEventsList',
options: Options ( ) ,
) ;
print ( " response user cloudsssss here########## " ) ;
print ( response3 . data . toString ( ) ) ;
dynamic jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/tagclouds.json " ) ) ;
// Map<String, dynamic> jsondata = json.decode(jsonResult.toString());
Map < String , dynamic > jsondata = response3 . data ;
// TopicsCloudResp response = TopicsCloudResp.fromJson(jsondata);
Specialtyresp resp = Specialtyresp . fromJson ( jsondata ) ;
List < Specialty > data = resp . data ;
// for (var obj in response.data!) {
// if (obj.keys.contains(eventid)) {
// data = obj[eventid]!;
// }
// }
return data ;
}
//http://192.168.2.109:8007/api/method/affiliationsapi?eventid=129934
Future < Affiliations ? > getSpeakerCounts ( String eventid ) async {
Dio dio = Dio ( ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response3 ;
response3 = await dio . post (
' http://192.168.2.109:8007/api/method/affiliationsapi?eventid= $ eventid ' ,
// '${Constants.domainUrl}eventsapi.api.getEventsList',
options: Options ( ) ,
) ;
print ( " response user cloudsssss here########## " ) ;
print ( response3 . data . toString ( ) ) ;
dynamic jsonResult =
jsonDecode ( await rootBundle . loadString ( " assets/tagclouds.json " ) ) ;
// Map<String, dynamic> jsondata = json.decode(jsonResult.toString());
Map < String , dynamic > jsondata = response3 . data ;
// TopicsCloudResp response = TopicsCloudResp.fromJson(jsondata);
AffiliationsResp resp = AffiliationsResp . fromJson ( jsondata ) ;
Affiliations data = resp . data ;
// for (var obj in response.data!) {
// if (obj.keys.contains(eventid)) {
// data = obj[eventid]!;
// }
// }
2024-09-06 06:30:31 +00:00
return data ;
}
2024-11-19 12:57:30 +00:00
Future < Map < String , Object ? > > getSpeakersFromLocal (
int page , String eventid , String event_unique_id ,
{ String ? searchkey } ) async {
Dio dio = Dio ( ) ;
print ( " see pages^^^^^^^ : $ page " ) ;
( dio . httpClientAdapter as IOHttpClientAdapter ) . onHttpClientCreate =
( HttpClient client ) {
client . badCertificateCallback =
( X509Certificate cert , String host , int port ) = > true ;
return client ;
} ;
Response response ;
var formData = {
" page " : page ,
" limit " : 40 ,
" id " : eventid ,
" event_id " : event_unique_id ,
" hcp_full_name " : searchkey
// "conditions": [
// {"field": eventfield, "type": "like", "value": searchkey}
// ]
} ;
response = await dio . post (
' ${ EventsConstants . speakerslistapifromLocal } ' ,
// options: Options(headers: {
// "Authorization":
// "Bearer 242|f4s7EfBjD01z1tuGeJfgKm7v2WzZk22uDOehqFyla72c481a",
// HttpHeaders.contentTypeHeader: "application/json",
// }),
// queryParameters: {
// "page": page,
// "limit": 20,
// // "id": "11c39192480587d2d6213bfef6744571",
// "conditions": jsonEncode([
// {"field": eventfield, "type": "like", "value": searchkey}
// ])
// },
// data: formData
) ;
if ( response . statusCode = = 200 ) {
print ( " respons Speakers !!!!!!!!!!!!!!!!!!!! " ) ;
print ( response . data . toString ( ) ) ;
Map < String , dynamic > jsondata = response . data ;
SpeakersResponse1 resp = SpeakersResponse1 . fromJson ( jsondata ) ;
List < SpeakersList > ? data = resp . data ! . data ;
var respdata = { " count " : 92 , " list " : data ? ? [ ] } ;
return respdata ;
} else {
print ( " isEmpty " ) ;
return { } ;
}
}
2024-09-06 06:30:31 +00:00
}