2019-09-20 18:35:36 +12:00
|
|
|
import "package:appwrite/service.dart";
|
|
|
|
import "package:appwrite/client.dart";
|
2019-09-20 18:33:11 +12:00
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
|
|
|
|
class Account extends Service {
|
|
|
|
|
|
|
|
Account(Client client): super(client);
|
|
|
|
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/get.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> get() async {
|
|
|
|
String path = '/account';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('get', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/delete.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> delete() async {
|
|
|
|
String path = '/account';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('delete', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/update-email.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> updateEmail({email, password}) async {
|
|
|
|
String path = '/account/email';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
'email': email,
|
|
|
|
'password': password,
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('patch', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/update-name.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> updateName({name}) async {
|
|
|
|
String path = '/account/name';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
'name': name,
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('patch', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/update-password.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> updatePassword({password, oldPassword}) async {
|
|
|
|
String path = '/account/password';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
'password': password,
|
|
|
|
'old-password': oldPassword,
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('patch', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/get-prefs.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> getPrefs() async {
|
|
|
|
String path = '/account/prefs';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('get', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/update-prefs.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> updatePrefs({prefs}) async {
|
|
|
|
String path = '/account/prefs';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
'prefs': prefs,
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('patch', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/get-security.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> getSecurity() async {
|
|
|
|
String path = '/account/security';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('get', path: path, params: params);
|
|
|
|
}
|
2019-10-09 17:16:38 +13:00
|
|
|
/// /docs/references/account/get-sessions.md
|
2019-09-20 18:33:11 +12:00
|
|
|
Future<Response> getSessions() async {
|
|
|
|
String path = '/account/sessions';
|
|
|
|
|
|
|
|
Map<String, dynamic> params = {
|
|
|
|
};
|
|
|
|
|
|
|
|
return await this.client.call('get', path: path, params: params);
|
|
|
|
}
|
|
|
|
}
|