@@ -61,29 +61,25 @@ public Task<UserUUID> GetUUID(string username, long timestamp) =>
61
61
}
62
62
} ) ;
63
63
64
- public Task < NameHistoryResponse > GetNameHistories ( string uuid ) =>
65
- client . SendActionAsync ( new HttpAction < NameHistoryResponse >
64
+ public Task < NameHistory [ ] ? > GetNameHistories ( string uuid ) =>
65
+ client . SendActionAsync ( new HttpAction < NameHistory [ ] ? >
66
66
{
67
67
Method = HttpMethod . Get ,
68
68
Host = "https://api.mojang.com" ,
69
69
Path = $ "user/profiles/{ uuid ? . Replace ( "-" , "" ) ?? throw new ArgumentNullException ( nameof ( uuid ) ) } /names",
70
- ResponseHandler = async ( response ) =>
71
- {
72
- var handler = HttpResponseHandlers . GetJsonArrayHandler < NameHistory > ( ) ;
73
- var histories = await handler . Invoke ( response ) ;
74
- return new NameHistoryResponse ( histories ) ;
75
- } ,
76
- ErrorHandler = HttpResponseHandlers . GetJsonErrorHandler < NameHistoryResponse > ( )
70
+ ResponseHandler = HttpResponseHandlers . GetJsonArrayHandler < NameHistory > ( ) ,
71
+ ErrorHandler = ( res , ex ) => Task . FromResult < NameHistory [ ] ? > ( null )
77
72
} ) ;
78
73
79
- public Task < UserUUID [ ] > GetUUIDs ( string [ ] usernames ) =>
80
- client . SendActionAsync ( new HttpAction < UserUUID [ ] >
74
+ public Task < UserUUID [ ] ? > GetUUIDs ( string [ ] usernames ) =>
75
+ client . SendActionAsync ( new HttpAction < UserUUID [ ] ? >
81
76
{
82
77
Method = HttpMethod . Post ,
83
78
Host = "https://api.mojang.com" ,
84
79
Path = "profiles/minecraft" ,
85
80
Content = new JsonHttpContent ( usernames ?? throw new ArgumentNullException ( ) ) ,
86
- ResponseHandler = HttpResponseHandlers . GetJsonArrayHandler < UserUUID > ( )
81
+ ResponseHandler = HttpResponseHandlers . GetJsonArrayHandler < UserUUID > ( ) ,
82
+ ErrorHandler = ( res , ex ) => Task . FromResult < UserUUID [ ] ? > ( null )
87
83
} ) ;
88
84
89
85
public Task < UserProfile > GetProfileUsingUUID ( string uuid ) =>
0 commit comments