Skip to content

Commit

Permalink
feat: add new method to retrieve list of current user wallets using api
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed Jul 15, 2021
1 parent 8bece56 commit 810cc0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/nobitex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,13 @@ class Nobitex {

return jsonDecode(response.body) as Map<String, dynamic>?;
}

Future<Map<String, dynamic>?> getWallets() async {
var url = Uri.https(this.basePath, '/users/wallets/list');

var response =
await http.post(url, headers: {'Authorization': 'Token ' + this.token});

return jsonDecode(response.body) as Map<String, dynamic>?;
}
}
6 changes: 6 additions & 0 deletions test/nobitex_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ void main() {

expect(data!.containsKey('profile'), true);
});

test('test getWallets', () async {
var data = await nobitex.getWallets();

expect(data!.containsKey('wallets'), true);
});
});
}

0 comments on commit 810cc0c

Please sign in to comment.