Inceptum/launcher/src/main/java/io/gitlab/jfronny/inceptum/launcher/gson/MicrosoftAccountMeta.java

25 lines
1.2 KiB
Java

package io.gitlab.jfronny.inceptum.launcher.gson;
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
import io.gitlab.jfronny.gson.stream.JsonReader;
import io.gitlab.jfronny.gson.stream.JsonWriter;
import io.gitlab.jfronny.inceptum.common.GsonPreset;
import io.gitlab.jfronny.inceptum.launcher.api.account.MicrosoftAccount;
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.OauthTokenResponse;
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.XboxLiveAuthResponse;
import java.io.IOException;
import java.util.Date;
@GSerializable(configure = GsonPreset.Api.class)
public record MicrosoftAccountMeta(String accountId, String minecraftUsername, String uuid, String accessToken, OauthTokenResponse oauthToken, XboxLiveAuthResponse xstsAuth, Date accessTokenExpiresAt, boolean mustLogin) {
public static void write(JsonWriter writer, MicrosoftAccount value) throws IOException {
GC_MicrosoftAccountMeta.write(writer, value == null ? null : value.toMeta());
}
public static MicrosoftAccount read(JsonReader reader) throws IOException {
MicrosoftAccountMeta meta = GC_MicrosoftAccountMeta.read(reader);
return meta == null ? null : new MicrosoftAccount(meta);
}
}