m8ty_client_personal
Package overview
Section titled “Package overview”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.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_personal library to get an idea about the available models and their properties.
import all needed libraries
Section titled “import all needed libraries” 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';How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Retrieve personal user data
Section titled “Retrieve personal user data” 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}', ); }Update personal user data
Section titled “Update personal user data” final client = M8tyClientPersonal(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPersonalUserApi(); final response = await api.updateUserData( updateUserDataRequestModel: UpdateUserDataRequestModel((b) { // set fields to update }), );Delete user data
Section titled “Delete user data” final client = M8tyClientPersonal(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPersonalUserApi(); await api.deleteUserData();© m8ty GmbH 2023 · m8ty.eu
