implement changing username

This commit is contained in:
2025-04-12 14:35:08 +02:00
parent cdb92757aa
commit e6709cd4af
3 changed files with 75 additions and 2 deletions

View File

@@ -162,6 +162,20 @@ class APIClient {
);
}
static Future<User> updateUser(TokenSource auth, String uid, {String? username, String? proToken}) async {
return await _request(
name: 'updateUser',
method: 'PATCH',
relURL: 'users/$uid',
jsonBody: {
if (username != null) 'username': username,
if (proToken != null) 'pro_token': proToken,
},
fn: User.fromJson,
authToken: auth.getToken(),
);
}
static Future<Client> addClient(TokenSource auth, String fcmToken, String agentModel, String agentVersion, String? name, String clientType) async {
return await _request(
name: 'addClient',