// ignore_for_file: unused_element import 'dart:async'; import 'dart:convert'; import 'dart:developer'; import 'package:flutter/foundation.dart'; import 'package:hub/features/notification/index.dart'; import 'package:hub/features/storage/index.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'api_manager.dart'; export 'api_manager.dart' show ApiCallResponse; const _kPrivateApiFunctionName = 'ffPrivateApiCall'; /// Start PHP Group Code abstract class Api { GetLicense getLicense = GetLicense(); } class PhpGroup extends Api { static String getBaseUrl() => 'https://freaccess.com.br/freaccess'; static Map headers = {}; static LoginCall loginCall = LoginCall(); static UpdToken updToken = UpdToken(); static RegisterCall registerCall = RegisterCall(); static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall(); static ChangePasswordCall changePasswordCall = ChangePasswordCall(); static GetLocalsCall getLocalsCall = GetLocalsCall(); static PostScheduleVisitorCall postScheduleVisitorCall = PostScheduleVisitorCall(); static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall(); static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall(); static GetDadosCall getDadosCall = GetDadosCall(); static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall(); static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall(); static PostProvVisitSchedulingCall postProvVisitSchedulingCall = PostProvVisitSchedulingCall(); static GetVisitsCall getVisitsCall = GetVisitsCall(); static DeleteVisitCall deleteVisitCall = DeleteVisitCall(); static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall(); static RespondeSolicitacaoCall respondeSolicitacaoCall = RespondeSolicitacaoCall(); static GetAccessCall getAccessCall = GetAccessCall(); static GetLiberationsCall getLiberationsCall = GetLiberationsCall(); static GetMessagesCall getMessagesCall = GetMessagesCall(); static ChangeNotifica changeNotifica = ChangeNotifica(); static UpdateIDE updateIDE = UpdateIDE(); static RespondeVinculo resopndeVinculo = RespondeVinculo(); static ChangePass changePass = ChangePass(); static ChangePanic changePanic = ChangePanic(); static DeleteAccount deleteAccount = DeleteAccount(); static CancelaVisita cancelaVisita = CancelaVisita(); static BuscaEnconcomendas buscaEnconcomendas = BuscaEnconcomendas(); static RegisterPet registerPet = RegisterPet(); static DeletePet deletePet = DeletePet(); static UpdatePet updatePet = UpdatePet(); static GetPets getPets = GetPets(); static GetPetPhoto getPetPhoto = GetPetPhoto(); static UnregisterDevice unregisterDevice = UnregisterDevice(); static GetVehiclesByProperty getVehiclesByProperty = GetVehiclesByProperty(); static GetResidentsByProperty getResidentsByProperty = GetResidentsByProperty(); static GetOpenedVisits getOpenedVisits = GetOpenedVisits(); GetLicense getLicense = GetLicense(); static GetProvSchedules getProvSchedules = GetProvSchedules(); } class GetProvSchedules { Future call(final String page, final String status) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getAgendamentoProv'; const String pageSize = '10'; final bool isFiltered = status != '' && status != '.*'; // const String baseUrl = 'http://localhost:3000'; return await ApiManager.instance.makeApiCall( callName: 'getProvSchedules', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: {'Content-Type': 'application/x-www-form-urlencoded'}, params: { if (isFiltered) 'status': status, 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'page': page, 'pageSize': pageSize, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class GetOpenedVisits { Future call(final String page) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getOpenedVisits'; const String pageSize = '10'; return await ApiManager.instance.makeApiCall( callName: 'getOpenedVisits', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: {'Content-Type': 'application/x-www-form-urlencoded'}, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'page': page, 'pageSize': pageSize, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class GetResidentsByProperty { Future call(final String page) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? ''; final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? ''; final String cliID = await StorageHelper().get(ProfileStorageKey.clientUUID.key) ?? ''; const String atividade = 'getResidentsByProperty'; const String pageSize = '10'; return await ApiManager.instance.makeApiCall( callName: 'getResidentsByProperty', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: {'Content-Type': 'application/x-www-form-urlencoded'}, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'page': page, 'pageSize': pageSize, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, alwaysAllowBody: false, ); } } class GetVehiclesByProperty { Future call(final String page) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getVehiclesByProperty'; const String pageSize = '10'; return await ApiManager.instance.makeApiCall( callName: 'getVehiclesByProperty', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: {'Content-Type': 'application/x-www-form-urlencoded'}, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'page': page, 'pageSize': pageSize, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, alwaysAllowBody: false, ); } static GetLicense getLicense = GetLicense(); } class GetLicense { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'getLicense', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': 'getLicenca', }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class UnregisterDevice { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'unregisterDevice', apiUrl: '$baseUrl/unregisterDevice.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class DeletePet { Future call({final int? petID = 0}) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'excluirPet'; return await ApiManager.instance.makeApiCall( callName: 'deletePet', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'petId': petID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class UpdatePet { Future call({ final int? petID, final String? image, final String? name, final String? species, final String? breed, final String? color, final String? birthdayDate, final String? gender, final String? size, final String? notes, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'atualizarPet'; return await ApiManager.instance.makeApiCall( callName: 'updatePet', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'id': petID, 'image': image, 'name': name, 'species': species, 'breed': breed, if (color != '') 'color': color, if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!), 'gender': gender, 'size': size, if (notes != '') 'notes': notes, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class GetPets { Future call({ final int? page, final int? pageSize, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'consultaPets'; return await ApiManager.instance.makeApiCall( callName: 'getPets', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'page': page, 'pageSize': pageSize, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, alwaysAllowBody: false, ); } } class GetPetPhoto { Future call({final int? petId}) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'consultaFotoPet'; return await ApiManager.instance.makeApiCall( callName: 'getPetPhoto', apiUrl: '$baseUrl/getImage.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'atividade': atividade, 'cliID': cliID, 'petId': petId, }, bodyType: BodyType.BLOB, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, ); } } class RegisterPet { Future call({ final String? image, final String? name, final String? species, final String? breed, final String? color, final String? birthdayDate, final String? gender, final String? size, final String? notes, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'cadastrarPet'; return await ApiManager.instance.makeApiCall( callName: 'registerPet', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'image': image, 'name': name, 'species': species, 'breed': breed, if (color != '') 'color': color, if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!), 'gender': gender, 'size': size, if (notes != '') 'notes': notes, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class BuscaEnconcomendas { Future call({ final String? page, final String? pageSize, final String? adresseeType, final String? status, }) async { final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getEncomendas'; final String baseUrl = PhpGroup.getBaseUrl(); return await ApiManager.instance.makeApiCall( callName: 'getEncomendas', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'atividade': atividade, 'cliID': cliID, 'page': page, 'pageSize': pageSize, 'adresseeType': adresseeType, 'status': status, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, alwaysAllowBody: false, ); } } class CancelaVisita { Future call({ final int? idDestino, final int? idVisita, final String? AccessKey, final String? UsuEmail, final String? DevDesc, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'cancelaVisita'; return await ApiManager.instance.makeApiCall( callName: 'cancelaVisita', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'atividade': atividade, 'cliID': cliID, 'idVisita': idVisita, 'AccessKey': AccessKey, 'UsuEmail': UsuEmail, 'DevDesc': DevDesc, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, alwaysAllowBody: false, ); } } class DeleteAccount { Future call() async { final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String baseUrl = PhpGroup.getBaseUrl(); return await ApiManager.instance.makeApiCall( callName: 'deleteAccount', apiUrl: '$baseUrl/deleteAccount.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class ChangePanic { Future call({ final String? newSenhaPanico, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( callName: 'changePass', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'newSenhaPanico': newSenhaPanico, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class ChangePass { Future call({ final String? newSenha, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( callName: 'changePass', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'newSenha': newSenha, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class RespondeVinculo { Future call({ final String? tarefa, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'respondeVinculo', apiUrl: '$baseUrl/responderVinculo.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'tarefa': tarefa, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class ChangeNotifica { Future call({ final String? notifica, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( callName: 'changeNotifica', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'notifica': notifica, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class UpdateIDE { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; final String newIde = (await StorageHelper().get(ProfileStorageKey.userDevUUID.key)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( callName: 'changeNotifica', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliUUID, 'atividade': atividade, 'newIde': newIde, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class UpdToken { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String token = (await StorageHelper().get(SecureStorageKey.token.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'updToken', apiUrl: '$baseUrl/updtoken.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'token': token, 'devid': devUUID, 'useruuid': userUUID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, alwaysAllowBody: false, ); } } class LoginCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; final String password = (await StorageHelper().get(SecureStorageKey.password.value)) ?? ''; final String type = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? ''; final String description = (await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ?? ''; late final String token; try { token = await FirebaseMessagingService.getToken(); if (token == 'null' || token.isEmpty) throw Exception('Token is empty'); } catch (e, s) { token = ''; log('Error getting token', error: e, stackTrace: s); LogUtil.requestAPIFailed('login.php', email, "Login", e, s); } return await ApiManager.instance.makeApiCall( callName: 'login', apiUrl: '$baseUrl/login.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'email': email.toLowerCase(), 'password': password, 'uuid': devUUID, 'token': token, 'tipo': type, 'descricao': description, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class RegisterCall { Future call({ required final String name, required final String email, required final String password, required final String token, required final String uuid, required final String tipo, required final String descricao, }) async { final String baseUrl = PhpGroup.getBaseUrl(); return await ApiManager.instance.makeApiCall( callName: 'register', apiUrl: '$baseUrl/registro.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'name': name, 'email': email.toLowerCase(), 'password': password, 'token': token, 'uuid': uuid, 'tipo': tipo, 'descricao': descricao, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class ChangePasswordCall { Future call({ required final String email, required final String token, required final String psswd, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'changePassword', apiUrl: '$baseUrl/alterarSenha.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'email': email, 'token': token, 'senha': psswd, 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class ForgotPasswordCall { Future call({ final String? email, }) async { final String baseUrl = PhpGroup.getBaseUrl(); return await ApiManager.instance.makeApiCall( callName: 'forgotPassword', apiUrl: '$baseUrl/iforgot.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'email': email, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class GetLocalsCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? ''; final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? ''; return await ApiManager.instance .makeApiCall( callName: 'getLocals', apiUrl: '$baseUrl/getLocais.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ) .timeout(const Duration(seconds: 30)); } List? locais(dynamic response) => getJsonField( response, r'''$.locais''', true, ) as List?; } class PostScheduleVisitorCall { Future call({ required final String documento, required final String nome, required final String tipo, required final String foto, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'putVisitante'; return await ApiManager.instance.makeApiCall( callName: 'postScheduleVisitor', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'Documento': documento, 'Nome': nome, 'Tipo': tipo, 'Foto': foto, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? errorMsg(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); } class PostScheduleVisitCall { Future call({ final String? devDesc, final String? idVisitante, final String? dtInicio, final String? dtFim, final String? unica, final int? idMotivo, final int? idNAC, final String? obs, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'putVisita'; return await ApiManager.instance.makeApiCall( callName: 'postScheduleVisit', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'idVisitante': idVisitante, 'dtInicio': dtInicio, 'dtFim': dtFim, 'unica': unica, 'idMotivo': idMotivo, 'idNAC': idNAC, 'Obs': obs, 'DevDesc': devDesc, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? errorMsg(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); } class GetScheduleVisitCall { Future call({ final int? pageSize, final int? pageNumber, final String? chaveBusca, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getVisitas'; return await ApiManager.instance.makeApiCall( callName: 'getScheduleVisit', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliUUID, 'atividade': atividade, 'pageSize': pageSize, 'pageNumber': pageNumber, 'chaveBusca': chaveBusca ?? '', }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? errorMsg(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); int? totalRows(dynamic response) => castToType(getJsonField( response, r'''$.total_rows''', )); List? visitas(dynamic response) => getJsonField( response, r'''$.visitas''', true, ) as List?; List? visitaDesNome(dynamic response) => (getJsonField( response, r'''$.visitas[:].DES_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaMotDescricao(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaMotDia(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_DIA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaMotHorafixa(dynamic response) => getJsonField( response, r'''$.visitas[:].MOT_HORAFIXA''', true, ) as List?; List? visitaMotHoras(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_HORAS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaMotMinutos(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_MINUTOS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaMotTipo(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaNacDescricao(dynamic response) => (getJsonField( response, r'''$.visitas[:].NAC_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawChave(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_CHAVE''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVarDestino(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DESTINO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawDtCriacao(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DTCRIACAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawDtFIm(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DTFIM''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawDtInicio(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DTINICIO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawId(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawObs(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_OBS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawStatus(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_STATUS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVawUnica(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_UNICA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVteDocumentos(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_DOCUMENTO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVteEmail(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_EMAIL''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVteEmpresa(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_EMPRESA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVteNome(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVteTipo(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVteTelefone(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_TELEFONE''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? visitaVdoNome(dynamic response) => (getJsonField( response, r'''$.visitas[:].VDO_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); int? visitaTotalPages(dynamic response) => castToType(getJsonField( response, r'''$.total_pages''', )); String? page(dynamic response) => castToType(getJsonField( response, r'''$.page''', )); } class GetDadosCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getDados'; return await ApiManager.instance .makeApiCall( callName: 'getDados', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliUUID, 'atividade': atividade, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ) .timeout(const Duration(seconds: 30)); } bool? errorBolean(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? msgStr(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); String? visitedDesNomeStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.DES_NOME''', )); String? visitedVDOTIdStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_ID''', )); String? visitedVDOTNomeStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_NOME''', )); String? visitedVDOTipoStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_TIPO''', )); String? visitedVDOImeiStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_IMEI''', )); String? visitedVDODocumentoStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_DOCUMENTO''', )); String? visitedVDOEmailStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_EMAIL''', )); String? visitedVDOStatusWebStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_STATUSWEB''', )); List? reasonsMotIdList(dynamic response) => (getJsonField( response, r'''$.motivos[:].MOT_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? reasonsMotDescStrList(dynamic response) => (getJsonField( response, r'''$.motivos[:].MOT_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? reasonsMotTypeStrList(dynamic response) => (getJsonField( response, r'''$.motivos[:].MOT_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? reasonsMotWebStrList(dynamic response) => (getJsonField( response, r'''$.motivos[:].MOT_WEB''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); dynamic visitedJson(dynamic response) => getJsonField( response, r'''$.visitado''', ); String? visitedDescIdStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.DES_ID''', )); String? visitedVDoNotTerceirosStr(dynamic response) => castToType(getJsonField( response, r'''$.visitado.VDO_NOTTERCEIROS''', )); List? reasonsJsonList(dynamic response) => getJsonField( response, r'''$.motivos''', true, ) as List?; List? resonsMotDiaStrList(dynamic response) => (getJsonField( response, r'''$.motivos[:].MOT_DIA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? reasonsMotHorasStrList(dynamic response) => (getJsonField( response, r'''$.motivos[:].MOT_HORAS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? reasonsMotMinutosStrList(dynamic response) => getJsonField( response, r'''$.motivos[:].MOT_MINUTOS''', true, ) as List?; List? reasonsMotHoraFixaStrList(dynamic response) => getJsonField( response, r'''$.motivos[:].MOT_HORAFIXA''', true, ) as List?; List? levelJsonList(dynamic response) => getJsonField( response, r'''$.niveis''', true, ) as List?; List? levelNACIdStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? levelNACDescricaoStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? levelNACHorIdStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_HOR_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? levelNACIndPermiteReentradaStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_INDPERMITEREENTRADA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? levelNACObservacaoStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_OBSERVACAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? levelNACTempoAntiCaronaStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_TEMPOANTICARONA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? levelNACTpUserStrList(dynamic response) => (getJsonField( response, r'''$.niveis[:].NAC_TPUSER''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); bool? provisionalBoolean(dynamic response) => castToType(getJsonField( response, r'''$.provisional''', )); bool? whatsappBoolean(dynamic response) => castToType(getJsonField( response, r'''$.whatsapp''', )); } class GetVisitorByDocCall { Future call({ final String? documento, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getVisitante'; return await ApiManager.instance.makeApiCall( callName: 'getVisitorByDoc', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'Documento': documento, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? errorMsg(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); dynamic visitante(dynamic response) => getJsonField( response, r'''$.visitante''', ); String? vistanteId(dynamic response) => castToType(getJsonField( response, r'''$.visitante.VTE_ID''', )); } class GetFotoVisitanteCall { Future call({ final String? documento, final String? tipo, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getFotoVisitante'; return await ApiManager.instance.makeApiCall( callName: 'getFotoVisitante', apiUrl: '$baseUrl/getImage.php', callType: ApiCallType.GET, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'Documento': documento, 'tipo': tipo, }, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } class PostProvVisitSchedulingCall { Future call({ final String? data, final String? motivo, final String? nome, final String? proID, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'putAgendamentoProv'; return await ApiManager.instance.makeApiCall( callName: 'postProvVisitScheduling', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'data': ValidatorUtil.toISO8601("dd/MM/yyyy HH:mm:ss", data!), 'motivo': motivo, 'nome': nome, 'proID': proID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } String? msg(dynamic response) => castToType(getJsonField( response, r'''$.mensagem''', )); bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); } class GetVisitsCall { Future call({ final int? pageSize, final int? pageNumber, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getVisitas'; return await ApiManager.instance.makeApiCall( callName: 'getVisits', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'pageSize': pageSize, 'pageNumber': pageNumber, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); int? totalRows(dynamic response) => castToType(getJsonField( response, r'''$.total_rows''', )); List? visitasList(dynamic response) => getJsonField( response, r'''$.visitas''', true, ) as List?; List? desNome(dynamic response) => (getJsonField( response, r'''$.visitas[:].DES_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? motDesc(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? motDia(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_DIA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? motHorafixa(dynamic response) => getJsonField( response, r'''$.visitas[:].MOT_HORAFIXA''', true, ) as List?; List? motHoras(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_HORAS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? motMinutos(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_MINUTOS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? motTipo(dynamic response) => (getJsonField( response, r'''$.visitas[:].MOT_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? nACDesc(dynamic response) => (getJsonField( response, r'''$.visitas[:].NAC_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWChave(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_CHAVE''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWDestino(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DESTINO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWDTCriacao(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DTCRIACAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWDTFim(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DTFIM''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vawdtinicio(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_DTINICIO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWId(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWObs(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_OBS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWStatus(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_STATUS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vAWUnica(dynamic response) => (getJsonField( response, r'''$.visitas[:].VAW_UNICA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vTEDocumento(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_DOCUMENTO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vTEEmail(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_EMAIL''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vTEEmpresa(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_EMPRESA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vTENome(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vTETIpo(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vTETelefone(dynamic response) => (getJsonField( response, r'''$.visitas[:].VTE_TELEFONE''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? vDONome(dynamic response) => (getJsonField( response, r'''$.visitas[:].VDO_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); } class DeleteVisitCall { Future call({ final String? idVisita, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'cancelaVisita'; return await ApiManager.instance.makeApiCall( callName: 'deleteVisit', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliID, 'atividade': atividade, 'idVisita': idVisita, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? msg(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); } class GetPessoasLocalCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String ownerUUID = (await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'getPessoasLocal', apiUrl: '$baseUrl/getPessoasLocal.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'cliID': cliUUID, 'ownID': ownerUUID, 'devUUID': devUUID, 'userUUID': userUUID, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); List? pessoas(dynamic response) => getJsonField( response, r'''$.pessoas''', true, ) as List?; List? usuEmail(dynamic response) => (getJsonField( response, r'''$.pessoas[:].USU_EMAIL''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? usuNome(dynamic response) => (getJsonField( response, r'''$.pessoas[:].USU_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); } class RespondeSolicitacaoCall { Future call({ final String? referencia, final String? tarefa, final String? resposta, final String? idVisitante, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'respondeSolicitacao'; return await ApiManager.instance.makeApiCall( callName: 'respondeSolicitacao', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'userUUID': userUUID, 'devUUID': devUUID, 'cliID': cliUUID, 'atividade': atividade, 'referencia': referencia, 'tarefa': tarefa, 'resposta': resposta, 'idVisitante': idVisitante, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); String? msg(dynamic response) => castToType(getJsonField( response, r'''$.error_msg''', )); } class GetAccessCall { Future call({ final String? pageSize, final String? pageNumber, final String? pesTipo, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getAcessos'; return await ApiManager.instance.makeApiCall( callName: 'getAccess', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliUUID, 'atividade': atividade, 'pageSize': pageSize, 'pageNumber': pageNumber, 'pesTipo': pesTipo, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); int? rows(dynamic response) => castToType(getJsonField( response, r'''$.total_rows''', )); int? pages(dynamic response) => castToType(getJsonField( response, r'''$.total_pages''', )); int? page(dynamic response) => castToType(getJsonField( response, r'''$.page''', )); List? access(dynamic response) => getJsonField( response, r'''$.acessos''', true, ) as List?; List? accessDateTime(dynamic response) => (getJsonField( response, r'''$.acessos[:].ACE_DATAHORA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessType(dynamic response) => (getJsonField( response, r'''$.acessos[:].ACE_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessDesc(dynamic response) => (getJsonField( response, r'''$.acessos[:].ACI_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessID(dynamic response) => (getJsonField( response, r'''$.acessos[:].ACI_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessMobileNotify(dynamic response) => (getJsonField( response, r'''$.acessos[:].ACI_NOTIFICA_MOBILE''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessDestDesc(dynamic response) => (getJsonField( response, r'''$.acessos[:].DEST_DESC''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessDestType(dynamic response) => (getJsonField( response, r'''$.acessos[:].DEST_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessDestID(dynamic response) => (getJsonField( response, r'''$.acessos[:].DEST_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessDestProID(dynamic response) => (getJsonField( response, r'''$.acessos[:].DEST_PRO_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIdenExternCode(dynamic response) => (getJsonField( response, r'''$.acessos[:].IDE_CODEXTERNO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIdenInternalCode(dynamic response) => (getJsonField( response, r'''$.acessos[:].IDE_CODINTERNO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIdenDesc(dynamic response) => (getJsonField( response, r'''$.acessos[:].IDE_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIdenID(dynamic response) => (getJsonField( response, r'''$.acessos[:].IDE_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIdenStatus(dynamic response) => (getJsonField( response, r'''$.acessos[:].IDE_STATUS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIdenUse(dynamic response) => (getJsonField( response, r'''$.acessos[:].IDE_USO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessPersonID(dynamic response) => (getJsonField( response, r'''$.acessos[:].PES_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessPersonName(dynamic response) => (getJsonField( response, r'''$.acessos[:].PES_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessPersonType(dynamic response) => (getJsonField( response, r'''$.acessos[:].PES_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessDescSet(dynamic response) => (getJsonField( response, r'''$.acessos[:].SET_DESCRICAO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessIDSet(dynamic response) => (getJsonField( response, r'''$.acessos[:].SET_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? accessTypeet(dynamic response) => (getJsonField( response, r'''$.acessos[:].SET_TIPO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); } class GetLiberationsCall { Stream call() { final String baseUrl = PhpGroup.getBaseUrl(); final StreamController controller = StreamController(); Future.microtask(() async { final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getSolicitacoes'; try { final response = await ApiManager.instance.makeApiCall( callName: 'getLiberations', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliUUID, 'atividade': atividade, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); controller.add(response); await controller.close(); } catch (e) { controller.addError(e); await controller.close(); } }); return controller.stream; } bool? error(dynamic response) => castToType(getJsonField( response, r'''$.error''', )); List? rqList(dynamic response) => getJsonField( response, r'''$.solicitacoes''', true, ) as List?; List? rqNotID(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotDest(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_DESTINO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotSendDate(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_DTENVIO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotReceiveDate(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_DTRESPOSTA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotEmailAnswer(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_EMAILRESPOSTA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotReason(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_MOTIVO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotSendMsg(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_MSGENVIO''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotReceiveMsg(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_MSGRESPOSTA''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotName(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotOperator(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_OPERADOR''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotStatus(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_STATUS''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqNotVTE(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].NOT_VISITANTE''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqVteID(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].VTE_ID''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqVteName(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].VTE_NOME''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); List? rqVteRG(dynamic response) => (getJsonField( response, r'''$.solicitacoes[:].VTE_RG''', true, ) as List?) ?.withoutNulls .map((x) => castToType(x)) .withoutNulls .toList(); } class GetMessagesCall { Future call({ final String? pageSize, final String? pageNumber, final String? tipoDestino, }) async { final String baseUrl = PhpGroup.getBaseUrl(); final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; const String atividade = 'getMensagens'; return await ApiManager.instance.makeApiCall( callName: 'getMessages', apiUrl: '$baseUrl/processRequest.php', callType: ApiCallType.POST, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, params: { 'devUUID': devUUID, 'userUUID': userUUID, 'cliID': cliUUID, 'atividade': atividade, 'pageSize': pageSize, 'pageNumber': pageNumber, 'tipoDestino': tipoDestino, }, bodyType: BodyType.X_WWW_FORM_URL_ENCODED, returnBody: true, encodeBodyUtf8: false, decodeUtf8: false, cache: false, isStreamingApi: false, alwaysAllowBody: false, ); } } /// End PHP Group Code class ApiPagingParams { int nextPageNumber = 0; int numItems = 0; dynamic lastResponse; ApiPagingParams({ required this.nextPageNumber, required this.numItems, required this.lastResponse, }); @override String toString() => 'PagingParams(nextPageNumber: $nextPageNumber, numItems: $numItems, lastResponse: $lastResponse,)'; } String _toEncodable(dynamic item) { return item; } String _serializeList(List? list) { list ??= []; try { return json.encode(list, toEncodable: _toEncodable); } catch (_) { if (kDebugMode) {} return '[]'; } } String _serializeJson(dynamic jsonVar, [bool isList = false]) { jsonVar ??= (isList ? [] : {}); try { return json.encode(jsonVar, toEncodable: _toEncodable); } catch (_) { if (kDebugMode) {} return isList ? '[]' : '{}'; } }