diff --git a/library/src/main/kotlin/one/mixin/bot/api/call/UserCallService.kt b/library/src/main/kotlin/one/mixin/bot/api/call/UserCallService.kt index 076bf59..79a7373 100644 --- a/library/src/main/kotlin/one/mixin/bot/api/call/UserCallService.kt +++ b/library/src/main/kotlin/one/mixin/bot/api/call/UserCallService.kt @@ -56,4 +56,7 @@ interface UserCallService { fun mixinMainnetRPCCall( @Body rpcRequest: RpcRequest ): Call + + @GET("search/{query}") + fun searchCall(@Path("query") query: String): Call> } diff --git a/library/src/main/kotlin/one/mixin/bot/api/coroutine/UserCoroutineService.kt b/library/src/main/kotlin/one/mixin/bot/api/coroutine/UserCoroutineService.kt index d3ac26b..1eb6ed8 100644 --- a/library/src/main/kotlin/one/mixin/bot/api/coroutine/UserCoroutineService.kt +++ b/library/src/main/kotlin/one/mixin/bot/api/coroutine/UserCoroutineService.kt @@ -47,4 +47,7 @@ interface UserCoroutineService { suspend fun mixinMainnetRPC( @Body rpcRequest: RpcRequest ): JsonObject + + @GET("search/{query}") + suspend fun search(@Path("query") query: String): MixinResponse } diff --git a/samples/src/main/java/jvmMain/java/Sample.java b/samples/src/main/java/jvmMain/java/Sample.java index 14644c3..8de301b 100644 --- a/samples/src/main/java/jvmMain/java/Sample.java +++ b/samples/src/main/java/jvmMain/java/Sample.java @@ -37,6 +37,8 @@ public static void main(String[] args) { EdDSAPublicKey publicKey = (EdDSAPublicKey) (sessionKey.getPublic()); String sessionSecret = base64Encode(publicKey.getAbyte()); + // searchUser(client); + User user = createUser(client, sessionSecret); assert user != null; client.setUserToken(getUserToken(user, sessionKey, false)); @@ -157,6 +159,17 @@ private static User createUser(HttpClient client, String sessionSecret) throws I return user; } + private static void searchUser(HttpClient client) throws IOException { + // Search user + MixinResponse userResponse = client.getUserService().searchCall("26832").execute().body(); + assert userResponse != null; + if (userResponse.isSuccess()) { + System.out.printf("User %s: %s%n", Objects.requireNonNull(userResponse.getData()).getFullName(), Objects.requireNonNull(userResponse.getData()).getUserId()); + } else { + System.out.println("Search failure"); + } + } + private static void createPin(HttpClient client, String userAesKey) throws IOException { MixinResponse pinResponse = client.getUserService().createPinCall(new PinRequest(Objects.requireNonNull(encryptPin(userAesKey, Sample.userPin)), null)).execute().body(); assert pinResponse != null;