@@ -6,6 +6,7 @@ import 'exceptions/auth_exception.dart';
66import 'exceptions/too_many_requests_exception.dart' ;
77import 'minecraft/blocked_server.dart' ;
88import 'minecraft/minecraft_statistics.dart' ;
9+ import 'mojang/mojang_account.dart' ;
910import 'mojang/mojang_status.dart' ;
1011import 'mojang/name.dart' ;
1112import 'mojang/profile.dart' ;
@@ -126,7 +127,7 @@ Future<Profile> getProfile(String uuid) async {
126127
127128/// Get's the Minecraft profile for the currently logged
128129/// in user. This requires a valid access token.
129- Future <Profile > getCurrentProfile (String accessToken) async {
130+ Future <Profile > getCurrentProfile (AccessToken accessToken) async {
130131 final response = await request (
131132 http.get , _minecraftServicesApi, 'minecraft/profile' ,
132133 headers: {
@@ -148,8 +149,8 @@ Future<Profile> getCurrentProfile(String accessToken) async {
148149}
149150
150151/// Changes the Mojang account name to [newName] .
151- Future <bool > changeName (
152- String uuid, String newName, String accessToken, String password) async {
152+ Future <bool > changeName (String uuid, String newName, AccessToken accessToken,
153+ String password) async {
153154 final body = < String , String > {'name' : newName, 'password' : password};
154155 final headers = < String , String > {
155156 'authorization' : 'Bearer $accessToken ' ,
@@ -183,7 +184,7 @@ Future<bool> changeName(
183184
184185/// Reserves the [newName] for this Mojang Account.
185186// TODO: Improved return type including error message. Or just throw an error?
186- Future <bool > reserveName (String newName, String accessToken) async {
187+ Future <bool > reserveName (String newName, AccessToken accessToken) async {
187188 final headers = {
188189 'authorization' : 'Bearer $accessToken ' ,
189190 'Origin' : 'https://checkout.minecraft.net' ,
@@ -226,7 +227,7 @@ Future<bool> isNameAvailableNoAuth(String name) async {
226227/// long and not include any invalid characters to be valid.
227228/// If your access token is invalid, this will silently fail
228229/// and return false.
229- Future <bool > isNameAvailable (String name, String accessToken) async {
230+ Future <bool > isNameAvailable (String name, AccessToken accessToken) async {
230231 final response = await request (
231232 http.get , _minecraftServicesApi, 'minecraft/profile/name/$name /available' ,
232233 headers: {'authorization' : 'Bearer $accessToken ' });
@@ -241,7 +242,7 @@ Future<bool> isNameAvailable(String name, String accessToken) async {
241242}
242243
243244/// Reset's the player's skin.
244- Future <void > resetSkin (String uuid, String accessToken) async {
245+ Future <void > resetSkin (String uuid, AccessToken accessToken) async {
245246 final headers = {
246247 'authorization' : 'Bearer $accessToken ' ,
247248 };
@@ -255,7 +256,7 @@ Future<void> resetSkin(String uuid, String accessToken) async {
255256}
256257
257258/// Change the skin with the texture of the skin at [skinUrl] .
258- Future <bool > changeSkin (Uri skinUrl, String accessToken,
259+ Future <bool > changeSkin (Uri skinUrl, AccessToken accessToken,
259260 [SkinModel skinModel = SkinModel .classic]) async {
260261 final headers = {
261262 'authorization' : 'Bearer $accessToken ' ,
@@ -311,7 +312,7 @@ Future<List<BlockedServer>> getBlockedServers() async {
311312/// Checks whether or not the user has to answer the security challenges.
312313/// This will return true if the current location is not verified and needs
313314/// to be verified using [getSecurityChallenges] and [answerSecurityChallenges] .
314- Future <bool > areSecurityChallengesNeeded (String accessToken) async {
315+ Future <bool > areSecurityChallengesNeeded (AccessToken accessToken) async {
315316 final headers = {
316317 'authorization' : 'Bearer $accessToken ' ,
317318 };
@@ -324,7 +325,7 @@ Future<bool> areSecurityChallengesNeeded(String accessToken) async {
324325/// to access the account.
325326/// Check if this is needed using [areSecurityChallengesNeeded] .
326327Future <List <SecurityChallenge >> getSecurityChallenges (
327- String accessToken) async {
328+ AccessToken accessToken) async {
328329 final headers = {
329330 'authorization' : 'Bearer $accessToken ' ,
330331 };
@@ -343,7 +344,7 @@ Future<List<SecurityChallenge>> getSecurityChallenges(
343344/// You can get the security challenges through [getSecurityChallenges] .
344345/// Also check if this is needed using [areSecurityChallengesNeeded] .
345346Future <bool > answerSecurityChallenges (
346- String accessToken, List <SecurityChallenge > answers) async {
347+ AccessToken accessToken, List <SecurityChallenge > answers) async {
347348 /// Verify we have enough answers passed.
348349 if (answers.length != 3 ) {
349350 throw ArgumentError .value (
@@ -369,7 +370,7 @@ Future<bool> answerSecurityChallenges(
369370/// from a Mojang account to a Microsoft account. This function
370371/// will simply return 'false' if the access token is invalid
371372/// or expired.
372- Future <bool > canMigrate (String accessToken) async {
373+ Future <bool > canMigrate (AccessToken accessToken) async {
373374 final response = await request (
374375 http.get , _minecraftServicesApi, 'rollout/v1/msamigration' ,
375376 headers: {
0 commit comments