Skip to content

m8ty_client_personal

m8ty_client_personal solves this with a typed interface for retrieving and managing the authenticated user’s personal data, enabling clear self-service profile journeys.

As it’s required to display specific information about the currently logged in user this client has been created.

Check the documentation of the m8ty_client_personal library to get an idea about the available models and their properties.

import 'package:dio/dio.dart';
import 'package:m8ty_client_personal/m8ty_client_personal.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';

Here some examples how the dart client can be used

final client = M8tyClientPersonal();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPersonalUserApi();
try {
final response = await api.retrieveUserData();
print('User data: ${response.data}');
} on DioException catch (e) {
throw Exception(
'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}',
);
}
final client = M8tyClientPersonal();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPersonalUserApi();
final response = await api.updateUserData(
updateUserDataRequestModel: UpdateUserDataRequestModel((b) {
// set fields to update
}),
);
final client = M8tyClientPersonal();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPersonalUserApi();
await api.deleteUserData();