Commit a5b2995f authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

update dependencies

parent 2c3a38ce
include: package:pedantic/analysis_options.yaml
include: package:lints/recommended.yaml
analyzer:
exclude: [build/**]
strong-mode:
implicit-casts: false
implicit-dynamic: false
\ No newline at end of file
language:
strict-casts: true
strict-raw-types: true
linter:
rules:
- cancel_subscriptions
......@@ -5,10 +5,7 @@ import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
import '../../admins.dart';
import '../models/admin_sort.dart';
import '../network_exception.dart';
import 'admins_events.dart';
import 'admins_state.dart';
class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
final Logger _log = Logger('AdminsBloc');
......@@ -107,7 +104,7 @@ class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
Future<void> _deleteAdmin(int id) async {
_log.finer('_deleteAdmin: $id');
return await _client.delete(
'https://astaprint.upb.de/api/v1/admin/admins/$id',
Uri.parse('https://astaprint.upb.de/api/v1/admin/admins/$id'),
headers: {
'X-Api-Key': _token,
},
......@@ -124,7 +121,7 @@ class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
Future<void> _getAdmins() async {
_log.finer('_getAdmins');
return await _client.get(
'https://astaprint.upb.de/api/v1/admin/admins',
Uri.parse('https://astaprint.upb.de/api/v1/admin/admins'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -151,7 +148,7 @@ class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
return await _client
.post(
'https://astaprint.uni-paderborn.de/api/v1/admin/admins',
Uri.parse('https://astaprint.uni-paderborn.de/api/v1/admin/admins'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......@@ -179,7 +176,7 @@ class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
return await _client
.put(
'https://astaprint.upb.de/api/v1/admin/admins/$id/password',
Uri.parse('https://astaprint.upb.de/api/v1/admin/admins/$id/password'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -236,7 +233,7 @@ class AdminsBloc extends Bloc<AdminsEvent, AdminsState> {
return await _client
.put(
'https://astaprint.upb.de/api/v1/admin/admins/$id',
Uri.parse('https://astaprint.upb.de/api/v1/admin/admins/$id'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......
......@@ -62,7 +62,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
Future<void> _postLogin(String user, String password) async {
log.finer('_postLogin: $user, $password');
return await client.post('https://astaprint.upb.de/api/v1/admin/tokens', headers: {
return await client.post(Uri.parse('https://astaprint.upb.de/api/v1/admin/tokens'), headers: {
'Authorization': 'Basic ' + base64.encode(utf8.encode('$user:$password')),
}).then(
(http.Response response) {
......
......@@ -59,7 +59,7 @@ class DispatcherBloc extends Bloc<DispatcherEvent, DispatcherState> {
Future<List<DispatcherTask>> _getQueue() async {
_l.finer('_getQueue');
return await _client.get(
'https://astaprint.upb.de/api/v1/admin/jobs/queue',
Uri.parse('https://astaprint.upb.de/api/v1/admin/jobs/queue'),
headers: {
'X-Api-Key': _token,
},
......
......@@ -223,7 +223,8 @@ class JournalBloc extends Bloc<JournalEvent, JournalState> {
Future<void> _getJournal({int limit = 50, int offset = 0}) async {
log.finer('_getJournal:');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/journal?limit=${limit?.toString()}&offset=${offset?.toString()}',
Uri.parse(
'https://astaprint.upb.de/api/v1/admin/journal?limit=${limit?.toString()}&offset=${offset?.toString()}'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -247,7 +248,7 @@ class JournalBloc extends Bloc<JournalEvent, JournalState> {
log.finer('_postJournal:');
return await client
.post(
'https://astaprint.upb.de/api/v1/admin/journal',
Uri.parse('https://astaprint.upb.de/api/v1/admin/journal'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......
......@@ -72,7 +72,7 @@ class JournalTokenBloc extends Bloc<JournalTokenEvent, JournalTokenState> {
Future<void> _getJournalTokens() async {
log.finer('_getJournalTokens:');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/journal/tokens',
Uri.parse('https://astaprint.upb.de/api/v1/admin/journal/tokens'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -96,7 +96,7 @@ class JournalTokenBloc extends Bloc<JournalTokenEvent, JournalTokenState> {
Future<void> _postJournalToken(int value) async {
log.finer('_postJournalToken:');
return await client.post(
'https://astaprint.upb.de/api/v1/admin/journal/tokens?value=${value}',
Uri.parse('https://astaprint.upb.de/api/v1/admin/journal/tokens?value=${value}'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......
......@@ -4,14 +4,11 @@ class Admin {
final String lastName;
final String login;
final bool owner;
Admin({
this.id,
this.firstName,
this.lastName,
this.login,
this.owner
});
factory Admin.fromMap(Map<String, dynamic> map) {
......@@ -20,7 +17,6 @@ class Admin {
firstName: map['first_name'] as String,
lastName: map['last_name'] as String,
login: map['login'] as String,
owner: map['owner'] as bool,
);
}
......@@ -29,7 +25,6 @@ class Admin {
'first_name': firstName,
'last_name': lastName,
'login': login,
'owner': owner,
};
@override
......
......@@ -75,7 +75,7 @@ class PrintQueueBloc extends Bloc<PrintQueueEvent, PrintQueueState> {
Future<void> _deleteQueue(int deviceId) async {
log.finer('_deleteQueue $deviceId');
return await _client.delete(
'https://astaprint.upb.de/api/v1/admin/printers/$deviceId/queue',
Uri.parse('https://astaprint.upb.de/api/v1/admin/printers/$deviceId/queue'),
headers: {
'X-Api-Key': _token,
},
......@@ -92,7 +92,7 @@ class PrintQueueBloc extends Bloc<PrintQueueEvent, PrintQueueState> {
Future<List<PrintQueueTask>> _getQueue(int deviceId) async {
log.finer('_getQueue $deviceId');
return await _client.get(
'https://astaprint.upb.de/api/v1/admin/printers/$deviceId/queue',
Uri.parse('https://astaprint.upb.de/api/v1/admin/printers/$deviceId/queue'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......
......@@ -170,7 +170,7 @@ class PrintersBloc extends Bloc<PrintersEvent, PrintersState> {
log.finer('_addPrinter:');
return await client
.post(
'https://astaprint.upb.de/api/v1/admin/printers',
Uri.parse('https://astaprint.upb.de/api/v1/admin/printers'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -193,7 +193,7 @@ class PrintersBloc extends Bloc<PrintersEvent, PrintersState> {
Future<void> _deletePrinter(int deviceId) async {
log.finer('_deletePrinter');
return await client
.delete('https://astaprint.upb.de/api/v1/admin/printers/$deviceId', headers: {
.delete(Uri.parse('https://astaprint.upb.de/api/v1/admin/printers/$deviceId'), headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
}).then(
......@@ -289,7 +289,7 @@ class PrintersBloc extends Bloc<PrintersEvent, PrintersState> {
Future<void> _getPrinterDetails(int deviceId) async {
log.finer('_getPrinterDetails:');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/printers/$deviceId',
Uri.parse('https://astaprint.upb.de/api/v1/admin/printers/$deviceId'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -338,7 +338,7 @@ class PrintersBloc extends Bloc<PrintersEvent, PrintersState> {
Future<void> _getPrinters() async {
log.finer('_getPrinters:');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/printers',
Uri.parse('https://astaprint.upb.de/api/v1/admin/printers'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -484,7 +484,7 @@ class PrintersBloc extends Bloc<PrintersEvent, PrintersState> {
log.finer('_updatePrinterDetails: $deviceId $details');
return await client
.put(
'https://astaprint.upb.de/api/v1/admin/printers/$deviceId',
Uri.parse('https://astaprint.upb.de/api/v1/admin/printers/$deviceId'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......
......@@ -158,7 +158,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _getCredit(int userId) async {
log.finer('_getCredit: $userId');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/users/$userId/credit',
Uri.parse('https://astaprint.upb.de/api/v1/admin/users/$userId/credit'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -184,7 +184,8 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
}) async {
log.finer('_getJournal: $userId');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/users/$userId/journal\?limit\=${limit.toString()}',
Uri.parse(
'https://astaprint.upb.de/api/v1/admin/users/$userId/journal\?limit\=${limit.toString()}'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -208,7 +209,8 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _getUsers({int limit = 50, int offset = 0}) async {
log.finer('_getUsers:');
return await client.get(
'https://astaprint.upb.de/api/v1/admin/users?limit=${limit?.toString()}&offset=${offset?.toString()}',
Uri.parse(
'https://astaprint.upb.de/api/v1/admin/users?limit=${limit?.toString()}&offset=${offset?.toString()}'),
headers: {
'X-Api-Key': _token,
'Accept': 'application/json',
......@@ -231,7 +233,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _postResetPassword(int userId) async {
log.finer('_postResetPassword: $userId');
return await post(
'https://astaprint.upb.de/api/v1/admin/users/$userId/password',
Uri.parse('https://astaprint.upb.de/api/v1/admin/users/$userId/password'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......@@ -250,7 +252,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _postUser(String name, String password, int card, int pin) async {
log.finer('_postUser: $name');
return await post(
'https://astaprint.upb.de/api/v1/admin/user',
Uri.parse('https://astaprint.upb.de/api/v1/admin/user'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......@@ -276,7 +278,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
log.finer('_putLocked: $userId.locked = $locked');
return await client
.put(
'https://astaprint.upb.de/api/v1/admin/users/$userId/locked',
Uri.parse('https://astaprint.upb.de/api/v1/admin/users/$userId/locked'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......@@ -298,7 +300,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _putUserEmail(int userId, String email) async {
log.finer('_puUserEmail: $userId');
return await put(
'https://astaprint.upb.de/api/v1/admin/users/$userId/email',
Uri.parse('https://astaprint.upb.de/api/v1/admin/users/$userId/email'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......@@ -318,7 +320,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _putUserName(int userId, String name) async {
log.finer('_putUserName: $userId');
return await put(
'https://astaprint.upb.de/api/v1/admin/users/$userId/name',
Uri.parse('https://astaprint.upb.de/api/v1/admin/users/$userId/name'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......@@ -338,7 +340,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
Future<void> _putUserPassword(int userId, String password) async {
log.finer('_puUserPassword: $userId');
return await put(
'https://astaprint.upb.de/api/v1/admin/users/$userId/password',
Uri.parse('https://astaprint.upb.de/api/v1/admin/users/$userId/password'),
headers: {
'X-Api-Key': _token,
'Content-Type': 'application/json',
......
......@@ -9,11 +9,11 @@ environment:
sdk: '>=2.6.0 <3.0.0'
dependencies:
logging: ^0.11.4
logging: ^1.0.2
bloc: ^6.1.1
http: ^0.12.2
meta: ^1.2.4
http: ^0.13.4
meta: ^1.7.0
dev_dependencies:
test: ^1.15.7
pedantic: ^1.9.2
lint: ^1.8.2
......@@ -4,7 +4,7 @@ import 'package:http/http.dart' as http;
Future<String> getToken(String username, String password) async {
return await http.post(
'https://astaprint.upb.de/api/v1/admin/tokens',
Uri.parse('https://astaprint.upb.de/api/v1/admin/tokens'),
headers: {'Authorization': 'Basic ' + base64.encode(utf8.encode('$username:$password'))},
).then((http.Response response) {
if (response.statusCode == 200) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment