mobileApplicationsKonectarApp/lib/utils/apicall.dart

56 lines
1.8 KiB
Dart
Raw Normal View History

2024-01-04 07:06:37 +00:00
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
class ApiCall {
final dio = Dio();
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;
}
//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;
}
}