This repository was archived by the owner on Jan 5, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,24 @@ class NautaProtocol {
194194 } catch (e) {
195195 throw NautaException ('Fallo al obtener la informacion del usuario' );
196196 }
197+ } // end getUserCredit
198+
199+ static Future <String > getUserTime (SessionObject session, String username) async {
200+ final r = await Requests .post (
201+ "https://secure.etecsa.net:8443/EtecsaQueryServlet" ,
202+ body: {
203+ "op" : "getLeftTime" ,
204+ "ATTRIBUTE_UUID" : session.attributeUuid,
205+ "CSRFHW" : session.csrfhw,
206+ "wlanuserip" : session.wlanuserip,
207+ "username" : username
208+ },
209+ bodyEncoding: RequestBodyEncoding .FormURLEncoded ,
210+ );
211+
212+ r.raiseForStatus ();
213+
214+ return r.content ();
197215 }
198216}
199217
@@ -241,6 +259,14 @@ class NautaClient {
241259 }
242260 }
243261
262+ Future <String > remainingTime () async {
263+ if (session == null ) {
264+ throw NautaTimeException ('Debe iniciar sesión para conocer el tiempo restante' );
265+ }
266+
267+ return await NautaProtocol .getUserTime (session, user);
268+ }
269+
244270 Future <void > logout () async {
245271 try {
246272 await NautaProtocol .logout (session, user);
@@ -251,7 +277,7 @@ class NautaClient {
251277 }
252278 }
253279
254- void loadLastSession () async {
280+ Future < void > loadLastSession () async {
255281 session = await SessionObject .load ();
256282 }
257283}
Original file line number Diff line number Diff line change @@ -15,3 +15,7 @@ class NautaLoginException extends NautaException {
1515class NautaLogoutException extends NautaException {
1616 NautaLogoutException (message) : super (message);
1717}
18+
19+ class NautaTimeException extends NautaException {
20+ NautaTimeException (message) : super (message);
21+ }
You can’t perform that action at this time.
0 commit comments